diff --git a/PartyModes/PartyModeChallenge/ChallengeRounds.cs b/PartyModes/PartyModeChallenge/ChallengeRounds.cs index 908c1fa8..080084c4 100644 --- a/PartyModes/PartyModeChallenge/ChallengeRounds.cs +++ b/PartyModes/PartyModeChallenge/ChallengeRounds.cs @@ -3,58 +3,58 @@ using System.Collections.Generic; namespace VocaluxeLib.PartyModes.Challenge { - public class ChallengeRounds + public class CChallengeRounds { private readonly Random _Rand; private readonly int _NumPlayer; - public List Rounds; + public List Rounds; - public ChallengeRounds(int NumRounds, int NumPlayer, int NumPlayerAtOnce) + public CChallengeRounds(int numRounds, int numPlayer, int numPlayerAtOnce) { - Rounds = new List(); + Rounds = new List(); _Rand = new Random(DateTime.Now.Millisecond); - if (NumPlayerAtOnce < 1 || NumRounds < 1 || NumPlayer == 0) + if (numPlayerAtOnce < 1 || numRounds < 1 || numPlayer == 0) _NumPlayer = 0; else { - _NumPlayer = NumPlayer; - BuildRounds(NumRounds, NumPlayerAtOnce, _Rand); + _NumPlayer = numPlayer; + _BuildRounds(numRounds, numPlayerAtOnce, _Rand); } } - public Combination GetRound(int RoundNr) + public CCombination GetRound(int roundNr) { - if (RoundNr >= Rounds.Count || _NumPlayer == 0 || Rounds.Count == 0) + if (roundNr >= Rounds.Count || _NumPlayer == 0 || Rounds.Count == 0) return null; - return Rounds[RoundNr]; + return Rounds[roundNr]; } - private void BuildRounds(int NumRounds, int NumPlayerAtOnce, Random Rand) + private void _BuildRounds(int numRounds, int numPlayerAtOnce, Random rand) { - Combinations Combinations = new Combinations(_NumPlayer, NumPlayerAtOnce, Rand); - Rounds.Add(Combinations.GetNextCombination(null)); + CCombinations combinations = new CCombinations(_NumPlayer, numPlayerAtOnce, rand); + Rounds.Add(combinations.GetNextCombination(null)); - for (int i = 1; i < NumRounds; i++) - Rounds.Add(Combinations.GetNextCombination(GetPlayerDemand(i))); + for (int i = 1; i < numRounds; i++) + Rounds.Add(combinations.GetNextCombination(_GetPlayerDemand(i))); } - private List GetPlayerDemand(int RoundIndex) + private List _GetPlayerDemand(int roundIndex) { - List NumPlayed = new List(_NumPlayer); + List numPlayed = new List(_NumPlayer); for (int i = 0; i < _NumPlayer; i++) - NumPlayed.Add(0); + numPlayed.Add(0); - for (int i = 0; i < RoundIndex; i++) + for (int i = 0; i < roundIndex; i++) { - foreach (int PlayerIndex in Rounds[i].Player) - NumPlayed[PlayerIndex]++; + foreach (int playerIndex in Rounds[i].Player) + numPlayed[playerIndex]++; } int max = 0; - foreach (int p in NumPlayed) + foreach (int p in numPlayed) { if (p > max) max = p; @@ -65,20 +65,20 @@ namespace VocaluxeLib.PartyModes.Challenge List other = new List(); List last = new List(); - for (int i = 0; i < NumPlayed.Count; i++) + for (int i = 0; i < numPlayed.Count; i++) { - if (RoundIndex == 0 || NumPlayed[i] < max) + if (roundIndex == 0 || numPlayed[i] < max) { - if (RoundIndex == 0 || RoundIndex > 0 && NumPlayed[i] < max && !Rounds[RoundIndex - 1].IsAvailable(i)) + if (roundIndex == 0 || roundIndex > 0 && numPlayed[i] < max && !Rounds[roundIndex - 1].IsAvailable(i)) result.Add(i); - else if (NumPlayed[i] < max) + else if (numPlayed[i] < max) other.Add(i); } else { - if (RoundIndex > 0) + if (roundIndex > 0) { - if (!Rounds[RoundIndex - 1].IsAvailable(i)) + if (!Rounds[roundIndex - 1].IsAvailable(i)) other.Add(i); else last.Add(i); @@ -116,48 +116,48 @@ namespace VocaluxeLib.PartyModes.Challenge } } - class Combinations + class CCombinations { - private readonly List _Combs; + private readonly List _Combs; private readonly Random _Rand; private readonly int _NumPlayer; private readonly int _NumMics; - public Combinations(int NumPlayer, int NumMics, Random Rand) + public CCombinations(int numPlayer, int numMics, Random rand) { - _Combs = new List(); - _NumMics = NumMics; - _NumPlayer = NumPlayer; - _Rand = Rand; + _Combs = new List(); + _NumMics = numMics; + _NumPlayer = numPlayer; + _Rand = rand; } - public Combination GetNextCombination(List PlayerNrDemand) + public CCombination GetNextCombination(List playerNrDemand) { if (_Combs.Count == 0) - Create(); + _Create(); - Combination combs = new Combination(); + CCombination combs = new CCombination(); if (_NumPlayer == _NumMics) return _Combs[0]; //filter against PlayerNrDemand - List combsFiltered = new List(); - if (PlayerNrDemand != null) + List combsFiltered = new List(); + if (playerNrDemand != null) { for (int i = 0; i < _Combs.Count; i++) { - if (_Combs[i].IsAvailableAll(PlayerNrDemand)) + if (_Combs[i].IsAvailableAll(playerNrDemand)) combsFiltered.Add(_Combs[i]); } } //1st fallback - if (PlayerNrDemand != null && combsFiltered.Count == 0) + if (playerNrDemand != null && combsFiltered.Count == 0) { for (int i = 0; i < _Combs.Count; i++) { - if (_Combs[i].IsAvailableSomeone(PlayerNrDemand)) + if (_Combs[i].IsAvailableSomeone(playerNrDemand)) combsFiltered.Add(_Combs[i]); } } @@ -171,7 +171,7 @@ namespace VocaluxeLib.PartyModes.Challenge int num = combsFiltered.Count; int rand = _Rand.Next(num); - Combination c = new Combination(); + CCombination c = new CCombination(); for (int i = 0; i < combsFiltered[rand].Player.Count; i++) c.Player.Add(combsFiltered[rand].Player[i]); _Combs.Remove(combsFiltered[rand]); @@ -179,7 +179,7 @@ namespace VocaluxeLib.PartyModes.Challenge return combsFiltered[rand]; } - private void Create() + private void _Create() { _Combs.Clear(); @@ -187,7 +187,7 @@ namespace VocaluxeLib.PartyModes.Challenge for (int i = 1; i <= num; i++) { - Combination c = new Combination(); + CCombination c = new CCombination(); for (int j = 0; j < _NumPlayer; j++) { @@ -201,37 +201,37 @@ namespace VocaluxeLib.PartyModes.Challenge } } - public class Combination + public class CCombination { public List Player; - public Combination() + public CCombination() { Player = new List(); } - public bool IsAvailable(int PlayerIndex) + public bool IsAvailable(int playerIndex) { foreach (int p in Player) { - if (p == PlayerIndex) + if (p == playerIndex) return true; } return false; } - public bool IsAvailableAll(List PlayerIndices) + public bool IsAvailableAll(List playerIndices) { bool result = true; - foreach (int p in PlayerIndices) + foreach (int p in playerIndices) result &= IsAvailable(p); return result; } - public bool IsAvailableSomeone(List PlayerIndices) + public bool IsAvailableSomeone(List playerIndices) { bool result = false; - foreach (int p in PlayerIndices) + foreach (int p in playerIndices) result |= IsAvailable(p); return result; } diff --git a/PartyModes/PartyModeChallenge/PartyModeChallenge.cs b/PartyModes/PartyModeChallenge/PartyModeChallenge.cs index 615ccdc0..6b75ef48 100644 --- a/PartyModes/PartyModeChallenge/PartyModeChallenge.cs +++ b/PartyModes/PartyModeChallenge/PartyModeChallenge.cs @@ -11,30 +11,30 @@ namespace VocaluxeLib.PartyModes.Challenge #region Communication #region ToScreen - public struct DataToScreenConfig + public struct SDataToScreenConfig { public int NumPlayer; public int NumPlayerAtOnce; public int NumRounds; } - public struct DataToScreenNames + public struct SDataToScreenNames { public int NumPlayer; public List ProfileIDs; } - public struct DataToScreenMain + public struct SDataToScreenMain { public int CurrentRoundNr; public int NumPlayerAtOnce; - public List Combs; + public List Combs; public int[,] Results; - public List ResultTable; + public List ResultTable; public List ProfileIDs; } - public class ResultTableRow : IComparable + public class CResultTableRow : IComparable { public int Position; public int PlayerID; @@ -46,9 +46,9 @@ namespace VocaluxeLib.PartyModes.Challenge public int CompareTo(object obj) { - if (obj is ResultTableRow) + if (obj is CResultTableRow) { - ResultTableRow row = (ResultTableRow)obj; + CResultTableRow row = (CResultTableRow)obj; int res = row.NumGamePoints.CompareTo(NumGamePoints); if (res == 0) @@ -66,28 +66,28 @@ namespace VocaluxeLib.PartyModes.Challenge #endregion ToScreen #region FromScreen - public struct DataFromScreen + public struct SDataFromScreen { - public FromScreenConfig ScreenConfig; - public FromScreenNames ScreenNames; - public FromScreenMain ScreenMain; + public SFromScreenConfig ScreenConfig; + public SFromScreenNames ScreenNames; + public SFromScreenMain ScreenMain; } - public struct FromScreenConfig + public struct SFromScreenConfig { public int NumPlayer; public int NumPlayerAtOnce; public int NumRounds; } - public struct FromScreenNames + public struct SFromScreenNames { public bool FadeToConfig; public bool FadeToMain; public List ProfileIDs; } - public struct FromScreenMain + public struct SFromScreenMain { public bool FadeToSongSelection; public bool FadeToNameSelection; @@ -96,13 +96,13 @@ namespace VocaluxeLib.PartyModes.Challenge #endregion Communication - public sealed class PartyModeChallenge : CPartyMode + public sealed class CPartyModeChallenge : CPartyMode { - private const int MaxPlayer = 12; - private const int MinPlayer = 1; - private const int MaxTeams = 0; - private const int MinTeams = 0; - private const int MaxNumRounds = 100; + private const int _MaxPlayer = 12; + private const int _MinPlayer = 1; + private const int _MaxTeams = 0; + private const int _MinTeams = 0; + private const int _MaxNumRounds = 100; private enum EStage { @@ -113,15 +113,15 @@ namespace VocaluxeLib.PartyModes.Challenge Singing } - private struct Data + private struct SData { public int NumPlayer; public int NumPlayerAtOnce; public int NumRounds; public List ProfileIDs; - public ChallengeRounds Rounds; - public List ResultTable; + public CChallengeRounds Rounds; + public List ResultTable; public int[,] Results; public int CurrentRoundNr; @@ -129,7 +129,7 @@ namespace VocaluxeLib.PartyModes.Challenge public int[] CatSongIndices; } - private struct Stats + private struct SStats { public int ProfileID; public int SingPoints; @@ -137,14 +137,14 @@ namespace VocaluxeLib.PartyModes.Challenge public int Won; } - private DataToScreenConfig ToScreenConfig; - private DataToScreenNames ToScreenNames; - private DataToScreenMain ToScreenMain; + private SDataToScreenConfig _ToScreenConfig; + private SDataToScreenNames _ToScreenNames; + private SDataToScreenMain _ToScreenMain; - private Data GameData; + private SData _GameData; private EStage _Stage; - public PartyModeChallenge() + public CPartyModeChallenge() { _ScreenSongOptions.Selection.RandomOnly = false; _ScreenSongOptions.Selection.PartyMode = true; @@ -158,18 +158,18 @@ namespace VocaluxeLib.PartyModes.Challenge _Stage = EStage.NotStarted; - ToScreenConfig = new DataToScreenConfig(); - ToScreenNames = new DataToScreenNames(); - ToScreenMain = new DataToScreenMain(); + _ToScreenConfig = new SDataToScreenConfig(); + _ToScreenNames = new SDataToScreenNames(); + _ToScreenMain = new SDataToScreenMain(); - GameData = new Data(); - GameData.NumPlayer = 4; - GameData.NumPlayerAtOnce = 2; - GameData.NumRounds = 2; - GameData.CurrentRoundNr = 1; - GameData.ProfileIDs = new List(); - GameData.CatSongIndices = null; - GameData.Results = null; + _GameData = new SData(); + _GameData.NumPlayer = 4; + _GameData.NumPlayerAtOnce = 2; + _GameData.NumRounds = 2; + _GameData.CurrentRoundNr = 1; + _GameData.ProfileIDs = new List(); + _GameData.CatSongIndices = null; + _GameData.Results = null; } public override bool Init() @@ -184,44 +184,44 @@ namespace VocaluxeLib.PartyModes.Challenge 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(); - GameData.ResultTable = new List(); + _ToScreenMain.ResultTable = new List(); + _GameData.ResultTable = new List(); return true; } - public override void DataFromScreen(string ScreenName, Object Data) + public override void DataFromScreen(string screenName, Object data) { - DataFromScreen dataFrom = new DataFromScreen(); - switch (ScreenName) + SDataFromScreen dataFrom = new SDataFromScreen(); + switch (screenName) { case "PartyScreenChallengeConfig": try { - dataFrom = (DataFromScreen)Data; - GameData.NumPlayer = dataFrom.ScreenConfig.NumPlayer; - GameData.NumPlayerAtOnce = dataFrom.ScreenConfig.NumPlayerAtOnce; - GameData.NumRounds = dataFrom.ScreenConfig.NumRounds; + dataFrom = (SDataFromScreen)data; + _GameData.NumPlayer = dataFrom.ScreenConfig.NumPlayer; + _GameData.NumPlayerAtOnce = dataFrom.ScreenConfig.NumPlayerAtOnce; + _GameData.NumRounds = dataFrom.ScreenConfig.NumRounds; _Stage = EStage.Config; CBase.Graphics.FadeTo(EScreens.ScreenPartyDummy); } catch (Exception e) { - CBase.Log.LogError("Error in party mode challenge. Can't cast received data from screen " + ScreenName + ". " + e.Message); + CBase.Log.LogError("Error in party mode challenge. Can't cast received data from screen " + screenName + ". " + e.Message); } break; case "PartyScreenChallengeNames": try { - dataFrom = (DataFromScreen)Data; + dataFrom = (SDataFromScreen)data; if (dataFrom.ScreenNames.FadeToConfig) _Stage = EStage.NotStarted; else { - GameData.ProfileIDs = dataFrom.ScreenNames.ProfileIDs; + _GameData.ProfileIDs = dataFrom.ScreenNames.ProfileIDs; _Stage = EStage.Names; } @@ -229,14 +229,14 @@ namespace VocaluxeLib.PartyModes.Challenge } catch (Exception e) { - CBase.Log.LogError("Error in party mode challenge. Can't cast received data from screen " + ScreenName + ". " + e.Message); + CBase.Log.LogError("Error in party mode challenge. Can't cast received data from screen " + screenName + ". " + e.Message); } break; case "PartyScreenChallengeMain": try { - dataFrom = (DataFromScreen)Data; + dataFrom = (SDataFromScreen)data; if (dataFrom.ScreenMain.FadeToSongSelection) _Stage = EStage.Singing; if (dataFrom.ScreenMain.FadeToNameSelection) @@ -244,18 +244,18 @@ namespace VocaluxeLib.PartyModes.Challenge } catch (Exception e) { - CBase.Log.LogError("Error in party mode challenge. Can't cast received data from screen " + ScreenName + ". " + e.Message); + CBase.Log.LogError("Error in party mode challenge. Can't cast received data from screen " + screenName + ". " + e.Message); } if (_Stage == EStage.Singing) - StartNextRound(); + _StartNextRound(); if (_Stage == EStage.Config) CBase.Graphics.FadeTo(EScreens.ScreenPartyDummy); break; default: - CBase.Log.LogError("Error in party mode challenge. Wrong screen is sending: " + ScreenName); + CBase.Log.LogError("Error in party mode challenge. Wrong screen is sending: " + screenName); break; } } @@ -269,68 +269,68 @@ namespace VocaluxeLib.PartyModes.Challenge _ScreenSongOptions.Selection.RandomOnly = false;*/ } - public override CMenuParty GetNextPartyScreen(out EScreens AlternativeScreen) + public override CMenuParty GetNextPartyScreen(out EScreens alternativeScreen) { - CMenuParty Screen = null; - AlternativeScreen = EScreens.ScreenSong; + CMenuParty screen = null; + alternativeScreen = EScreens.ScreenSong; switch (_Stage) { case EStage.NotStarted: - _Screens.TryGetValue("PartyScreenChallengeConfig", out Screen); + _Screens.TryGetValue("PartyScreenChallengeConfig", out screen); if (_Screens != null) { - ToScreenConfig.NumPlayer = GameData.NumPlayer; - ToScreenConfig.NumPlayerAtOnce = GameData.NumPlayerAtOnce; - ToScreenConfig.NumRounds = GameData.NumRounds; - Screen.DataToScreen(ToScreenConfig); + _ToScreenConfig.NumPlayer = _GameData.NumPlayer; + _ToScreenConfig.NumPlayerAtOnce = _GameData.NumPlayerAtOnce; + _ToScreenConfig.NumRounds = _GameData.NumRounds; + screen.DataToScreen(_ToScreenConfig); } break; case EStage.Config: - _Screens.TryGetValue("PartyScreenChallengeNames", out Screen); + _Screens.TryGetValue("PartyScreenChallengeNames", out screen); if (_Screens != null) { - ToScreenNames.NumPlayer = GameData.NumPlayer; - ToScreenNames.ProfileIDs = GameData.ProfileIDs; - Screen.DataToScreen(ToScreenNames); + _ToScreenNames.NumPlayer = _GameData.NumPlayer; + _ToScreenNames.ProfileIDs = _GameData.ProfileIDs; + screen.DataToScreen(_ToScreenNames); } break; case EStage.Names: - _Screens.TryGetValue("PartyScreenChallengeMain", out Screen); + _Screens.TryGetValue("PartyScreenChallengeMain", out screen); if (_Screens != null) { CBase.Songs.ResetPartySongSung(); - ToScreenMain.ResultTable = new List(); - GameData.ResultTable = new List(); - GameData.Rounds = new ChallengeRounds(GameData.NumRounds, GameData.NumPlayer, GameData.NumPlayerAtOnce); - GameData.CurrentRoundNr = 1; - ToScreenMain.CurrentRoundNr = 1; - ToScreenMain.NumPlayerAtOnce = GameData.NumPlayerAtOnce; - ToScreenMain.Combs = GameData.Rounds.Rounds; - ToScreenMain.ProfileIDs = GameData.ProfileIDs; - UpdateScores(); - ToScreenMain.ResultTable = GameData.ResultTable; - ToScreenMain.Results = GameData.Results; - Screen.DataToScreen(ToScreenMain); + _ToScreenMain.ResultTable = new List(); + _GameData.ResultTable = new List(); + _GameData.Rounds = new CChallengeRounds(_GameData.NumRounds, _GameData.NumPlayer, _GameData.NumPlayerAtOnce); + _GameData.CurrentRoundNr = 1; + _ToScreenMain.CurrentRoundNr = 1; + _ToScreenMain.NumPlayerAtOnce = _GameData.NumPlayerAtOnce; + _ToScreenMain.Combs = _GameData.Rounds.Rounds; + _ToScreenMain.ProfileIDs = _GameData.ProfileIDs; + _UpdateScores(); + _ToScreenMain.ResultTable = _GameData.ResultTable; + _ToScreenMain.Results = _GameData.Results; + screen.DataToScreen(_ToScreenMain); } break; case EStage.Main: //nothing to do break; case EStage.Singing: - _Screens.TryGetValue("PartyScreenChallengeMain", out Screen); + _Screens.TryGetValue("PartyScreenChallengeMain", out screen); if (_Screens != null) { - UpdateScores(); - ToScreenMain.CurrentRoundNr = GameData.CurrentRoundNr; - ToScreenMain.Combs = GameData.Rounds.Rounds; - ToScreenMain.Results = GameData.Results; - Screen.DataToScreen(ToScreenMain); + _UpdateScores(); + _ToScreenMain.CurrentRoundNr = _GameData.CurrentRoundNr; + _ToScreenMain.Combs = _GameData.Rounds.Rounds; + _ToScreenMain.Results = _GameData.Results; + screen.DataToScreen(_ToScreenMain); } break; } - return Screen; + return screen; } public override EScreens GetStartScreen() @@ -343,7 +343,7 @@ namespace VocaluxeLib.PartyModes.Challenge return EScreens.ScreenPartyDummy; } - public override ScreenSongOptions GetScreenSongOptions() + public override SScreenSongOptions GetScreenSongOptions() { _ScreenSongOptions.Sorting.SongSorting = CBase.Config.GetSongSorting(); _ScreenSongOptions.Sorting.Tabs = CBase.Config.GetTabs(); @@ -352,112 +352,112 @@ namespace VocaluxeLib.PartyModes.Challenge return _ScreenSongOptions; } - public override void OnSongChange(int SongIndex, ref ScreenSongOptions ScreenSongOptions) + public override void OnSongChange(int songIndex, ref SScreenSongOptions screenSongOptions) { if (_ScreenSongOptions.Selection.SongIndex != -1) _ScreenSongOptions.Selection.SongIndex = -1; - if (_ScreenSongOptions.Selection.SelectNextRandomSong && SongIndex != -1) + if (_ScreenSongOptions.Selection.SelectNextRandomSong && songIndex != -1) { _ScreenSongOptions.Selection.SelectNextRandomSong = false; - CreateCatSongIndices(); + _CreateCatSongIndices(); - if (GameData.CatSongIndices != null) + if (_GameData.CatSongIndices != null) { - if (GameData.CatSongIndices[CBase.Songs.GetCurrentCategoryIndex()] == -1) - GameData.CatSongIndices[CBase.Songs.GetCurrentCategoryIndex()] = SongIndex; + if (_GameData.CatSongIndices[CBase.Songs.GetCurrentCategoryIndex()] == -1) + _GameData.CatSongIndices[CBase.Songs.GetCurrentCategoryIndex()] = songIndex; } } - ScreenSongOptions = _ScreenSongOptions; + screenSongOptions = _ScreenSongOptions; } - public override void OnCategoryChange(int CategoryIndex, ref ScreenSongOptions ScreenSongOptions) + public override void OnCategoryChange(int categoryIndex, ref SScreenSongOptions screenSongOptions) { - if (GameData.CatSongIndices != null && CategoryIndex != -1) + if (_GameData.CatSongIndices != null && categoryIndex != -1) { - if (GameData.CatSongIndices[CategoryIndex] == -1) + if (_GameData.CatSongIndices[categoryIndex] == -1) _ScreenSongOptions.Selection.SelectNextRandomSong = true; else - _ScreenSongOptions.Selection.SongIndex = GameData.CatSongIndices[CategoryIndex]; + _ScreenSongOptions.Selection.SongIndex = _GameData.CatSongIndices[categoryIndex]; } - if (GameData.CatSongIndices == null && CategoryIndex != -1) + if (_GameData.CatSongIndices == null && categoryIndex != -1) _ScreenSongOptions.Selection.SelectNextRandomSong = true; - if (CategoryIndex == -1) + if (categoryIndex == -1) _ScreenSongOptions.Selection.RandomOnly = false; - if (_ScreenSongOptions.Sorting.Tabs == EOffOn.TR_CONFIG_OFF || CategoryIndex != -1) + if (_ScreenSongOptions.Sorting.Tabs == EOffOn.TR_CONFIG_OFF || categoryIndex != -1) _ScreenSongOptions.Selection.RandomOnly = true; - ScreenSongOptions = _ScreenSongOptions; + screenSongOptions = _ScreenSongOptions; } - public override void SetSearchString(string SearchString, bool Visible) + public override void SetSearchString(string searchString, bool visible) { - _ScreenSongOptions.Sorting.SearchString = SearchString; - _ScreenSongOptions.Sorting.SearchActive = Visible; + _ScreenSongOptions.Sorting.SearchString = searchString; + _ScreenSongOptions.Sorting.SearchActive = visible; } public override int GetMaxPlayer() { - return MaxPlayer; + return _MaxPlayer; } public override int GetMinPlayer() { - return MinPlayer; + return _MinPlayer; } public override int GetMaxTeams() { - return MaxTeams; + return _MaxTeams; } public override int GetMinTeams() { - return MinTeams; + return _MinTeams; } public override int GetMaxNumRounds() { - return MaxNumRounds; + return _MaxNumRounds; } - public override void JokerUsed(int TeamNr) + public override void JokerUsed(int teamNr) { if (_ScreenSongOptions.Selection.NumJokers == null) return; - if (TeamNr >= _ScreenSongOptions.Selection.NumJokers.Length) + if (teamNr >= _ScreenSongOptions.Selection.NumJokers.Length) return; - _ScreenSongOptions.Selection.NumJokers[TeamNr]--; + _ScreenSongOptions.Selection.NumJokers[teamNr]--; _ScreenSongOptions.Selection.RandomOnly = true; _ScreenSongOptions.Selection.CategoryChangeAllowed = false; } - public override void SongSelected(int SongID) + public override void SongSelected(int songID) { EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL; CBase.Game.Reset(); CBase.Game.ClearSongs(); - CBase.Game.AddSong(SongID, gm); - CBase.Game.SetNumPlayer(GameData.NumPlayerAtOnce); + CBase.Game.AddSong(songID, gm); + CBase.Game.SetNumPlayer(_GameData.NumPlayerAtOnce); SPlayer[] player = CBase.Game.GetPlayer(); if (player == null) return; - if (player.Length < GameData.NumPlayerAtOnce) + if (player.Length < _GameData.NumPlayerAtOnce) return; SProfile[] profiles = CBase.Profiles.GetProfiles(); - Combination c = GameData.Rounds.GetRound(GameData.CurrentRoundNr - 1); + CCombination c = _GameData.Rounds.GetRound(_GameData.CurrentRoundNr - 1); - for (int i = 0; i < GameData.NumPlayerAtOnce; i++) + for (int i = 0; i < _GameData.NumPlayerAtOnce; i++) { //default values player[i].Name = "foobar"; @@ -467,38 +467,38 @@ namespace VocaluxeLib.PartyModes.Challenge //try to fill with the right data if (c != null) { - if (GameData.ProfileIDs[c.Player[i]] < profiles.Length) + if (_GameData.ProfileIDs[c.Player[i]] < profiles.Length) { - player[i].Name = profiles[GameData.ProfileIDs[c.Player[i]]].PlayerName; - player[i].Difficulty = profiles[GameData.ProfileIDs[c.Player[i]]].Difficulty; - player[i].ProfileID = GameData.ProfileIDs[c.Player[i]]; + player[i].Name = profiles[_GameData.ProfileIDs[c.Player[i]]].PlayerName; + player[i].Difficulty = profiles[_GameData.ProfileIDs[c.Player[i]]].Difficulty; + player[i].ProfileID = _GameData.ProfileIDs[c.Player[i]]; } } } - CBase.Songs.AddPartySongSung(SongID); + CBase.Songs.AddPartySongSung(songID); CBase.Graphics.FadeTo(EScreens.ScreenSing); } public override void LeavingHighscore() { - GameData.CurrentRoundNr++; + _GameData.CurrentRoundNr++; CBase.Graphics.FadeTo(EScreens.ScreenPartyDummy); } - private void StartNextRound() + private void _StartNextRound() { _ScreenSongOptions.Selection.RandomOnly = _ScreenSongOptions.Sorting.Tabs != EOffOn.TR_CONFIG_ON; _ScreenSongOptions.Selection.CategoryChangeAllowed = _ScreenSongOptions.Sorting.Tabs == EOffOn.TR_CONFIG_ON; - SetNumJokers(); - SetTeamNames(); - GameData.CatSongIndices = null; + _SetNumJokers(); + _SetTeamNames(); + _GameData.CatSongIndices = null; CBase.Graphics.FadeTo(EScreens.ScreenSong); } - private void SetNumJokers() + private void _SetNumJokers() { - switch (GameData.NumPlayerAtOnce) + switch (_GameData.NumPlayerAtOnce) { case 1: _ScreenSongOptions.Selection.NumJokers = new int[] {10}; @@ -529,7 +529,7 @@ namespace VocaluxeLib.PartyModes.Challenge } } - private void SetTeamNames() + private void _SetTeamNames() { SProfile[] profiles = CBase.Profiles.GetProfiles(); @@ -539,21 +539,21 @@ namespace VocaluxeLib.PartyModes.Challenge return; } - if (GameData.NumPlayerAtOnce < 1 || GameData.ProfileIDs.Count < GameData.NumPlayerAtOnce || profiles.Length < GameData.NumPlayerAtOnce) + if (_GameData.NumPlayerAtOnce < 1 || _GameData.ProfileIDs.Count < _GameData.NumPlayerAtOnce || profiles.Length < _GameData.NumPlayerAtOnce) { _ScreenSongOptions.Selection.TeamNames = new string[] {"foo", "bar"}; return; } - _ScreenSongOptions.Selection.TeamNames = new string[GameData.NumPlayerAtOnce]; - Combination c = GameData.Rounds.GetRound(GameData.CurrentRoundNr - 1); + _ScreenSongOptions.Selection.TeamNames = new string[_GameData.NumPlayerAtOnce]; + CCombination c = _GameData.Rounds.GetRound(_GameData.CurrentRoundNr - 1); - for (int i = 0; i < GameData.NumPlayerAtOnce; i++) + for (int i = 0; i < _GameData.NumPlayerAtOnce; i++) { if (c != null) { - if (GameData.ProfileIDs[c.Player[i]] < profiles.Length) - _ScreenSongOptions.Selection.TeamNames[i] = profiles[GameData.ProfileIDs[c.Player[i]]].PlayerName; + if (_GameData.ProfileIDs[c.Player[i]] < profiles.Length) + _ScreenSongOptions.Selection.TeamNames[i] = profiles[_GameData.ProfileIDs[c.Player[i]]].PlayerName; else _ScreenSongOptions.Selection.TeamNames[i] = "foobar"; } @@ -562,27 +562,27 @@ namespace VocaluxeLib.PartyModes.Challenge } } - private void UpdateScores() + private void _UpdateScores() { - if (GameData.ResultTable.Count == 0) + if (_GameData.ResultTable.Count == 0) { - for (int i = 0; i < GameData.NumPlayer; i++) + for (int i = 0; i < _GameData.NumPlayer; i++) { - ResultTableRow row = new ResultTableRow(); - row.PlayerID = GameData.ProfileIDs[i]; + CResultTableRow row = new CResultTableRow(); + row.PlayerID = _GameData.ProfileIDs[i]; row.NumPlayed = 0; row.NumRounds = 0; row.NumWon = 0; row.NumSingPoints = 0; row.NumGamePoints = 0; - GameData.ResultTable.Add(row); + _GameData.ResultTable.Add(row); } - GameData.Results = new int[GameData.NumRounds,GameData.NumPlayerAtOnce]; - for (int i = 0; i < GameData.NumRounds; i++) + _GameData.Results = new int[_GameData.NumRounds,_GameData.NumPlayerAtOnce]; + for (int i = 0; i < _GameData.NumRounds; i++) { - for (int j = 0; j < GameData.NumPlayerAtOnce; j++) - GameData.Results[i, j] = 0; + for (int j = 0; j < _GameData.NumPlayerAtOnce; j++) + _GameData.Results[i, j] = 0; } } else @@ -591,20 +591,20 @@ namespace VocaluxeLib.PartyModes.Challenge if (results == null) return; - if (results.Length < GameData.NumPlayerAtOnce) + if (results.Length < _GameData.NumPlayerAtOnce) return; - for (int j = 0; j < GameData.NumPlayerAtOnce; j++) - GameData.Results[GameData.CurrentRoundNr - 2, j] = (int)Math.Round(results[j].Points); + for (int j = 0; j < _GameData.NumPlayerAtOnce; j++) + _GameData.Results[_GameData.CurrentRoundNr - 2, j] = (int)Math.Round(results[j].Points); - List points = GetPointsForPlayer(results); + List points = _GetPointsForPlayer(results); - for (int i = 0; i < GameData.NumPlayerAtOnce; i++) + for (int i = 0; i < _GameData.NumPlayerAtOnce; i++) { int index = -1; - for (int j = 0; j < GameData.ResultTable.Count; j++) + for (int j = 0; j < _GameData.ResultTable.Count; j++) { - if (points[i].ProfileID == GameData.ResultTable[j].PlayerID) + if (points[i].ProfileID == _GameData.ResultTable[j].PlayerID) { index = j; break; @@ -613,7 +613,7 @@ namespace VocaluxeLib.PartyModes.Challenge if (index != -1) { - ResultTableRow row = GameData.ResultTable[index]; + CResultTableRow row = _GameData.ResultTable[index]; row.NumPlayed++; row.NumWon += points[i].Won; @@ -621,41 +621,41 @@ namespace VocaluxeLib.PartyModes.Challenge row.NumSingPoints += points[i].SingPoints; row.NumGamePoints += points[i].GamePoints; - GameData.ResultTable[index] = row; + _GameData.ResultTable[index] = row; } } } - GameData.ResultTable.Sort(); + _GameData.ResultTable.Sort(); //Update position-number int pos = 1; int lastPoints = 0; int lastSingPoints = 0; - for (int i = 0; i < GameData.ResultTable.Count; i++) + for (int i = 0; i < _GameData.ResultTable.Count; i++) { - if (lastPoints > GameData.ResultTable[i].NumGamePoints || lastSingPoints > GameData.ResultTable[i].NumSingPoints) + if (lastPoints > _GameData.ResultTable[i].NumGamePoints || lastSingPoints > _GameData.ResultTable[i].NumSingPoints) pos++; - GameData.ResultTable[i].Position = pos; - lastPoints = GameData.ResultTable[i].NumGamePoints; - lastSingPoints = GameData.ResultTable[i].NumSingPoints; + _GameData.ResultTable[i].Position = pos; + lastPoints = _GameData.ResultTable[i].NumGamePoints; + lastSingPoints = _GameData.ResultTable[i].NumSingPoints; } } - private List GetPointsForPlayer(SPlayer[] Results) + private List _GetPointsForPlayer(SPlayer[] results) { - List result = new List(); - for (int i = 0; i < GameData.NumPlayerAtOnce; i++) + List result = new List(); + for (int i = 0; i < _GameData.NumPlayerAtOnce; i++) { - Stats stat = new Stats(); - stat.ProfileID = Results[i].ProfileID; - stat.SingPoints = (int)Math.Round(Results[i].Points); + SStats stat = new SStats(); + stat.ProfileID = results[i].ProfileID; + stat.SingPoints = (int)Math.Round(results[i].Points); stat.Won = 0; stat.GamePoints = 0; result.Add(stat); } - result.Sort(delegate(Stats s1, Stats s2) { return s1.SingPoints.CompareTo(s2.SingPoints); }); + result.Sort(delegate(SStats s1, SStats s2) { return s1.SingPoints.CompareTo(s2.SingPoints); }); int current = result[result.Count - 1].SingPoints; int points = result.Count; @@ -663,7 +663,7 @@ namespace VocaluxeLib.PartyModes.Challenge for (int i = result.Count - 1; i >= 0; i--) { - Stats res = result[i]; + SStats res = result[i]; if (i < result.Count - 1) { @@ -695,17 +695,17 @@ namespace VocaluxeLib.PartyModes.Challenge return result; } - private void CreateCatSongIndices() + private void _CreateCatSongIndices() { - if (GameData.CatSongIndices == null && CBase.Songs.GetNumCategories() > 0 && _ScreenSongOptions.Sorting.Tabs == EOffOn.TR_CONFIG_ON) + if (_GameData.CatSongIndices == null && CBase.Songs.GetNumCategories() > 0 && _ScreenSongOptions.Sorting.Tabs == EOffOn.TR_CONFIG_ON) { - GameData.CatSongIndices = new int[CBase.Songs.GetNumCategories()]; - for (int i = 0; i < GameData.CatSongIndices.Length; i++) - GameData.CatSongIndices[i] = -1; + _GameData.CatSongIndices = new int[CBase.Songs.GetNumCategories()]; + for (int i = 0; i < _GameData.CatSongIndices.Length; i++) + _GameData.CatSongIndices[i] = -1; } if (CBase.Songs.GetNumCategories() == 0 || _ScreenSongOptions.Sorting.Tabs == EOffOn.TR_CONFIG_OFF) - GameData.CatSongIndices = null; + _GameData.CatSongIndices = null; } } } \ No newline at end of file diff --git a/PartyModes/PartyModeChallenge/PartyScreenChallengeConfig.cs b/PartyModes/PartyModeChallenge/PartyScreenChallengeConfig.cs index 9becda0e..2351bd79 100644 --- a/PartyModes/PartyModeChallenge/PartyScreenChallengeConfig.cs +++ b/PartyModes/PartyModeChallenge/PartyScreenChallengeConfig.cs @@ -4,7 +4,7 @@ using VocaluxeLib.Menu; namespace VocaluxeLib.PartyModes.Challenge { - public class PartyScreenChallengeConfig : CMenuParty + public class CPartyScreenChallengeConfig : CMenuParty { // Version number for theme files. Increment it, if you've changed something on the theme files! protected override int _ScreenVersion @@ -12,43 +12,43 @@ namespace VocaluxeLib.PartyModes.Challenge get { return 1; } } - private const string SelectSlideNumPlayers = "SelectSlideNumPlayers"; - private const string SelectSlideNumMics = "SelectSlideNumMics"; - private const string SelectSlideNumRounds = "SelectSlideNumRounds"; - private const string ButtonNext = "ButtonNext"; - private const string ButtonBack = "ButtonBack"; + private const string _SelectSlideNumPlayers = "SelectSlideNumPlayers"; + private const string _SelectSlideNumMics = "SelectSlideNumMics"; + private const string _SelectSlideNumRounds = "SelectSlideNumRounds"; + private const string _ButtonNext = "ButtonNext"; + private const string _ButtonBack = "ButtonBack"; private int _MaxNumMics = 2; private int _MaxNumRounds = 100; private int _RoundSteps = 1; - private DataFromScreen Data; + private SDataFromScreen _Data; public override void Init() { base.Init(); - _ThemeSelectSlides = new string[] {SelectSlideNumPlayers, SelectSlideNumMics, SelectSlideNumRounds}; - _ThemeButtons = new string[] {ButtonNext, ButtonBack}; + _ThemeSelectSlides = new string[] {_SelectSlideNumPlayers, _SelectSlideNumMics, _SelectSlideNumRounds}; + _ThemeButtons = new string[] {_ButtonNext, _ButtonBack}; - Data = new DataFromScreen(); - FromScreenConfig config = new FromScreenConfig(); + _Data = new SDataFromScreen(); + SFromScreenConfig config = new SFromScreenConfig(); config.NumPlayer = 4; config.NumPlayerAtOnce = 2; config.NumRounds = 12; - Data.ScreenConfig = config; + _Data.ScreenConfig = config; } - public override void DataToScreen(object ReceivedData) + public override void DataToScreen(object receivedData) { - DataToScreenConfig config = new DataToScreenConfig(); + SDataToScreenConfig config = new SDataToScreenConfig(); try { - config = (DataToScreenConfig)ReceivedData; - Data.ScreenConfig.NumPlayer = config.NumPlayer; - Data.ScreenConfig.NumPlayerAtOnce = config.NumPlayerAtOnce; - Data.ScreenConfig.NumRounds = config.NumRounds; + config = (SDataToScreenConfig)receivedData; + _Data.ScreenConfig.NumPlayer = config.NumPlayer; + _Data.ScreenConfig.NumPlayerAtOnce = config.NumPlayerAtOnce; + _Data.ScreenConfig.NumRounds = config.NumRounds; } catch (Exception e) { @@ -56,7 +56,7 @@ namespace VocaluxeLib.PartyModes.Challenge } } - public override bool HandleInput(KeyEvent keyEvent) + public override bool HandleInput(SKeyEvent keyEvent) { base.HandleInput(keyEvent); @@ -67,47 +67,47 @@ namespace VocaluxeLib.PartyModes.Challenge { case Keys.Back: case Keys.Escape: - Back(); + _Back(); break; case Keys.Enter: - UpdateSlides(); + _UpdateSlides(); - if (Buttons[ButtonBack].Selected) - Back(); + if (Buttons[_ButtonBack].Selected) + _Back(); - if (Buttons[ButtonNext].Selected) - Next(); + if (Buttons[_ButtonNext].Selected) + _Next(); break; case Keys.Left: - UpdateSlides(); + _UpdateSlides(); break; case Keys.Right: - UpdateSlides(); + _UpdateSlides(); break; } } return true; } - public override bool HandleMouse(MouseEvent mouseEvent) + public override bool HandleMouse(SMouseEvent mouseEvent) { base.HandleMouse(mouseEvent); if (mouseEvent.LB && IsMouseOver(mouseEvent)) { - UpdateSlides(); - if (Buttons[ButtonBack].Selected) - Back(); + _UpdateSlides(); + if (Buttons[_ButtonBack].Selected) + _Back(); - if (Buttons[ButtonNext].Selected) - Next(); + if (Buttons[_ButtonNext].Selected) + _Next(); } if (mouseEvent.RB) - Back(); + _Back(); return true; } @@ -122,7 +122,7 @@ namespace VocaluxeLib.PartyModes.Challenge _MaxNumRounds = _PartyMode.GetMaxNumRounds(); - RebuildSlides(); + _RebuildSlides(); } public override bool UpdateGame() @@ -136,92 +136,92 @@ namespace VocaluxeLib.PartyModes.Challenge return true; } - private void RebuildSlides() + private void _RebuildSlides() { // build num player slide (min player ... max player); - SelectSlides[SelectSlideNumPlayers].Clear(); + SelectSlides[_SelectSlideNumPlayers].Clear(); for (int i = _PartyMode.GetMinPlayer(); i <= _PartyMode.GetMaxPlayer(); i++) - SelectSlides[SelectSlideNumPlayers].AddValue(i.ToString()); - SelectSlides[SelectSlideNumPlayers].Selection = Data.ScreenConfig.NumPlayer - _PartyMode.GetMinPlayer(); + SelectSlides[_SelectSlideNumPlayers].AddValue(i.ToString()); + SelectSlides[_SelectSlideNumPlayers].Selection = _Data.ScreenConfig.NumPlayer - _PartyMode.GetMinPlayer(); - UpdateMicsAtOnce(); - SetRoundSteps(); - UpdateSlideRounds(); + _UpdateMicsAtOnce(); + _SetRoundSteps(); + _UpdateSlideRounds(); } - private void UpdateSlides() + private void _UpdateSlides() { - int player = Data.ScreenConfig.NumPlayer; - int mics = Data.ScreenConfig.NumPlayerAtOnce; - Data.ScreenConfig.NumPlayer = SelectSlides[SelectSlideNumPlayers].Selection + _PartyMode.GetMinPlayer(); - Data.ScreenConfig.NumPlayerAtOnce = SelectSlides[SelectSlideNumMics].Selection + _PartyMode.GetMinPlayer(); - Data.ScreenConfig.NumRounds = (SelectSlides[SelectSlideNumRounds].Selection + 1) * _RoundSteps; + int player = _Data.ScreenConfig.NumPlayer; + int mics = _Data.ScreenConfig.NumPlayerAtOnce; + _Data.ScreenConfig.NumPlayer = SelectSlides[_SelectSlideNumPlayers].Selection + _PartyMode.GetMinPlayer(); + _Data.ScreenConfig.NumPlayerAtOnce = SelectSlides[_SelectSlideNumMics].Selection + _PartyMode.GetMinPlayer(); + _Data.ScreenConfig.NumRounds = (SelectSlides[_SelectSlideNumRounds].Selection + 1) * _RoundSteps; - UpdateMicsAtOnce(); - SetRoundSteps(); + _UpdateMicsAtOnce(); + _SetRoundSteps(); - if (player != Data.ScreenConfig.NumPlayer || mics != Data.ScreenConfig.NumPlayerAtOnce) + if (player != _Data.ScreenConfig.NumPlayer || mics != _Data.ScreenConfig.NumPlayerAtOnce) { - int num = CHelper.CombinationCount(Data.ScreenConfig.NumPlayer, Data.ScreenConfig.NumPlayerAtOnce); + int num = CHelper.CombinationCount(_Data.ScreenConfig.NumPlayer, _Data.ScreenConfig.NumPlayerAtOnce); while (num > _MaxNumRounds) num -= _RoundSteps; - Data.ScreenConfig.NumRounds = num; + _Data.ScreenConfig.NumRounds = num; } - UpdateSlideRounds(); + _UpdateSlideRounds(); } - private void UpdateMicsAtOnce() + private void _UpdateMicsAtOnce() { //Data.ScreenConfig.NumPlayerAtOnce - int MaxNum = _MaxNumMics; - if (Data.ScreenConfig.NumPlayer < _MaxNumMics) - MaxNum = Data.ScreenConfig.NumPlayer; + int maxNum = _MaxNumMics; + if (_Data.ScreenConfig.NumPlayer < _MaxNumMics) + maxNum = _Data.ScreenConfig.NumPlayer; - if (Data.ScreenConfig.NumPlayerAtOnce > MaxNum) - Data.ScreenConfig.NumPlayerAtOnce = MaxNum; + if (_Data.ScreenConfig.NumPlayerAtOnce > maxNum) + _Data.ScreenConfig.NumPlayerAtOnce = maxNum; // build mics at once slide - SelectSlides[SelectSlideNumMics].Clear(); - for (int i = 1; i <= MaxNum; i++) - SelectSlides[SelectSlideNumMics].AddValue(i.ToString()); - SelectSlides[SelectSlideNumMics].Selection = Data.ScreenConfig.NumPlayerAtOnce - _PartyMode.GetMinPlayer(); + SelectSlides[_SelectSlideNumMics].Clear(); + for (int i = 1; i <= maxNum; i++) + SelectSlides[_SelectSlideNumMics].AddValue(i.ToString()); + SelectSlides[_SelectSlideNumMics].Selection = _Data.ScreenConfig.NumPlayerAtOnce - _PartyMode.GetMinPlayer(); } - private void UpdateSlideRounds() + private void _UpdateSlideRounds() { // build num rounds slide - SelectSlides[SelectSlideNumRounds].Clear(); + SelectSlides[_SelectSlideNumRounds].Clear(); for (int i = _RoundSteps; i <= _MaxNumRounds; i += _RoundSteps) - SelectSlides[SelectSlideNumRounds].AddValue(i.ToString()); - SelectSlides[SelectSlideNumRounds].Selection = Data.ScreenConfig.NumRounds / _RoundSteps - 1; + SelectSlides[_SelectSlideNumRounds].AddValue(i.ToString()); + SelectSlides[_SelectSlideNumRounds].Selection = _Data.ScreenConfig.NumRounds / _RoundSteps - 1; } - private void SetRoundSteps() + private void _SetRoundSteps() { - if (Data.ScreenConfig.NumPlayerAtOnce < 1 || Data.ScreenConfig.NumPlayer < 1 || Data.ScreenConfig.NumPlayerAtOnce > Data.ScreenConfig.NumPlayer) + if (_Data.ScreenConfig.NumPlayerAtOnce < 1 || _Data.ScreenConfig.NumPlayer < 1 || _Data.ScreenConfig.NumPlayerAtOnce > _Data.ScreenConfig.NumPlayer) { _RoundSteps = 1; return; } - int res = Data.ScreenConfig.NumPlayer / Data.ScreenConfig.NumPlayerAtOnce; - int mod = Data.ScreenConfig.NumPlayer % Data.ScreenConfig.NumPlayerAtOnce; + int res = _Data.ScreenConfig.NumPlayer / _Data.ScreenConfig.NumPlayerAtOnce; + int mod = _Data.ScreenConfig.NumPlayer % _Data.ScreenConfig.NumPlayerAtOnce; if (mod == 0) _RoundSteps = res; else - _RoundSteps = Data.ScreenConfig.NumPlayer; + _RoundSteps = _Data.ScreenConfig.NumPlayer; } - private void Back() + private void _Back() { - FadeTo(EScreens.ScreenParty); + _FadeTo(EScreens.ScreenParty); } - private void Next() + private void _Next() { - _PartyMode.DataFromScreen(ThemeName, Data); + _PartyMode.DataFromScreen(ThemeName, _Data); } } } \ No newline at end of file diff --git a/PartyModes/PartyModeChallenge/PartyScreenChallengeMain.cs b/PartyModes/PartyModeChallenge/PartyScreenChallengeMain.cs index d54173cf..26d04c1d 100644 --- a/PartyModes/PartyModeChallenge/PartyScreenChallengeMain.cs +++ b/PartyModes/PartyModeChallenge/PartyScreenChallengeMain.cs @@ -5,7 +5,7 @@ using VocaluxeLib.Menu; namespace VocaluxeLib.PartyModes.Challenge { - struct TableRow + struct STableRow { public CText Pos; public CText Name; @@ -15,14 +15,14 @@ namespace VocaluxeLib.PartyModes.Challenge public CText GamePoints; } - class RoundsTableRow + class CRoundsTableRow { public CText Number; public List TextPlayer; public List TextScores; } - public class PartyScreenChallengeMain : CMenuParty + public class CPartyScreenChallengeMain : CMenuParty { // Version number for theme files. Increment it, if you've changed something on the theme files! protected override int _ScreenVersion @@ -30,55 +30,55 @@ namespace VocaluxeLib.PartyModes.Challenge get { return 1; } } - private const string TextPosition = "TextPosition"; - private const string TextPlayerName = "TextPlayerName"; - private const string TextNumPlayed = "TextNumPlayed"; - private const string TextWon = "TextWon"; - private const string TextSingPoints = "TextSingPoints"; - private const string TextGamePoints = "TextGamePoints"; - private const string TextNextPlayer = "TextNextPlayer"; - private const string TextPopupReallyExit = "TextPopupReallyExit"; - private const string TextRoundPlayer = "TextRoundPlayer"; - private const string TextRoundScore = "TextRoundScore"; - private const string TextRoundNumber = "TextRoundNumber"; - private const string TextFinishMessage = "TextFinishMessage"; - private const string TextFinishPlayerWin = "TextFinishPlayerWin"; - private const string TextNextPlayerMessage = "TextNextPlayerMessage"; + private const string _TextPosition = "TextPosition"; + private const string _TextPlayerName = "TextPlayerName"; + private const string _TextNumPlayed = "TextNumPlayed"; + private const string _TextWon = "TextWon"; + private const string _TextSingPoints = "TextSingPoints"; + private const string _TextGamePoints = "TextGamePoints"; + private const string _TextNextPlayer = "TextNextPlayer"; + private const string _TextPopupReallyExit = "TextPopupReallyExit"; + private const string _TextRoundPlayer = "TextRoundPlayer"; + private const string _TextRoundScore = "TextRoundScore"; + private const string _TextRoundNumber = "TextRoundNumber"; + private const string _TextFinishMessage = "TextFinishMessage"; + private const string _TextFinishPlayerWin = "TextFinishPlayerWin"; + private const string _TextNextPlayerMessage = "TextNextPlayerMessage"; - private const string ButtonNextRound = "ButtonNextRound"; - private const string ButtonBack = "ButtonBack"; - private const string ButtonExit = "ButtonExit"; - private const string ButtonPopupYes = "ButtonPopupYes"; - private const string ButtonPopupNo = "ButtonPopupNo"; - private const string ButtonPlayerScrollUp = "ButtonPlayerScrollUp"; - private const string ButtonPlayerScrollDown = "ButtonPlayerScrollDown"; - private const string ButtonRoundsScrollUp = "ButtonRoundsScrollUp"; - private const string ButtonRoundsScrollDown = "ButtonRoundsScrollDown"; + private const string _ButtonNextRound = "ButtonNextRound"; + private const string _ButtonBack = "ButtonBack"; + private const string _ButtonExit = "ButtonExit"; + private const string _ButtonPopupYes = "ButtonPopupYes"; + private const string _ButtonPopupNo = "ButtonPopupNo"; + private const string _ButtonPlayerScrollUp = "ButtonPlayerScrollUp"; + private const string _ButtonPlayerScrollDown = "ButtonPlayerScrollDown"; + private const string _ButtonRoundsScrollUp = "ButtonRoundsScrollUp"; + private const string _ButtonRoundsScrollDown = "ButtonRoundsScrollDown"; - private const string StaticPopupBG = "StaticPopupBG"; - private const string StaticNextPlayer = "StaticNextPlayer"; + private const string _StaticPopupBG = "StaticPopupBG"; + private const string _StaticNextPlayer = "StaticNextPlayer"; - private bool ExitPopupVisible; + private bool _ExitPopupVisible; - private DataFromScreen Data; - private DataToScreenMain GameState; - private List PlayerTable; - private List RoundsTable; + private SDataFromScreen _Data; + private SDataToScreenMain _GameState; + private List _PlayerTable; + private List _RoundsTable; - private List NextPlayerTexts; - private List NextPlayerStatics; + private List _NextPlayerTexts; + private List _NextPlayerStatics; - private SRectF RoundsTableScrollArea; - private SRectF PlayerTableScrollArea; - private int RoundsTableOffset; - private int PlayerTableOffset; - private int NumPlayerVisible = 10; - private int NumRoundsVisible = 3; + private SRectF _RoundsTableScrollArea; + private SRectF _PlayerTableScrollArea; + private int _RoundsTableOffset; + private int _PlayerTableOffset; + private int _NumPlayerVisible = 10; + private int _NumRoundsVisible = 3; - public PartyScreenChallengeMain() + public CPartyScreenChallengeMain() { - Data = new DataFromScreen(); - Data.ScreenMain = new FromScreenMain(); + _Data = new SDataFromScreen(); + _Data.ScreenMain = new SFromScreenMain(); } public override void Init() @@ -87,41 +87,41 @@ namespace VocaluxeLib.PartyModes.Challenge _ThemeTexts = new string[] { - TextPosition, TextPlayerName, TextNumPlayed, TextWon, TextSingPoints, TextGamePoints, TextNextPlayer, TextPopupReallyExit, TextRoundNumber, TextRoundPlayer, - TextRoundScore, TextFinishMessage, TextFinishPlayerWin, TextNextPlayerMessage + _TextPosition, _TextPlayerName, _TextNumPlayed, _TextWon, _TextSingPoints, _TextGamePoints, _TextNextPlayer, _TextPopupReallyExit, _TextRoundNumber, _TextRoundPlayer, + _TextRoundScore, _TextFinishMessage, _TextFinishPlayerWin, _TextNextPlayerMessage }; _ThemeButtons = new string[] - {ButtonNextRound, ButtonBack, ButtonExit, ButtonPopupYes, ButtonPopupNo, ButtonPlayerScrollDown, ButtonPlayerScrollUp, ButtonRoundsScrollDown, ButtonRoundsScrollUp}; - _ThemeStatics = new string[] {StaticPopupBG, StaticNextPlayer}; + {_ButtonNextRound, _ButtonBack, _ButtonExit, _ButtonPopupYes, _ButtonPopupNo, _ButtonPlayerScrollDown, _ButtonPlayerScrollUp, _ButtonRoundsScrollDown, _ButtonRoundsScrollUp}; + _ThemeStatics = new string[] {_StaticPopupBG, _StaticNextPlayer}; } - public override void LoadTheme(string XmlPath) + public override void LoadTheme(string xmlPath) { - base.LoadTheme(XmlPath); + base.LoadTheme(xmlPath); - GameState = new DataToScreenMain(); - BuildPlayerTable(); - CreateRoundsTable(); - NextPlayerTexts = new List(); - NextPlayerStatics = new List(); + _GameState = new SDataToScreenMain(); + _BuildPlayerTable(); + _CreateRoundsTable(); + _NextPlayerTexts = new List(); + _NextPlayerStatics = new List(); for (int i = 0; i < _PartyMode.GetMaxPlayer(); i++) { - NextPlayerTexts.Add(GetNewText(Texts[TextNextPlayer])); - AddText(NextPlayerTexts[NextPlayerTexts.Count - 1]); - NextPlayerStatics.Add(GetNewStatic(Statics[StaticNextPlayer])); - AddStatic(NextPlayerStatics[NextPlayerStatics.Count - 1]); + _NextPlayerTexts.Add(GetNewText(Texts[_TextNextPlayer])); + AddText(_NextPlayerTexts[_NextPlayerTexts.Count - 1]); + _NextPlayerStatics.Add(GetNewStatic(Statics[_StaticNextPlayer])); + AddStatic(_NextPlayerStatics[_NextPlayerStatics.Count - 1]); } } - public override void DataToScreen(object ReceivedData) + public override void DataToScreen(object receivedData) { - DataToScreenMain data = new DataToScreenMain(); + SDataToScreenMain data = new SDataToScreenMain(); try { - data = (DataToScreenMain)ReceivedData; - GameState = data; + data = (SDataToScreenMain)receivedData; + _GameState = data; } catch (Exception e) { @@ -129,7 +129,7 @@ namespace VocaluxeLib.PartyModes.Challenge } } - public override bool HandleInput(KeyEvent keyEvent) + public override bool HandleInput(SKeyEvent keyEvent) { base.HandleInput(keyEvent); @@ -140,41 +140,41 @@ namespace VocaluxeLib.PartyModes.Challenge { case Keys.Back: case Keys.Escape: - if (!ExitPopupVisible) + if (!_ExitPopupVisible) { - if (GameState.CurrentRoundNr == 1) - Back(); + if (_GameState.CurrentRoundNr == 1) + _Back(); else - ShowPopup(true); + _ShowPopup(true); } else - ShowPopup(false); + _ShowPopup(false); break; case Keys.Enter: - if (!ExitPopupVisible) + if (!_ExitPopupVisible) { - if (Buttons[ButtonNextRound].Selected) - NextRound(); - if (Buttons[ButtonBack].Selected && GameState.CurrentRoundNr == 1) - Back(); - if (Buttons[ButtonExit].Selected && GameState.CurrentRoundNr > 1) - ShowPopup(true); - if (Buttons[ButtonPlayerScrollUp].Selected) - ScrollPlayerTable(-1); - if (Buttons[ButtonPlayerScrollDown].Selected) - ScrollPlayerTable(1); - if (Buttons[ButtonRoundsScrollUp].Selected) - ScrollRoundsTable(-1); - if (Buttons[ButtonRoundsScrollDown].Selected) - ScrollRoundsTable(1); + if (Buttons[_ButtonNextRound].Selected) + _NextRound(); + if (Buttons[_ButtonBack].Selected && _GameState.CurrentRoundNr == 1) + _Back(); + if (Buttons[_ButtonExit].Selected && _GameState.CurrentRoundNr > 1) + _ShowPopup(true); + if (Buttons[_ButtonPlayerScrollUp].Selected) + _ScrollPlayerTable(-1); + if (Buttons[_ButtonPlayerScrollDown].Selected) + _ScrollPlayerTable(1); + if (Buttons[_ButtonRoundsScrollUp].Selected) + _ScrollRoundsTable(-1); + if (Buttons[_ButtonRoundsScrollDown].Selected) + _ScrollRoundsTable(1); } else { - if (Buttons[ButtonPopupYes].Selected) - EndParty(); - if (Buttons[ButtonPopupNo].Selected) - ShowPopup(false); + if (Buttons[_ButtonPopupYes].Selected) + _EndParty(); + if (Buttons[_ButtonPopupNo].Selected) + _ShowPopup(false); } break; } @@ -182,57 +182,57 @@ namespace VocaluxeLib.PartyModes.Challenge return true; } - public override bool HandleMouse(MouseEvent mouseEvent) + public override bool HandleMouse(SMouseEvent mouseEvent) { base.HandleMouse(mouseEvent); if (mouseEvent.LB && IsMouseOver(mouseEvent)) { - if (!ExitPopupVisible) + if (!_ExitPopupVisible) { - if (Buttons[ButtonNextRound].Selected) - NextRound(); - if (Buttons[ButtonBack].Selected && GameState.CurrentRoundNr == 1) - Back(); - if (Buttons[ButtonExit].Selected && GameState.CurrentRoundNr > 1) - ShowPopup(true); - if (Buttons[ButtonPlayerScrollUp].Selected) - ScrollPlayerTable(-1); - if (Buttons[ButtonPlayerScrollDown].Selected) - ScrollPlayerTable(1); - if (Buttons[ButtonRoundsScrollUp].Selected) - ScrollRoundsTable(-1); - if (Buttons[ButtonRoundsScrollDown].Selected) - ScrollRoundsTable(1); + if (Buttons[_ButtonNextRound].Selected) + _NextRound(); + if (Buttons[_ButtonBack].Selected && _GameState.CurrentRoundNr == 1) + _Back(); + if (Buttons[_ButtonExit].Selected && _GameState.CurrentRoundNr > 1) + _ShowPopup(true); + if (Buttons[_ButtonPlayerScrollUp].Selected) + _ScrollPlayerTable(-1); + if (Buttons[_ButtonPlayerScrollDown].Selected) + _ScrollPlayerTable(1); + if (Buttons[_ButtonRoundsScrollUp].Selected) + _ScrollRoundsTable(-1); + if (Buttons[_ButtonRoundsScrollDown].Selected) + _ScrollRoundsTable(1); } else { - if (Buttons[ButtonPopupYes].Selected) - EndParty(); - if (Buttons[ButtonPopupNo].Selected) - ShowPopup(false); + if (Buttons[_ButtonPopupYes].Selected) + _EndParty(); + if (Buttons[_ButtonPopupNo].Selected) + _ShowPopup(false); } } if (mouseEvent.RB) { - if (!ExitPopupVisible) + if (!_ExitPopupVisible) { - if (GameState.CurrentRoundNr == 1) - Back(); + if (_GameState.CurrentRoundNr == 1) + _Back(); else - ShowPopup(true); + _ShowPopup(true); } else - ShowPopup(false); + _ShowPopup(false); } if (mouseEvent.Wheel != 0) { - if (CHelper.IsInBounds(RoundsTableScrollArea, mouseEvent)) - ScrollRoundsTable(mouseEvent.Wheel); - if (CHelper.IsInBounds(PlayerTableScrollArea, mouseEvent)) - ScrollPlayerTable(mouseEvent.Wheel); + if (CHelper.IsInBounds(_RoundsTableScrollArea, mouseEvent)) + _ScrollRoundsTable(mouseEvent.Wheel); + if (CHelper.IsInBounds(_PlayerTableScrollArea, mouseEvent)) + _ScrollPlayerTable(mouseEvent.Wheel); } return true; @@ -242,46 +242,46 @@ namespace VocaluxeLib.PartyModes.Challenge { base.OnShow(); - PlayerTableOffset = 0; - RoundsTableOffset = 0; + _PlayerTableOffset = 0; + _RoundsTableOffset = 0; - UpdatePlayerTable(); - UpdateNextPlayerPositions(); - UpdateNextPlayerContents(); - if (GameState.CurrentRoundNr == 1) - BuildRoundsTable(); + _UpdatePlayerTable(); + _UpdateNextPlayerPositions(); + _UpdateNextPlayerContents(); + if (_GameState.CurrentRoundNr == 1) + _BuildRoundsTable(); else - ScrollRoundsTable(GameState.CurrentRoundNr - 2); - UpdateRoundsTable(); + _ScrollRoundsTable(_GameState.CurrentRoundNr - 2); + _UpdateRoundsTable(); - if (GameState.CurrentRoundNr == 1) + if (_GameState.CurrentRoundNr == 1) { - Buttons[ButtonBack].Visible = true; - Buttons[ButtonExit].Visible = false; + Buttons[_ButtonBack].Visible = true; + Buttons[_ButtonExit].Visible = false; } else { - Buttons[ButtonBack].Visible = false; - Buttons[ButtonExit].Visible = true; + Buttons[_ButtonBack].Visible = false; + Buttons[_ButtonExit].Visible = true; } - if (GameState.CurrentRoundNr <= GameState.Combs.Count) + if (_GameState.CurrentRoundNr <= _GameState.Combs.Count) { - Buttons[ButtonNextRound].Visible = true; - Texts[TextFinishMessage].Visible = false; - Texts[TextFinishPlayerWin].Visible = false; - SetInteractionToButton(Buttons[ButtonNextRound]); + Buttons[_ButtonNextRound].Visible = true; + Texts[_TextFinishMessage].Visible = false; + Texts[_TextFinishPlayerWin].Visible = false; + SetInteractionToButton(Buttons[_ButtonNextRound]); } else { - Buttons[ButtonNextRound].Visible = false; - Texts[TextFinishMessage].Visible = true; - Texts[TextFinishPlayerWin].Visible = true; - Texts[TextFinishPlayerWin].Text = GetPlayerWinString(); - SetInteractionToButton(Buttons[ButtonExit]); + Buttons[_ButtonNextRound].Visible = false; + Texts[_TextFinishMessage].Visible = true; + Texts[_TextFinishPlayerWin].Visible = true; + Texts[_TextFinishPlayerWin].Text = _GetPlayerWinString(); + SetInteractionToButton(Buttons[_ButtonExit]); } - ShowPopup(false); + _ShowPopup(false); } public override bool UpdateGame() @@ -295,246 +295,246 @@ namespace VocaluxeLib.PartyModes.Challenge return true; } - private void NextRound() + private void _NextRound() { - Data.ScreenMain.FadeToNameSelection = false; - Data.ScreenMain.FadeToSongSelection = true; - _PartyMode.DataFromScreen(ThemeName, Data); + _Data.ScreenMain.FadeToNameSelection = false; + _Data.ScreenMain.FadeToSongSelection = true; + _PartyMode.DataFromScreen(ThemeName, _Data); } - private void EndParty() + private void _EndParty() { - FadeTo(EScreens.ScreenParty); + _FadeTo(EScreens.ScreenParty); } - private void ShowPopup(bool Visible) + private void _ShowPopup(bool visible) { - ExitPopupVisible = Visible; + _ExitPopupVisible = visible; - Statics[StaticPopupBG].Visible = ExitPopupVisible; - Texts[TextPopupReallyExit].Visible = ExitPopupVisible; - Buttons[ButtonPopupYes].Visible = ExitPopupVisible; - Buttons[ButtonPopupNo].Visible = ExitPopupVisible; + Statics[_StaticPopupBG].Visible = _ExitPopupVisible; + Texts[_TextPopupReallyExit].Visible = _ExitPopupVisible; + Buttons[_ButtonPopupYes].Visible = _ExitPopupVisible; + Buttons[_ButtonPopupNo].Visible = _ExitPopupVisible; - if (ExitPopupVisible) - SetInteractionToButton(Buttons[ButtonPopupNo]); + if (_ExitPopupVisible) + SetInteractionToButton(Buttons[_ButtonPopupNo]); } - private void Back() + private void _Back() { - Data.ScreenMain.FadeToNameSelection = true; - Data.ScreenMain.FadeToSongSelection = false; - _PartyMode.DataFromScreen(ThemeName, Data); + _Data.ScreenMain.FadeToNameSelection = true; + _Data.ScreenMain.FadeToSongSelection = false; + _PartyMode.DataFromScreen(ThemeName, _Data); } - private void UpdateNextPlayerPositions() + private void _UpdateNextPlayerPositions() { - float x = CBase.Settings.GetRenderW() / 2 - ((GameState.NumPlayerAtOnce * Statics[StaticNextPlayer].Rect.W) + ((GameState.NumPlayerAtOnce - 1) * 15)) / 2; - float static_y = 590; - float text_y = 550; - for (int i = 0; i < GameState.NumPlayerAtOnce; i++) + float x = CBase.Settings.GetRenderW() / 2 - ((_GameState.NumPlayerAtOnce * Statics[_StaticNextPlayer].Rect.W) + ((_GameState.NumPlayerAtOnce - 1) * 15)) / 2; + float staticY = 590; + float textY = 550; + for (int i = 0; i < _GameState.NumPlayerAtOnce; i++) { //static - NextPlayerStatics[i].Rect.X = x; - NextPlayerStatics[i].Rect.Y = static_y; - NextPlayerStatics[i].Visible = true; + _NextPlayerStatics[i].Rect.X = x; + _NextPlayerStatics[i].Rect.Y = staticY; + _NextPlayerStatics[i].Visible = true; //text - NextPlayerTexts[i].X = x + Statics[StaticNextPlayer].Rect.W / 2; - NextPlayerTexts[i].Y = text_y; - NextPlayerTexts[i].Visible = true; + _NextPlayerTexts[i].X = x + Statics[_StaticNextPlayer].Rect.W / 2; + _NextPlayerTexts[i].Y = textY; + _NextPlayerTexts[i].Visible = true; - x += Statics[StaticNextPlayer].Rect.W + 15; + x += Statics[_StaticNextPlayer].Rect.W + 15; } - for (int i = GameState.NumPlayerAtOnce; i < _PartyMode.GetMaxPlayer(); i++) + for (int i = _GameState.NumPlayerAtOnce; i < _PartyMode.GetMaxPlayer(); i++) { - NextPlayerStatics[i].Visible = false; - NextPlayerTexts[i].Visible = false; + _NextPlayerStatics[i].Visible = false; + _NextPlayerTexts[i].Visible = false; } } - private void UpdateNextPlayerContents() + private void _UpdateNextPlayerContents() { - if (GameState.CurrentRoundNr <= GameState.Combs.Count) + if (_GameState.CurrentRoundNr <= _GameState.Combs.Count) { - Texts[TextNextPlayerMessage].Visible = true; + Texts[_TextNextPlayerMessage].Visible = true; SProfile[] profiles = CBase.Profiles.GetProfiles(); - for (int i = 0; i < GameState.NumPlayerAtOnce; i++) + for (int i = 0; i < _GameState.NumPlayerAtOnce; i++) { - int pid = GameState.Combs[GameState.CurrentRoundNr - 1].Player[i]; - NextPlayerStatics[i].Texture = profiles[GameState.ProfileIDs[pid]].Avatar.Texture; - NextPlayerTexts[i].Text = profiles[GameState.ProfileIDs[pid]].PlayerName; - NextPlayerTexts[i].Color = CBase.Theme.GetPlayerColor(i + 1); + int pid = _GameState.Combs[_GameState.CurrentRoundNr - 1].Player[i]; + _NextPlayerStatics[i].Texture = profiles[_GameState.ProfileIDs[pid]].Avatar.Texture; + _NextPlayerTexts[i].Text = profiles[_GameState.ProfileIDs[pid]].PlayerName; + _NextPlayerTexts[i].Color = CBase.Theme.GetPlayerColor(i + 1); } } else { - Texts[TextNextPlayerMessage].Visible = false; - for (int i = 0; i < GameState.NumPlayerAtOnce; i++) + Texts[_TextNextPlayerMessage].Visible = false; + for (int i = 0; i < _GameState.NumPlayerAtOnce; i++) { - NextPlayerStatics[i].Visible = false; - NextPlayerTexts[i].Visible = false; + _NextPlayerStatics[i].Visible = false; + _NextPlayerTexts[i].Visible = false; } } } - private void CreateRoundsTable() + private void _CreateRoundsTable() { //Create lists - RoundsTable = new List(); + _RoundsTable = new List(); for (int i = 0; i < 5; i++) { - RoundsTableRow rtr = new RoundsTableRow(); + CRoundsTableRow rtr = new CRoundsTableRow(); rtr.TextPlayer = new List(); rtr.TextScores = new List(); - RoundsTable.Add(rtr); + _RoundsTable.Add(rtr); } //Create statics and texts for rounds - for (int round = 0; round < RoundsTable.Count; round++) + for (int round = 0; round < _RoundsTable.Count; round++) { //Round-number - CText text = GetNewText(Texts[TextRoundNumber]); + CText text = GetNewText(Texts[_TextRoundNumber]); AddText(text); - RoundsTable[round].Number = text; + _RoundsTable[round].Number = text; for (int row = 0; row < 2; row++) { for (int column = 0; column < 3; column++) { //Player - text = GetNewText(Texts[TextRoundPlayer]); + text = GetNewText(Texts[_TextRoundPlayer]); AddText(text); - RoundsTable[round].TextPlayer.Add(text); + _RoundsTable[round].TextPlayer.Add(text); //Score - text = GetNewText(Texts[TextRoundScore]); + text = GetNewText(Texts[_TextRoundScore]); AddText(text); - RoundsTable[round].TextScores.Add(text); + _RoundsTable[round].TextScores.Add(text); } } } } - private void BuildRoundsTable() + private void _BuildRoundsTable() { - RoundsTableScrollArea = new SRectF(); + _RoundsTableScrollArea = new SRectF(); - int NumPlayerInOneRow = 3; - if (GameState.NumPlayerAtOnce <= NumPlayerInOneRow) - NumRoundsVisible = 5; + int numPlayerInOneRow = 3; + if (_GameState.NumPlayerAtOnce <= numPlayerInOneRow) + _NumRoundsVisible = 5; else - NumRoundsVisible = 3; + _NumRoundsVisible = 3; - if (NumRoundsVisible > GameState.Combs.Count) - NumRoundsVisible = GameState.Combs.Count; + if (_NumRoundsVisible > _GameState.Combs.Count) + _NumRoundsVisible = _GameState.Combs.Count; - float numberX = Texts[TextRoundNumber].X; - float numberY = Texts[TextRoundNumber].Y; + float numberX = Texts[_TextRoundNumber].X; + float numberY = Texts[_TextRoundNumber].Y; - RoundsTableScrollArea.X = numberX; - RoundsTableScrollArea.Y = numberY; - RoundsTableScrollArea.W = CBase.Settings.GetRenderW() - Texts[TextRoundNumber].X - 20; + _RoundsTableScrollArea.X = numberX; + _RoundsTableScrollArea.Y = numberY; + _RoundsTableScrollArea.W = CBase.Settings.GetRenderW() - Texts[_TextRoundNumber].X - 20; - float delta = Texts[TextRoundNumber].Height; + float delta = Texts[_TextRoundNumber].Height; //Update statics and texts for rounds - for (int round = 0; round < RoundsTable.Count; round++) + for (int round = 0; round < _RoundsTable.Count; round++) { //Round-number - RoundsTable[round].Number.X = numberX; - RoundsTable[round].Number.Y = numberY; - int NumInnerRows = (int)Math.Ceiling(GameState.NumPlayerAtOnce / ((double)NumPlayerInOneRow)); - for (int row = 0; row < NumInnerRows; row++) + _RoundsTable[round].Number.X = numberX; + _RoundsTable[round].Number.Y = numberY; + int numInnerRows = (int)Math.Ceiling(_GameState.NumPlayerAtOnce / ((double)numPlayerInOneRow)); + for (int row = 0; row < numInnerRows; row++) { - int num = (row + 1) * NumPlayerInOneRow; - int NumPlayerInThisRow = NumPlayerInOneRow; - if (num > GameState.NumPlayerAtOnce) + int num = (row + 1) * numPlayerInOneRow; + int numPlayerInThisRow = numPlayerInOneRow; + if (num > _GameState.NumPlayerAtOnce) { - num = GameState.NumPlayerAtOnce; - NumPlayerInThisRow = GameState.NumPlayerAtOnce - (row * NumPlayerInOneRow); + num = _GameState.NumPlayerAtOnce; + numPlayerInThisRow = _GameState.NumPlayerAtOnce - (row * numPlayerInOneRow); } - for (int column = row * NumPlayerInOneRow; column < num; column++) + for (int column = row * numPlayerInOneRow; column < num; column++) { //Player - float _x = numberX + 15 + (CBase.Settings.GetRenderW() - Texts[TextRoundNumber].X - 20) / NumPlayerInThisRow * (column - row * NumPlayerInOneRow) + - ((CBase.Settings.GetRenderW() - Texts[TextRoundNumber].X - 20) / NumPlayerInThisRow) / 2; - float maxw = ((CBase.Settings.GetRenderW() - Texts[TextRoundNumber].X - 20) / NumPlayerInThisRow) / 2 - 5; - RoundsTable[round].TextPlayer[column].X = _x; - RoundsTable[round].TextPlayer[column].Y = numberY; - RoundsTable[round].TextPlayer[column].MaxWidth = maxw; + float x = numberX + 15 + (CBase.Settings.GetRenderW() - Texts[_TextRoundNumber].X - 20) / numPlayerInThisRow * (column - row * numPlayerInOneRow) + + ((CBase.Settings.GetRenderW() - Texts[_TextRoundNumber].X - 20) / numPlayerInThisRow) / 2; + float maxw = ((CBase.Settings.GetRenderW() - Texts[_TextRoundNumber].X - 20) / numPlayerInThisRow) / 2 - 5; + _RoundsTable[round].TextPlayer[column].X = x; + _RoundsTable[round].TextPlayer[column].Y = numberY; + _RoundsTable[round].TextPlayer[column].MaxWidth = maxw; //Score - RoundsTable[round].TextScores[column] = RoundsTable[round].TextScores[column]; - RoundsTable[round].TextScores[column].X = _x; - RoundsTable[round].TextScores[column].Y = numberY + delta; - RoundsTable[round].TextScores[column].MaxWidth = maxw; + _RoundsTable[round].TextScores[column] = _RoundsTable[round].TextScores[column]; + _RoundsTable[round].TextScores[column].X = x; + _RoundsTable[round].TextScores[column].Y = numberY + delta; + _RoundsTable[round].TextScores[column].MaxWidth = maxw; } numberY = numberY + delta + delta; } numberY = numberY + delta / 2; } - RoundsTableScrollArea.H = numberY - RoundsTableScrollArea.Y; + _RoundsTableScrollArea.H = numberY - _RoundsTableScrollArea.Y; } - private void UpdateRoundsTable() + private void _UpdateRoundsTable() { SProfile[] profile = CBase.Profiles.GetProfiles(); - for (int i = 0; i < RoundsTable.Count; i++) + for (int i = 0; i < _RoundsTable.Count; i++) { - for (int p = 0; p < RoundsTable[i].TextPlayer.Count; p++) + for (int p = 0; p < _RoundsTable[i].TextPlayer.Count; p++) { - if (GameState.Combs.Count > i + RoundsTableOffset && GameState.Combs[i + RoundsTableOffset].Player.Count > p) + if (_GameState.Combs.Count > i + _RoundsTableOffset && _GameState.Combs[i + _RoundsTableOffset].Player.Count > p) { - RoundsTable[i].Number.Visible = true; - RoundsTable[i].TextPlayer[p].Visible = true; - RoundsTable[i].TextScores[p].Visible = true; - RoundsTable[i].Number.Text = (i + 1 + RoundsTableOffset).ToString() + ")"; - int pID = GameState.ProfileIDs[GameState.Combs[i + RoundsTableOffset].Player[p]]; - RoundsTable[i].TextPlayer[p].Text = profile[pID].PlayerName; - if ((GameState.CurrentRoundNr - 1) > i + RoundsTableOffset) - RoundsTable[i].TextScores[p].Text = GameState.Results[i + RoundsTableOffset, p].ToString(); + _RoundsTable[i].Number.Visible = true; + _RoundsTable[i].TextPlayer[p].Visible = true; + _RoundsTable[i].TextScores[p].Visible = true; + _RoundsTable[i].Number.Text = (i + 1 + _RoundsTableOffset).ToString() + ")"; + int pID = _GameState.ProfileIDs[_GameState.Combs[i + _RoundsTableOffset].Player[p]]; + _RoundsTable[i].TextPlayer[p].Text = profile[pID].PlayerName; + if ((_GameState.CurrentRoundNr - 1) > i + _RoundsTableOffset) + _RoundsTable[i].TextScores[p].Text = _GameState.Results[i + _RoundsTableOffset, p].ToString(); else - RoundsTable[i].TextScores[p].Text = ""; + _RoundsTable[i].TextScores[p].Text = ""; } else { - RoundsTable[i].TextPlayer[p].Visible = false; - RoundsTable[i].TextScores[p].Visible = false; + _RoundsTable[i].TextPlayer[p].Visible = false; + _RoundsTable[i].TextScores[p].Visible = false; } } - if (GameState.Combs.Count < i + RoundsTableOffset || i + 1 > NumRoundsVisible) + if (_GameState.Combs.Count < i + _RoundsTableOffset || i + 1 > _NumRoundsVisible) { - RoundsTable[i].Number.Visible = false; - for (int p = 0; p < RoundsTable[i].TextPlayer.Count; p++) + _RoundsTable[i].Number.Visible = false; + for (int p = 0; p < _RoundsTable[i].TextPlayer.Count; p++) { - RoundsTable[i].TextPlayer[p].Visible = false; - RoundsTable[i].TextScores[p].Visible = false; + _RoundsTable[i].TextPlayer[p].Visible = false; + _RoundsTable[i].TextScores[p].Visible = false; } } } - Buttons[ButtonRoundsScrollUp].Visible = RoundsTableOffset > 0; - Buttons[ButtonRoundsScrollDown].Visible = GameState.Combs.Count - NumRoundsVisible - RoundsTableOffset > 0; + Buttons[_ButtonRoundsScrollUp].Visible = _RoundsTableOffset > 0; + Buttons[_ButtonRoundsScrollDown].Visible = _GameState.Combs.Count - _NumRoundsVisible - _RoundsTableOffset > 0; } - private void BuildPlayerTable() + private void _BuildPlayerTable() { - PlayerTableScrollArea = new SRectF(); - PlayerTableScrollArea.X = Texts[TextPosition].X; - PlayerTableScrollArea.Y = Texts[TextPosition].Y; - PlayerTableScrollArea.W = Texts[TextGamePoints].X - Texts[TextPosition].X; + _PlayerTableScrollArea = new SRectF(); + _PlayerTableScrollArea.X = Texts[_TextPosition].X; + _PlayerTableScrollArea.Y = Texts[_TextPosition].Y; + _PlayerTableScrollArea.W = Texts[_TextGamePoints].X - Texts[_TextPosition].X; - PlayerTable = new List(); - float delta = Texts[TextPosition].Height * 1.2f; + _PlayerTable = new List(); + float delta = Texts[_TextPosition].Height * 1.2f; float h = 0; for (int i = 0; i < 10; i++) { - TableRow row = new TableRow(); + STableRow row = new STableRow(); - row.Pos = GetNewText(Texts[TextPosition]); - row.Name = GetNewText(Texts[TextPlayerName]); - row.Rounds = GetNewText(Texts[TextNumPlayed]); - row.Won = GetNewText(Texts[TextWon]); - row.SingPoints = GetNewText(Texts[TextSingPoints]); - row.GamePoints = GetNewText(Texts[TextGamePoints]); + row.Pos = GetNewText(Texts[_TextPosition]); + row.Name = GetNewText(Texts[_TextPlayerName]); + row.Rounds = GetNewText(Texts[_TextNumPlayed]); + row.Won = GetNewText(Texts[_TextWon]); + row.SingPoints = GetNewText(Texts[_TextSingPoints]); + row.GamePoints = GetNewText(Texts[_TextGamePoints]); row.Pos.Y += delta * (i + 1); row.Name.Y += delta * (i + 1); @@ -559,22 +559,22 @@ namespace VocaluxeLib.PartyModes.Challenge AddText(row.SingPoints); AddText(row.GamePoints); - PlayerTable.Add(row); + _PlayerTable.Add(row); h = delta * (i + 1); } - PlayerTableScrollArea.H = h + delta; + _PlayerTableScrollArea.H = h + delta; } - private void UpdatePlayerTable() + private void _UpdatePlayerTable() { SProfile[] profiles = CBase.Profiles.GetProfiles(); - for (int i = 0; i < PlayerTable.Count; i++) + for (int i = 0; i < _PlayerTable.Count; i++) { - TableRow row = PlayerTable[i]; + STableRow row = _PlayerTable[i]; - if (i + PlayerTableOffset < GameState.ResultTable.Count) + if (i + _PlayerTableOffset < _GameState.ResultTable.Count) { row.Pos.Visible = true; row.Name.Visible = true; @@ -583,12 +583,12 @@ namespace VocaluxeLib.PartyModes.Challenge row.SingPoints.Visible = true; row.GamePoints.Visible = true; - row.Pos.Text = GameState.ResultTable[i + PlayerTableOffset].Position.ToString() + "."; - row.Name.Text = profiles[GameState.ResultTable[i + PlayerTableOffset].PlayerID].PlayerName; - row.Rounds.Text = GameState.ResultTable[i + PlayerTableOffset].NumRounds.ToString(); - row.Won.Text = GameState.ResultTable[i + PlayerTableOffset].NumWon.ToString(); - row.SingPoints.Text = GameState.ResultTable[i + PlayerTableOffset].NumSingPoints.ToString(); - row.GamePoints.Text = GameState.ResultTable[i + PlayerTableOffset].NumGamePoints.ToString(); + row.Pos.Text = _GameState.ResultTable[i + _PlayerTableOffset].Position.ToString() + "."; + row.Name.Text = profiles[_GameState.ResultTable[i + _PlayerTableOffset].PlayerID].PlayerName; + row.Rounds.Text = _GameState.ResultTable[i + _PlayerTableOffset].NumRounds.ToString(); + row.Won.Text = _GameState.ResultTable[i + _PlayerTableOffset].NumWon.ToString(); + row.SingPoints.Text = _GameState.ResultTable[i + _PlayerTableOffset].NumSingPoints.ToString(); + row.GamePoints.Text = _GameState.ResultTable[i + _PlayerTableOffset].NumGamePoints.ToString(); } else { @@ -601,54 +601,54 @@ namespace VocaluxeLib.PartyModes.Challenge } } - Buttons[ButtonPlayerScrollUp].Visible = PlayerTableOffset > 0; - Buttons[ButtonPlayerScrollDown].Visible = GameState.ProfileIDs.Count - NumPlayerVisible - PlayerTableOffset > 0; + Buttons[_ButtonPlayerScrollUp].Visible = _PlayerTableOffset > 0; + Buttons[_ButtonPlayerScrollDown].Visible = _GameState.ProfileIDs.Count - _NumPlayerVisible - _PlayerTableOffset > 0; } - private void ScrollPlayerTable(int Offset) + private void _ScrollPlayerTable(int offset) { - if (GameState.ProfileIDs.Count <= NumPlayerVisible) - PlayerTableOffset = 0; - else if (Offset < 0 && PlayerTableOffset + Offset >= 0) - PlayerTableOffset += Offset; - else if (Offset < 0 && PlayerTableOffset + Offset < 0) - PlayerTableOffset = 0; - else if (Offset > 0 && PlayerTableOffset + Offset <= GameState.ProfileIDs.Count - NumPlayerVisible) - PlayerTableOffset += Offset; - else if (Offset > 0 && PlayerTableOffset + Offset > GameState.ProfileIDs.Count - NumPlayerVisible) - PlayerTableOffset = GameState.ProfileIDs.Count - NumPlayerVisible; + if (_GameState.ProfileIDs.Count <= _NumPlayerVisible) + _PlayerTableOffset = 0; + else if (offset < 0 && _PlayerTableOffset + offset >= 0) + _PlayerTableOffset += offset; + else if (offset < 0 && _PlayerTableOffset + offset < 0) + _PlayerTableOffset = 0; + else if (offset > 0 && _PlayerTableOffset + offset <= _GameState.ProfileIDs.Count - _NumPlayerVisible) + _PlayerTableOffset += offset; + else if (offset > 0 && _PlayerTableOffset + offset > _GameState.ProfileIDs.Count - _NumPlayerVisible) + _PlayerTableOffset = _GameState.ProfileIDs.Count - _NumPlayerVisible; - UpdatePlayerTable(); + _UpdatePlayerTable(); } - private void ScrollRoundsTable(int Offset) + private void _ScrollRoundsTable(int offset) { - if (GameState.Combs.Count <= NumRoundsVisible) - RoundsTableOffset = 0; - else if (Offset < 0 && RoundsTableOffset + Offset >= 0) - RoundsTableOffset += Offset; - else if (Offset < 0 && RoundsTableOffset + Offset < 0) - RoundsTableOffset = 0; - else if (Offset > 0 && RoundsTableOffset + Offset <= GameState.Combs.Count - NumRoundsVisible) - RoundsTableOffset += Offset; - else if (Offset > 0 && RoundsTableOffset + Offset > GameState.Combs.Count - NumRoundsVisible) - RoundsTableOffset = GameState.Combs.Count - NumRoundsVisible; + if (_GameState.Combs.Count <= _NumRoundsVisible) + _RoundsTableOffset = 0; + else if (offset < 0 && _RoundsTableOffset + offset >= 0) + _RoundsTableOffset += offset; + else if (offset < 0 && _RoundsTableOffset + offset < 0) + _RoundsTableOffset = 0; + else if (offset > 0 && _RoundsTableOffset + offset <= _GameState.Combs.Count - _NumRoundsVisible) + _RoundsTableOffset += offset; + else if (offset > 0 && _RoundsTableOffset + offset > _GameState.Combs.Count - _NumRoundsVisible) + _RoundsTableOffset = _GameState.Combs.Count - _NumRoundsVisible; - UpdateRoundsTable(); + _UpdateRoundsTable(); } - private string GetPlayerWinString() + private string _GetPlayerWinString() { string s = ""; SProfile[] profiles = CBase.Profiles.GetProfiles(); - for (int i = 0; i < GameState.ResultTable.Count; i++) + for (int i = 0; i < _GameState.ResultTable.Count; i++) { - if (GameState.ResultTable[i].Position == 1) + if (_GameState.ResultTable[i].Position == 1) { if (i > 0) s += ", "; - s += profiles[GameState.ResultTable[i].PlayerID].PlayerName; + s += profiles[_GameState.ResultTable[i].PlayerID].PlayerName; } else break; diff --git a/PartyModes/PartyModeChallenge/PartyScreenChallengeNames.cs b/PartyModes/PartyModeChallenge/PartyScreenChallengeNames.cs index e8cb01ee..573f5430 100644 --- a/PartyModes/PartyModeChallenge/PartyScreenChallengeNames.cs +++ b/PartyModes/PartyModeChallenge/PartyScreenChallengeNames.cs @@ -5,7 +5,7 @@ using VocaluxeLib.Menu; namespace VocaluxeLib.PartyModes.Challenge { - public class PartyScreenChallengeNames : CMenuParty + public class CPartyScreenChallengeNames : CMenuParty { // Version number for theme files. Increment it, if you've changed something on the theme files! protected override int _ScreenVersion @@ -13,40 +13,40 @@ namespace VocaluxeLib.PartyModes.Challenge get { return 1; } } - private const string ButtonNext = "ButtonNext"; - private const string ButtonBack = "ButtonBack"; - private const string ButtonPlayerDestination = "ButtonPlayerDestination"; - private const string ButtonPlayerChoose = "ButtonPlayerChoose"; + private const string _ButtonNext = "ButtonNext"; + private const string _ButtonBack = "ButtonBack"; + private const string _ButtonPlayerDestination = "ButtonPlayerDestination"; + private const string _ButtonPlayerChoose = "ButtonPlayerChoose"; - private List PlayerChooseButtons; - private List PlayerDestinationButtons; + private List _PlayerChooseButtons; + private List _PlayerDestinationButtons; //PlayerDestinationButtons-Option - private const int PlayerDestinationButtonsNumH = 3; - private const int PlayerDestinationButtonsNumW = 4; - private const int PlayerDestinationButtonsFirstX = 900; - private const int PlayerDestinationButtonsFirstY = 105; - private const int PlayerDestinationButtonsSpaceH = 15; - private const int PlayerDestinationButtonsSpaceW = 25; + private const int _PlayerDestinationButtonsNumH = 3; + private const int _PlayerDestinationButtonsNumW = 4; + private const int _PlayerDestinationButtonsFirstX = 900; + private const int _PlayerDestinationButtonsFirstY = 105; + private const int _PlayerDestinationButtonsSpaceH = 15; + private const int _PlayerDestinationButtonsSpaceW = 25; //PlayerChooseButtons-Option - private List PlayerChooseButtonsVisibleProfiles; - private const int PlayerChooseButtonsNumH = 7; - private const int PlayerChooseButtonsNumW = 4; - private const int PlayerChooseButtonsFirstX = 52; - private const int PlayerChooseButtonsFirstY = 105; - private const int PlayerChooseButtonsSpaceH = 15; - private const int PlayerChooseButtonsSpaceW = 25; - private int PlayerChooseButtonsOffset = 0; + private List _PlayerChooseButtonsVisibleProfiles; + private const int _PlayerChooseButtonsNumH = 7; + private const int _PlayerChooseButtonsNumW = 4; + private const int _PlayerChooseButtonsFirstX = 52; + private const int _PlayerChooseButtonsFirstY = 105; + private const int _PlayerChooseButtonsSpaceH = 15; + private const int _PlayerChooseButtonsSpaceW = 25; + private int _PlayerChooseButtonsOffset = 0; - private CStatic chooseAvatarStatic; - private bool SelectingMouseActive; - private int OldMouseX; - private int OldMouseY; - private int SelectedPlayerNr = -1; - private bool ButtonsAdded; + private CStatic _ChooseAvatarStatic; + private bool _SelectingMouseActive; + private int _OldMouseX; + private int _OldMouseY; + private int _SelectedPlayerNr = -1; + private bool _ButtonsAdded; - private int NumPlayer = 4; + private int _NumPlayer = 4; - private DataFromScreen Data; + private SDataFromScreen _Data; private class CPlayerChooseButton { @@ -58,39 +58,39 @@ namespace VocaluxeLib.PartyModes.Challenge { base.Init(); - chooseAvatarStatic = GetNewStatic(); - chooseAvatarStatic.Visible = false; + _ChooseAvatarStatic = GetNewStatic(); + _ChooseAvatarStatic.Visible = false; - PlayerChooseButtonsVisibleProfiles = new List(); + _PlayerChooseButtonsVisibleProfiles = new List(); - Data.ScreenNames.ProfileIDs = new List(); + _Data.ScreenNames.ProfileIDs = new List(); List buttons = new List(); - _ThemeButtons = new string[] {ButtonBack, ButtonNext, ButtonPlayerDestination, ButtonPlayerChoose}; + _ThemeButtons = new string[] {_ButtonBack, _ButtonNext, _ButtonPlayerDestination, _ButtonPlayerChoose}; - Data = new DataFromScreen(); - FromScreenNames names = new FromScreenNames(); + _Data = new SDataFromScreen(); + SFromScreenNames names = new SFromScreenNames(); names.FadeToConfig = false; names.FadeToMain = false; names.ProfileIDs = new List(); - Data.ScreenNames = names; + _Data.ScreenNames = names; } - public override void DataToScreen(object ReceivedData) + public override void DataToScreen(object receivedData) { - DataToScreenNames config = new DataToScreenNames(); + SDataToScreenNames config = new SDataToScreenNames(); try { - config = (DataToScreenNames)ReceivedData; - Data.ScreenNames.ProfileIDs = config.ProfileIDs; - if (Data.ScreenNames.ProfileIDs == null) - Data.ScreenNames.ProfileIDs = new List(); + config = (SDataToScreenNames)receivedData; + _Data.ScreenNames.ProfileIDs = config.ProfileIDs; + if (_Data.ScreenNames.ProfileIDs == null) + _Data.ScreenNames.ProfileIDs = new List(); - NumPlayer = config.NumPlayer; + _NumPlayer = config.NumPlayer; - while (Data.ScreenNames.ProfileIDs.Count > NumPlayer) - Data.ScreenNames.ProfileIDs.RemoveAt(Data.ScreenNames.ProfileIDs.Count - 1); + while (_Data.ScreenNames.ProfileIDs.Count > _NumPlayer) + _Data.ScreenNames.ProfileIDs.RemoveAt(_Data.ScreenNames.ProfileIDs.Count - 1); } catch (Exception e) { @@ -98,7 +98,7 @@ namespace VocaluxeLib.PartyModes.Challenge } } - public override bool HandleInput(KeyEvent keyEvent) + public override bool HandleInput(SKeyEvent keyEvent) { base.HandleInput(keyEvent); @@ -109,29 +109,29 @@ namespace VocaluxeLib.PartyModes.Challenge { case Keys.Back: case Keys.Escape: - Back(); + _Back(); break; case Keys.Enter: - if (Buttons[ButtonBack].Selected) - Back(); + if (Buttons[_ButtonBack].Selected) + _Back(); - if (Buttons[ButtonNext].Selected) - Next(); + if (Buttons[_ButtonNext].Selected) + _Next(); - if (!OnAdd()) - OnRemove(); + if (!_OnAdd()) + _OnRemove(); break; case Keys.Delete: - OnRemove(); + _OnRemove(); break; } } return true; } - public override bool HandleMouse(MouseEvent mouseEvent) + public override bool HandleMouse(SMouseEvent mouseEvent) { base.HandleMouse(mouseEvent); @@ -164,74 +164,74 @@ namespace VocaluxeLib.PartyModes.Challenge }*/ //Check if LeftButton is hold and Select-Mode active - if (mouseEvent.LBH && SelectingMouseActive) + if (mouseEvent.LBH && _SelectingMouseActive) { //Update coords for Drag/Drop-Texture - chooseAvatarStatic.Rect.X += mouseEvent.X - OldMouseX; - chooseAvatarStatic.Rect.Y += mouseEvent.Y - OldMouseY; - OldMouseX = mouseEvent.X; - OldMouseY = mouseEvent.Y; + _ChooseAvatarStatic.Rect.X += mouseEvent.X - _OldMouseX; + _ChooseAvatarStatic.Rect.Y += mouseEvent.Y - _OldMouseY; + _OldMouseX = mouseEvent.X; + _OldMouseY = mouseEvent.Y; } // LeftButton isn't hold anymore, but Selec-Mode is still active -> "Drop" of Avatar - else if (SelectingMouseActive) + else if (_SelectingMouseActive) { //Check if really a player was selected - if (SelectedPlayerNr != -1) + if (_SelectedPlayerNr != -1) { //Foreach Drop-Area - for (int i = 0; i < PlayerDestinationButtons.Count; i++) + for (int i = 0; i < _PlayerDestinationButtons.Count; i++) { //Check first, if area is "active" - if (PlayerDestinationButtons[i].Visible) + if (_PlayerDestinationButtons[i].Visible) { //Check if Mouse is in area - if (CHelper.IsInBounds(PlayerDestinationButtons[i].Rect, mouseEvent)) + if (CHelper.IsInBounds(_PlayerDestinationButtons[i].Rect, mouseEvent)) { int added = -1; //Add Player-ID to list. - if (Data.ScreenNames.ProfileIDs.Count < (i + 1)) + if (_Data.ScreenNames.ProfileIDs.Count < (i + 1)) { - Data.ScreenNames.ProfileIDs.Add(SelectedPlayerNr); - added = Data.ScreenNames.ProfileIDs.Count - 1; + _Data.ScreenNames.ProfileIDs.Add(_SelectedPlayerNr); + added = _Data.ScreenNames.ProfileIDs.Count - 1; } - else if (Data.ScreenNames.ProfileIDs.Count >= (i + 1)) + else if (_Data.ScreenNames.ProfileIDs.Count >= (i + 1)) { - Data.ScreenNames.ProfileIDs[i] = SelectedPlayerNr; + _Data.ScreenNames.ProfileIDs[i] = _SelectedPlayerNr; added = i; } - UpdateButtonNext(); + _UpdateButtonNext(); //Update texture and name - PlayerDestinationButtons[added].Color = new SColorF(1, 1, 1, 0.6f); - PlayerDestinationButtons[added].SelColor = new SColorF(1, 1, 1, 1); - PlayerDestinationButtons[added].Texture = chooseAvatarStatic.Texture; - PlayerDestinationButtons[added].SelTexture = chooseAvatarStatic.Texture; - PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetProfiles()[SelectedPlayerNr].PlayerName; + _PlayerDestinationButtons[added].Color = new SColorF(1, 1, 1, 0.6f); + _PlayerDestinationButtons[added].SelColor = new SColorF(1, 1, 1, 1); + _PlayerDestinationButtons[added].Texture = _ChooseAvatarStatic.Texture; + _PlayerDestinationButtons[added].SelTexture = _ChooseAvatarStatic.Texture; + _PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetProfiles()[_SelectedPlayerNr].PlayerName; //Update Tiles-List - UpdateButtonPlayerChoose(); + _UpdateButtonPlayerChoose(); } } } - SelectedPlayerNr = -1; + _SelectedPlayerNr = -1; } //Reset variables - SelectingMouseActive = false; - chooseAvatarStatic.Visible = false; + _SelectingMouseActive = false; + _ChooseAvatarStatic.Visible = false; } if (mouseEvent.LB && IsMouseOver(mouseEvent)) { - if (Buttons[ButtonBack].Selected) - Back(); + if (Buttons[_ButtonBack].Selected) + _Back(); - if (Buttons[ButtonNext].Selected) - Next(); + if (Buttons[_ButtonNext].Selected) + _Next(); - if (!OnAdd()) - OnRemove(); + if (!_OnAdd()) + _OnRemove(); } if (mouseEvent.RB) - Back(); + _Back(); return true; } @@ -240,17 +240,17 @@ namespace VocaluxeLib.PartyModes.Challenge { base.OnShow(); - if (!ButtonsAdded) + if (!_ButtonsAdded) { - AddButtonPlayerDestination(); - AddButtonPlayerChoose(); - ButtonsAdded = true; + _AddButtonPlayerDestination(); + _AddButtonPlayerChoose(); + _ButtonsAdded = true; } - UpdateButtonPlayerDestination(); - UpdateButtonPlayerChoose(); + _UpdateButtonPlayerDestination(); + _UpdateButtonPlayerChoose(); - UpdateButtonNext(); + _UpdateButtonNext(); } public override bool UpdateGame() @@ -261,25 +261,25 @@ namespace VocaluxeLib.PartyModes.Challenge public override bool Draw() { base.Draw(); - if (chooseAvatarStatic.Visible) - chooseAvatarStatic.Draw(); + if (_ChooseAvatarStatic.Visible) + _ChooseAvatarStatic.Draw(); return true; } - private void AddButtonPlayerDestination() + private void _AddButtonPlayerDestination() { - Buttons[ButtonPlayerDestination].Visible = false; - PlayerDestinationButtons = new List(); + Buttons[_ButtonPlayerDestination].Visible = false; + _PlayerDestinationButtons = new List(); int row = 0; int column = 0; for (int i = 1; i <= _PartyMode.GetMaxPlayer(); i++) { - CButton b = GetNewButton(Buttons[ButtonPlayerDestination]); - b.Rect.X = PlayerDestinationButtonsFirstX + column * (b.Rect.W + PlayerDestinationButtonsSpaceH); - b.Rect.Y = PlayerDestinationButtonsFirstY + row * (b.Rect.H + PlayerDestinationButtonsSpaceW); - PlayerDestinationButtons.Add(b); + CButton b = GetNewButton(Buttons[_ButtonPlayerDestination]); + b.Rect.X = _PlayerDestinationButtonsFirstX + column * (b.Rect.W + _PlayerDestinationButtonsSpaceH); + b.Rect.Y = _PlayerDestinationButtonsFirstY + row * (b.Rect.H + _PlayerDestinationButtonsSpaceW); + _PlayerDestinationButtons.Add(b); column++; - if (column >= PlayerDestinationButtonsNumH) + if (column >= _PlayerDestinationButtonsNumH) { row++; column = 0; @@ -290,23 +290,23 @@ namespace VocaluxeLib.PartyModes.Challenge } } - private void AddButtonPlayerChoose() + private void _AddButtonPlayerChoose() { - Buttons[ButtonPlayerChoose].Visible = false; - PlayerChooseButtons = new List(); + Buttons[_ButtonPlayerChoose].Visible = false; + _PlayerChooseButtons = new List(); int row = 0; int column = 0; - for (int i = 1; i <= PlayerChooseButtonsNumH * PlayerChooseButtonsNumW; i++) + for (int i = 1; i <= _PlayerChooseButtonsNumH * _PlayerChooseButtonsNumW; i++) { - CButton b = GetNewButton(Buttons[ButtonPlayerChoose]); - b.Rect.X = PlayerChooseButtonsFirstX + column * (b.Rect.W + PlayerChooseButtonsSpaceH); - b.Rect.Y = PlayerChooseButtonsFirstY + row * (b.Rect.H + PlayerChooseButtonsSpaceW); + CButton b = GetNewButton(Buttons[_ButtonPlayerChoose]); + b.Rect.X = _PlayerChooseButtonsFirstX + column * (b.Rect.W + _PlayerChooseButtonsSpaceH); + b.Rect.Y = _PlayerChooseButtonsFirstY + row * (b.Rect.H + _PlayerChooseButtonsSpaceW); CPlayerChooseButton pcb = new CPlayerChooseButton(); pcb.Button = b; pcb.ProfileID = -1; - PlayerChooseButtons.Add(pcb); + _PlayerChooseButtons.Add(pcb); column++; - if (column >= PlayerChooseButtonsNumH) + if (column >= _PlayerChooseButtonsNumH) { row++; column = 0; @@ -317,53 +317,53 @@ namespace VocaluxeLib.PartyModes.Challenge } } - private void UpdateButtonPlayerChoose() + private void _UpdateButtonPlayerChoose() { - UpdateVisibleProfiles(); - if ((PlayerChooseButtonsNumW * PlayerChooseButtonsNumH) * (PlayerChooseButtonsOffset + 1) - PlayerChooseButtonsVisibleProfiles.Count >= - (PlayerChooseButtonsNumW * PlayerChooseButtonsNumH) * PlayerChooseButtonsOffset) - UpdateButtonPlayerChoose(PlayerChooseButtonsOffset - 1); + _UpdateVisibleProfiles(); + if ((_PlayerChooseButtonsNumW * _PlayerChooseButtonsNumH) * (_PlayerChooseButtonsOffset + 1) - _PlayerChooseButtonsVisibleProfiles.Count >= + (_PlayerChooseButtonsNumW * _PlayerChooseButtonsNumH) * _PlayerChooseButtonsOffset) + _UpdateButtonPlayerChoose(_PlayerChooseButtonsOffset - 1); else - UpdateButtonPlayerChoose(PlayerChooseButtonsOffset); + _UpdateButtonPlayerChoose(_PlayerChooseButtonsOffset); } - private void UpdateButtonPlayerChoose(int Offset) + private void _UpdateButtonPlayerChoose(int offset) { - int NumButtonPlayerChoose = PlayerChooseButtonsNumW * PlayerChooseButtonsNumH; - if (Offset < 0) - Offset = 0; + int numButtonPlayerChoose = _PlayerChooseButtonsNumW * _PlayerChooseButtonsNumH; + if (offset < 0) + offset = 0; - if (NumButtonPlayerChoose * (Offset + 1) - PlayerChooseButtonsVisibleProfiles.Count <= NumButtonPlayerChoose) + if (numButtonPlayerChoose * (offset + 1) - _PlayerChooseButtonsVisibleProfiles.Count <= numButtonPlayerChoose) { - for (int i = 0; i < NumButtonPlayerChoose; i++) + for (int i = 0; i < numButtonPlayerChoose; i++) { - if ((i + Offset * NumButtonPlayerChoose) < PlayerChooseButtonsVisibleProfiles.Count) + if ((i + offset * numButtonPlayerChoose) < _PlayerChooseButtonsVisibleProfiles.Count) { - PlayerChooseButtons[i].ProfileID = PlayerChooseButtonsVisibleProfiles[i + Offset * NumButtonPlayerChoose]; - PlayerChooseButtons[i].Button.Text.Text = CBase.Profiles.GetProfiles()[PlayerChooseButtonsVisibleProfiles[i + Offset * NumButtonPlayerChoose]].PlayerName; - PlayerChooseButtons[i].Button.Texture = CBase.Profiles.GetProfiles()[PlayerChooseButtonsVisibleProfiles[i + Offset * NumButtonPlayerChoose]].Avatar.Texture; - PlayerChooseButtons[i].Button.SelTexture = CBase.Profiles.GetProfiles()[PlayerChooseButtonsVisibleProfiles[i + Offset * NumButtonPlayerChoose]].Avatar.Texture; - PlayerChooseButtons[i].Button.Color = new SColorF(1, 1, 1, 0.6f); - PlayerChooseButtons[i].Button.SelColor = new SColorF(1, 1, 1, 1); - PlayerChooseButtons[i].Button.Enabled = true; + _PlayerChooseButtons[i].ProfileID = _PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose]; + _PlayerChooseButtons[i].Button.Text.Text = CBase.Profiles.GetProfiles()[_PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose]].PlayerName; + _PlayerChooseButtons[i].Button.Texture = CBase.Profiles.GetProfiles()[_PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose]].Avatar.Texture; + _PlayerChooseButtons[i].Button.SelTexture = CBase.Profiles.GetProfiles()[_PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose]].Avatar.Texture; + _PlayerChooseButtons[i].Button.Color = new SColorF(1, 1, 1, 0.6f); + _PlayerChooseButtons[i].Button.SelColor = new SColorF(1, 1, 1, 1); + _PlayerChooseButtons[i].Button.Enabled = true; } else { - PlayerChooseButtons[i].ProfileID = -1; - PlayerChooseButtons[i].Button.Text.Text = String.Empty; - PlayerChooseButtons[i].Button.Texture = Buttons[ButtonPlayerChoose].Texture; - PlayerChooseButtons[i].Button.SelTexture = Buttons[ButtonPlayerChoose].SelTexture; - PlayerChooseButtons[i].Button.Color = Buttons[ButtonPlayerChoose].Color; - PlayerChooseButtons[i].Button.SelColor = Buttons[ButtonPlayerChoose].SelColor; - PlayerChooseButtons[i].Button.Enabled = false; + _PlayerChooseButtons[i].ProfileID = -1; + _PlayerChooseButtons[i].Button.Text.Text = String.Empty; + _PlayerChooseButtons[i].Button.Texture = Buttons[_ButtonPlayerChoose].Texture; + _PlayerChooseButtons[i].Button.SelTexture = Buttons[_ButtonPlayerChoose].SelTexture; + _PlayerChooseButtons[i].Button.Color = Buttons[_ButtonPlayerChoose].Color; + _PlayerChooseButtons[i].Button.SelColor = Buttons[_ButtonPlayerChoose].SelColor; + _PlayerChooseButtons[i].Button.Enabled = false; } } } } - private void UpdateVisibleProfiles() + private void _UpdateVisibleProfiles() { - PlayerChooseButtonsVisibleProfiles.Clear(); + _PlayerChooseButtonsVisibleProfiles.Clear(); for (int i = 0; i < CBase.Profiles.GetProfiles().Length; i++) { bool visible = false; @@ -372,10 +372,10 @@ namespace VocaluxeLib.PartyModes.Challenge { visible = true; - for (int p = 0; p < Data.ScreenNames.ProfileIDs.Count; p++) + for (int p = 0; p < _Data.ScreenNames.ProfileIDs.Count; p++) { //Don't show profile if is selected - if (Data.ScreenNames.ProfileIDs[p] == i) + if (_Data.ScreenNames.ProfileIDs[p] == i) { visible = false; break; @@ -383,82 +383,82 @@ namespace VocaluxeLib.PartyModes.Challenge } } if (visible) - PlayerChooseButtonsVisibleProfiles.Add(i); + _PlayerChooseButtonsVisibleProfiles.Add(i); } } - private void UpdateButtonPlayerDestination() + private void _UpdateButtonPlayerDestination() { - for (int i = 0; i < PlayerDestinationButtons.Count; i++) + for (int i = 0; i < _PlayerDestinationButtons.Count; i++) { - if (NumPlayer > i) + if (_NumPlayer > i) { - PlayerDestinationButtons[i].Visible = true; - PlayerDestinationButtons[i].Enabled = true; + _PlayerDestinationButtons[i].Visible = true; + _PlayerDestinationButtons[i].Enabled = true; } else { - PlayerDestinationButtons[i].Visible = false; - PlayerDestinationButtons[i].Enabled = false; + _PlayerDestinationButtons[i].Visible = false; + _PlayerDestinationButtons[i].Enabled = false; } } - for (int i = 0; i < NumPlayer; i++) + for (int i = 0; i < _NumPlayer; i++) { - if (i < Data.ScreenNames.ProfileIDs.Count) + if (i < _Data.ScreenNames.ProfileIDs.Count) { - if (Data.ScreenNames.ProfileIDs[i] != -1) + if (_Data.ScreenNames.ProfileIDs[i] != -1) { - PlayerDestinationButtons[i].Color = new SColorF(1, 1, 1, 0.6f); - PlayerDestinationButtons[i].SelColor = new SColorF(1, 1, 1, 1); - PlayerDestinationButtons[i].Texture = CBase.Profiles.GetProfiles()[Data.ScreenNames.ProfileIDs[i]].Avatar.Texture; - PlayerDestinationButtons[i].SelTexture = CBase.Profiles.GetProfiles()[Data.ScreenNames.ProfileIDs[i]].Avatar.Texture; - PlayerDestinationButtons[i].Text.Text = CBase.Profiles.GetProfiles()[Data.ScreenNames.ProfileIDs[i]].PlayerName; - PlayerDestinationButtons[i].Enabled = true; + _PlayerDestinationButtons[i].Color = new SColorF(1, 1, 1, 0.6f); + _PlayerDestinationButtons[i].SelColor = new SColorF(1, 1, 1, 1); + _PlayerDestinationButtons[i].Texture = CBase.Profiles.GetProfiles()[_Data.ScreenNames.ProfileIDs[i]].Avatar.Texture; + _PlayerDestinationButtons[i].SelTexture = CBase.Profiles.GetProfiles()[_Data.ScreenNames.ProfileIDs[i]].Avatar.Texture; + _PlayerDestinationButtons[i].Text.Text = CBase.Profiles.GetProfiles()[_Data.ScreenNames.ProfileIDs[i]].PlayerName; + _PlayerDestinationButtons[i].Enabled = true; } } else { - PlayerDestinationButtons[i].Color = Buttons[ButtonPlayerDestination].Color; - PlayerDestinationButtons[i].SelColor = Buttons[ButtonPlayerDestination].SelColor; - PlayerDestinationButtons[i].Texture = Buttons[ButtonPlayerDestination].Texture; - PlayerDestinationButtons[i].SelTexture = Buttons[ButtonPlayerDestination].SelTexture; - PlayerDestinationButtons[i].Text.Text = String.Empty; - PlayerDestinationButtons[i].Enabled = false; + _PlayerDestinationButtons[i].Color = Buttons[_ButtonPlayerDestination].Color; + _PlayerDestinationButtons[i].SelColor = Buttons[_ButtonPlayerDestination].SelColor; + _PlayerDestinationButtons[i].Texture = Buttons[_ButtonPlayerDestination].Texture; + _PlayerDestinationButtons[i].SelTexture = Buttons[_ButtonPlayerDestination].SelTexture; + _PlayerDestinationButtons[i].Text.Text = String.Empty; + _PlayerDestinationButtons[i].Enabled = false; } } } - private void UpdateButtonNext() + private void _UpdateButtonNext() { - if (Data.ScreenNames.ProfileIDs.Count == NumPlayer) + if (_Data.ScreenNames.ProfileIDs.Count == _NumPlayer) { - Buttons[ButtonNext].Visible = true; - SetInteractionToButton(Buttons[ButtonNext]); + Buttons[_ButtonNext].Visible = true; + SetInteractionToButton(Buttons[_ButtonNext]); } else - Buttons[ButtonNext].Visible = false; + Buttons[_ButtonNext].Visible = false; } - private bool OnAdd() + private bool _OnAdd() { - for (int i = 0; i < PlayerChooseButtons.Count; i++) + for (int i = 0; i < _PlayerChooseButtons.Count; i++) { - if (PlayerChooseButtons[i].Button.Selected && PlayerChooseButtons[i].ProfileID != -1) + if (_PlayerChooseButtons[i].Button.Selected && _PlayerChooseButtons[i].ProfileID != -1) { - if (Data.ScreenNames.ProfileIDs.Count < NumPlayer) + if (_Data.ScreenNames.ProfileIDs.Count < _NumPlayer) { - Data.ScreenNames.ProfileIDs.Add(PlayerChooseButtons[i].ProfileID); - int added = Data.ScreenNames.ProfileIDs.Count - 1; - UpdateButtonNext(); + _Data.ScreenNames.ProfileIDs.Add(_PlayerChooseButtons[i].ProfileID); + int added = _Data.ScreenNames.ProfileIDs.Count - 1; + _UpdateButtonNext(); //Update texture and name - PlayerDestinationButtons[added].Color = new SColorF(1, 1, 1, 0.6f); - PlayerDestinationButtons[added].SelColor = new SColorF(1, 1, 1, 1); - PlayerDestinationButtons[added].Texture = CBase.Profiles.GetProfiles()[PlayerChooseButtons[i].ProfileID].Avatar.Texture; - PlayerDestinationButtons[added].SelTexture = CBase.Profiles.GetProfiles()[PlayerChooseButtons[i].ProfileID].Avatar.Texture; - PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetProfiles()[PlayerChooseButtons[i].ProfileID].PlayerName; - PlayerDestinationButtons[added].Enabled = true; + _PlayerDestinationButtons[added].Color = new SColorF(1, 1, 1, 0.6f); + _PlayerDestinationButtons[added].SelColor = new SColorF(1, 1, 1, 1); + _PlayerDestinationButtons[added].Texture = CBase.Profiles.GetProfiles()[_PlayerChooseButtons[i].ProfileID].Avatar.Texture; + _PlayerDestinationButtons[added].SelTexture = CBase.Profiles.GetProfiles()[_PlayerChooseButtons[i].ProfileID].Avatar.Texture; + _PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetProfiles()[_PlayerChooseButtons[i].ProfileID].PlayerName; + _PlayerDestinationButtons[added].Enabled = true; //Update Tiles-List - UpdateButtonPlayerChoose(); + _UpdateButtonPlayerChoose(); CheckInteraction(); return true; } @@ -467,18 +467,18 @@ namespace VocaluxeLib.PartyModes.Challenge return false; } - private bool OnRemove() + private bool _OnRemove() { - for (int i = 0; i < PlayerDestinationButtons.Count; i++) + for (int i = 0; i < _PlayerDestinationButtons.Count; i++) { - if (PlayerDestinationButtons[i].Selected) + if (_PlayerDestinationButtons[i].Selected) { - if ((i + 1) <= Data.ScreenNames.ProfileIDs.Count) + if ((i + 1) <= _Data.ScreenNames.ProfileIDs.Count) { - Data.ScreenNames.ProfileIDs.RemoveAt(i); - UpdateButtonNext(); - UpdateButtonPlayerDestination(); - UpdateButtonPlayerChoose(); + _Data.ScreenNames.ProfileIDs.RemoveAt(i); + _UpdateButtonNext(); + _UpdateButtonPlayerDestination(); + _UpdateButtonPlayerChoose(); CheckInteraction(); return true; } @@ -487,18 +487,18 @@ namespace VocaluxeLib.PartyModes.Challenge return false; } - private void Back() + private void _Back() { - Data.ScreenNames.FadeToConfig = true; - Data.ScreenNames.FadeToMain = false; - _PartyMode.DataFromScreen(ThemeName, Data); + _Data.ScreenNames.FadeToConfig = true; + _Data.ScreenNames.FadeToMain = false; + _PartyMode.DataFromScreen(ThemeName, _Data); } - private void Next() + private void _Next() { - Data.ScreenNames.FadeToConfig = false; - Data.ScreenNames.FadeToMain = true; - _PartyMode.DataFromScreen(ThemeName, Data); + _Data.ScreenNames.FadeToConfig = false; + _Data.ScreenNames.FadeToMain = true; + _PartyMode.DataFromScreen(ThemeName, _Data); } } } \ No newline at end of file diff --git a/PartyModes/PartyModeChallengeMedley/ChallengeRounds.cs b/PartyModes/PartyModeChallengeMedley/ChallengeRounds.cs index eef9c250..37ff59f5 100644 --- a/PartyModes/PartyModeChallengeMedley/ChallengeRounds.cs +++ b/PartyModes/PartyModeChallengeMedley/ChallengeRounds.cs @@ -3,58 +3,58 @@ using System.Collections.Generic; namespace VocaluxeLib.PartyModes.ChallengeMedley { - public class ChallengeRounds + public class CChallengeRounds { private readonly Random _Rand; private readonly int _NumPlayer; - public List Rounds; + public List Rounds; - public ChallengeRounds(int NumRounds, int NumPlayer, int NumPlayerAtOnce) + public CChallengeRounds(int numRounds, int numPlayer, int numPlayerAtOnce) { - Rounds = new List(); + Rounds = new List(); _Rand = new Random(DateTime.Now.Millisecond); - if (NumPlayerAtOnce < 1 || NumRounds < 1 || NumPlayer == 0) + if (numPlayerAtOnce < 1 || numRounds < 1 || numPlayer == 0) _NumPlayer = 0; else { - _NumPlayer = NumPlayer; - BuildRounds(NumRounds, NumPlayerAtOnce, _Rand); + _NumPlayer = numPlayer; + _BuildRounds(numRounds, numPlayerAtOnce, _Rand); } } - public Combination GetRound(int RoundNr) + public CCombination GetRound(int roundNr) { - if (RoundNr >= Rounds.Count || _NumPlayer == 0 || Rounds.Count == 0) + if (roundNr >= Rounds.Count || _NumPlayer == 0 || Rounds.Count == 0) return null; - return Rounds[RoundNr]; + return Rounds[roundNr]; } - private void BuildRounds(int NumRounds, int NumPlayerAtOnce, Random Rand) + private void _BuildRounds(int numRounds, int numPlayerAtOnce, Random rand) { - Combinations Combinations = new Combinations(_NumPlayer, NumPlayerAtOnce, Rand); - Rounds.Add(Combinations.GetNextCombination(null)); + CCombinations combinations = new CCombinations(_NumPlayer, numPlayerAtOnce, rand); + Rounds.Add(combinations.GetNextCombination(null)); - for (int i = 1; i < NumRounds; i++) - Rounds.Add(Combinations.GetNextCombination(GetPlayerDemand(i))); + for (int i = 1; i < numRounds; i++) + Rounds.Add(combinations.GetNextCombination(_GetPlayerDemand(i))); } - private List GetPlayerDemand(int RoundIndex) + private List _GetPlayerDemand(int roundIndex) { - List NumPlayed = new List(_NumPlayer); + List numPlayed = new List(_NumPlayer); for (int i = 0; i < _NumPlayer; i++) - NumPlayed.Add(0); + numPlayed.Add(0); - for (int i = 0; i < RoundIndex; i++) + for (int i = 0; i < roundIndex; i++) { - foreach (int PlayerIndex in Rounds[i].Player) - NumPlayed[PlayerIndex]++; + foreach (int playerIndex in Rounds[i].Player) + numPlayed[playerIndex]++; } int max = 0; - foreach (int p in NumPlayed) + foreach (int p in numPlayed) { if (p > max) max = p; @@ -65,20 +65,20 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley List other = new List(); List last = new List(); - for (int i = 0; i < NumPlayed.Count; i++) + for (int i = 0; i < numPlayed.Count; i++) { - if (RoundIndex == 0 || NumPlayed[i] < max) + if (roundIndex == 0 || numPlayed[i] < max) { - if (RoundIndex == 0 || RoundIndex > 0 && NumPlayed[i] < max && !Rounds[RoundIndex - 1].IsAvailable(i)) + if (roundIndex == 0 || roundIndex > 0 && numPlayed[i] < max && !Rounds[roundIndex - 1].IsAvailable(i)) result.Add(i); - else if (NumPlayed[i] < max) + else if (numPlayed[i] < max) other.Add(i); } else { - if (RoundIndex > 0) + if (roundIndex > 0) { - if (!Rounds[RoundIndex - 1].IsAvailable(i)) + if (!Rounds[roundIndex - 1].IsAvailable(i)) other.Add(i); else last.Add(i); @@ -116,48 +116,48 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley } } - class Combinations + class CCombinations { - private readonly List _Combs; + private readonly List _Combs; private readonly Random _Rand; private readonly int _NumPlayer; private readonly int _NumMics; - public Combinations(int NumPlayer, int NumMics, Random Rand) + public CCombinations(int numPlayer, int numMics, Random rand) { - _Combs = new List(); - _NumMics = NumMics; - _NumPlayer = NumPlayer; - _Rand = Rand; + _Combs = new List(); + _NumMics = numMics; + _NumPlayer = numPlayer; + _Rand = rand; } - public Combination GetNextCombination(List PlayerNrDemand) + public CCombination GetNextCombination(List playerNrDemand) { if (_Combs.Count == 0) - Create(); + _Create(); - Combination combs = new Combination(); + CCombination combs = new CCombination(); if (_NumPlayer == _NumMics) return _Combs[0]; //filter against PlayerNrDemand - List combsFiltered = new List(); - if (PlayerNrDemand != null) + List combsFiltered = new List(); + if (playerNrDemand != null) { for (int i = 0; i < _Combs.Count; i++) { - if (_Combs[i].IsAvailableAll(PlayerNrDemand)) + if (_Combs[i].IsAvailableAll(playerNrDemand)) combsFiltered.Add(_Combs[i]); } } //1st fallback - if (PlayerNrDemand != null && combsFiltered.Count == 0) + if (playerNrDemand != null && combsFiltered.Count == 0) { for (int i = 0; i < _Combs.Count; i++) { - if (_Combs[i].IsAvailableSomeone(PlayerNrDemand)) + if (_Combs[i].IsAvailableSomeone(playerNrDemand)) combsFiltered.Add(_Combs[i]); } } @@ -171,7 +171,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley int num = combsFiltered.Count; int rand = _Rand.Next(num); - Combination c = new Combination(); + CCombination c = new CCombination(); for (int i = 0; i < combsFiltered[rand].Player.Count; i++) c.Player.Add(combsFiltered[rand].Player[i]); _Combs.Remove(combsFiltered[rand]); @@ -179,7 +179,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley return combsFiltered[rand]; } - private void Create() + private void _Create() { _Combs.Clear(); @@ -187,7 +187,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley for (int i = 1; i <= num; i++) { - Combination c = new Combination(); + CCombination c = new CCombination(); for (int j = 0; j < _NumPlayer; j++) { @@ -201,37 +201,37 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley } } - public class Combination + public class CCombination { public List Player; - public Combination() + public CCombination() { Player = new List(); } - public bool IsAvailable(int PlayerIndex) + public bool IsAvailable(int playerIndex) { foreach (int p in Player) { - if (p == PlayerIndex) + if (p == playerIndex) return true; } return false; } - public bool IsAvailableAll(List PlayerIndices) + public bool IsAvailableAll(List playerIndices) { bool result = true; - foreach (int p in PlayerIndices) + foreach (int p in playerIndices) result &= IsAvailable(p); return result; } - public bool IsAvailableSomeone(List PlayerIndices) + public bool IsAvailableSomeone(List playerIndices) { bool result = false; - foreach (int p in PlayerIndices) + foreach (int p in playerIndices) result |= IsAvailable(p); return result; } diff --git a/PartyModes/PartyModeChallengeMedley/PartyModeChallengeMedley.cs b/PartyModes/PartyModeChallengeMedley/PartyModeChallengeMedley.cs index fd6154e0..9698e1bf 100644 --- a/PartyModes/PartyModeChallengeMedley/PartyModeChallengeMedley.cs +++ b/PartyModes/PartyModeChallengeMedley/PartyModeChallengeMedley.cs @@ -12,30 +12,30 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley #region Communication #region ToScreen - public struct DataToScreenConfig + public struct SDataToScreenConfig { public int NumPlayer; public int NumPlayerAtOnce; public int NumRounds; } - public struct DataToScreenNames + public struct SDataToScreenNames { public int NumPlayer; public List ProfileIDs; } - public struct DataToScreenMain + public struct SDataToScreenMain { public int CurrentRoundNr; public int NumPlayerAtOnce; - public List Combs; + public List Combs; public int[,] Results; - public List ResultTable; + public List ResultTable; public List ProfileIDs; } - public class ResultTableRow : IComparable + public class CResultTableRow : IComparable { public int Position; public int PlayerID; @@ -47,9 +47,9 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley public int CompareTo(object obj) { - if (obj is ResultTableRow) + if (obj is CResultTableRow) { - ResultTableRow row = (ResultTableRow)obj; + CResultTableRow row = (CResultTableRow)obj; int res = row.NumGamePoints.CompareTo(NumGamePoints); if (res == 0) @@ -67,28 +67,28 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley #endregion ToScreen #region FromScreen - public struct DataFromScreen + public struct SDataFromScreen { - public FromScreenConfig ScreenConfig; - public FromScreenNames ScreenNames; - public FromScreenMain ScreenMain; + public SFromScreenConfig ScreenConfig; + public SFromScreenNames ScreenNames; + public SFromScreenMain ScreenMain; } - public struct FromScreenConfig + public struct SFromScreenConfig { public int NumPlayer; public int NumPlayerAtOnce; public int NumRounds; } - public struct FromScreenNames + public struct SFromScreenNames { public bool FadeToConfig; public bool FadeToMain; public List ProfileIDs; } - public struct FromScreenMain + public struct SFromScreenMain { public bool FadeToSongSelection; public bool FadeToNameSelection; @@ -97,14 +97,14 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley #endregion Communication - public sealed class PartyModeChallengeMedley : CPartyMode + public sealed class CPartyModeChallengeMedley : CPartyMode { - private const int MaxPlayer = 12; - private const int MinPlayer = 1; - private const int MaxTeams = 0; - private const int MinTeams = 0; - private const int MaxNumRounds = 100; - private const int NumSongs = 5; + private const int _MaxPlayer = 12; + private const int _MinPlayer = 1; + private const int _MaxTeams = 0; + private const int _MinTeams = 0; + private const int _MaxNumRounds = 100; + private const int _NumSongs = 5; private enum EStage { @@ -115,15 +115,15 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley Singing } - private struct Data + private struct SData { public int NumPlayer; public int NumPlayerAtOnce; public int NumRounds; public List ProfileIDs; - public ChallengeRounds Rounds; - public List ResultTable; + public CChallengeRounds Rounds; + public List ResultTable; public int[,] Results; public int CurrentRoundNr; @@ -131,7 +131,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley public int[] CatSongIndices; } - private struct Stats + private struct SStats { public int ProfileID; public int SingPoints; @@ -139,14 +139,14 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley public int Won; } - private DataToScreenConfig ToScreenConfig; - private DataToScreenNames ToScreenNames; - private DataToScreenMain ToScreenMain; + private SDataToScreenConfig _ToScreenConfig; + private SDataToScreenNames _ToScreenNames; + private SDataToScreenMain _ToScreenMain; - private Data GameData; + private SData _GameData; private EStage _Stage; - public PartyModeChallengeMedley() + public CPartyModeChallengeMedley() { _ScreenSongOptions.Selection.RandomOnly = false; _ScreenSongOptions.Selection.PartyMode = true; @@ -160,18 +160,18 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley _Stage = EStage.NotStarted; - ToScreenConfig = new DataToScreenConfig(); - ToScreenNames = new DataToScreenNames(); - ToScreenMain = new DataToScreenMain(); + _ToScreenConfig = new SDataToScreenConfig(); + _ToScreenNames = new SDataToScreenNames(); + _ToScreenMain = new SDataToScreenMain(); - GameData = new Data(); - GameData.NumPlayer = 4; - GameData.NumPlayerAtOnce = 2; - GameData.NumRounds = 2; - GameData.CurrentRoundNr = 1; - GameData.ProfileIDs = new List(); - GameData.CatSongIndices = null; - GameData.Results = null; + _GameData = new SData(); + _GameData.NumPlayer = 4; + _GameData.NumPlayerAtOnce = 2; + _GameData.NumRounds = 2; + _GameData.CurrentRoundNr = 1; + _GameData.ProfileIDs = new List(); + _GameData.CatSongIndices = null; + _GameData.Results = null; } public override bool Init() @@ -186,8 +186,8 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley 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(); - GameData.ResultTable = new List(); + _ToScreenMain.ResultTable = new List(); + _GameData.ResultTable = new List(); CBase.Songs.SortSongs(ESongSorting.TR_CONFIG_NONE, EOffOn.TR_CONFIG_OFF, EOffOn.TR_CONFIG_OFF, String.Empty, EDuetOptions.NoDuets); CBase.Songs.SetCategory(0); @@ -195,38 +195,38 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley return true; } - public override void DataFromScreen(string ScreenName, Object Data) + public override void DataFromScreen(string screenName, Object data) { - DataFromScreen dataFrom = new DataFromScreen(); - switch (ScreenName) + SDataFromScreen dataFrom = new SDataFromScreen(); + switch (screenName) { case "PartyScreenChallengeMedleyConfig": try { - dataFrom = (DataFromScreen)Data; - GameData.NumPlayer = dataFrom.ScreenConfig.NumPlayer; - GameData.NumPlayerAtOnce = dataFrom.ScreenConfig.NumPlayerAtOnce; - GameData.NumRounds = dataFrom.ScreenConfig.NumRounds; + dataFrom = (SDataFromScreen)data; + _GameData.NumPlayer = dataFrom.ScreenConfig.NumPlayer; + _GameData.NumPlayerAtOnce = dataFrom.ScreenConfig.NumPlayerAtOnce; + _GameData.NumRounds = dataFrom.ScreenConfig.NumRounds; _Stage = EStage.Config; CBase.Graphics.FadeTo(EScreens.ScreenPartyDummy); } catch (Exception e) { - CBase.Log.LogError("Error in party mode challenge. Can't cast received data from screen " + ScreenName + ". " + e.Message); + CBase.Log.LogError("Error in party mode challenge. Can't cast received data from screen " + screenName + ". " + e.Message); } break; case "PartyScreenChallengeMedleyNames": try { - dataFrom = (DataFromScreen)Data; + dataFrom = (SDataFromScreen)data; if (dataFrom.ScreenNames.FadeToConfig) _Stage = EStage.NotStarted; else { - GameData.ProfileIDs = dataFrom.ScreenNames.ProfileIDs; + _GameData.ProfileIDs = dataFrom.ScreenNames.ProfileIDs; _Stage = EStage.Names; } @@ -234,14 +234,14 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley } catch (Exception e) { - CBase.Log.LogError("Error in party mode challenge. Can't cast received data from screen " + ScreenName + ". " + e.Message); + CBase.Log.LogError("Error in party mode challenge. Can't cast received data from screen " + screenName + ". " + e.Message); } break; case "PartyScreenChallengeMedleyMain": try { - dataFrom = (DataFromScreen)Data; + dataFrom = (SDataFromScreen)data; if (dataFrom.ScreenMain.FadeToSongSelection) _Stage = EStage.Singing; if (dataFrom.ScreenMain.FadeToNameSelection) @@ -249,18 +249,18 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley } catch (Exception e) { - CBase.Log.LogError("Error in party mode challenge. Can't cast received data from screen " + ScreenName + ". " + e.Message); + CBase.Log.LogError("Error in party mode challenge. Can't cast received data from screen " + screenName + ". " + e.Message); } if (_Stage == EStage.Singing) - StartNextRound(); + _StartNextRound(); if (_Stage == EStage.Config) CBase.Graphics.FadeTo(EScreens.ScreenPartyDummy); break; default: - CBase.Log.LogError("Error in party mode challenge. Wrong screen is sending: " + ScreenName); + CBase.Log.LogError("Error in party mode challenge. Wrong screen is sending: " + screenName); break; } } @@ -274,68 +274,68 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley _ScreenSongOptions.Selection.RandomOnly = false;*/ } - public override CMenuParty GetNextPartyScreen(out EScreens AlternativeScreen) + public override CMenuParty GetNextPartyScreen(out EScreens alternativeScreen) { - CMenuParty Screen = null; - AlternativeScreen = EScreens.ScreenSong; + CMenuParty screen = null; + alternativeScreen = EScreens.ScreenSong; switch (_Stage) { case EStage.NotStarted: - _Screens.TryGetValue("PartyScreenChallengeMedleyConfig", out Screen); + _Screens.TryGetValue("PartyScreenChallengeMedleyConfig", out screen); if (_Screens != null) { - ToScreenConfig.NumPlayer = GameData.NumPlayer; - ToScreenConfig.NumPlayerAtOnce = GameData.NumPlayerAtOnce; - ToScreenConfig.NumRounds = GameData.NumRounds; - Screen.DataToScreen(ToScreenConfig); + _ToScreenConfig.NumPlayer = _GameData.NumPlayer; + _ToScreenConfig.NumPlayerAtOnce = _GameData.NumPlayerAtOnce; + _ToScreenConfig.NumRounds = _GameData.NumRounds; + screen.DataToScreen(_ToScreenConfig); } break; case EStage.Config: - _Screens.TryGetValue("PartyScreenChallengeMedleyNames", out Screen); + _Screens.TryGetValue("PartyScreenChallengeMedleyNames", out screen); if (_Screens != null) { - ToScreenNames.NumPlayer = GameData.NumPlayer; - ToScreenNames.ProfileIDs = GameData.ProfileIDs; - Screen.DataToScreen(ToScreenNames); + _ToScreenNames.NumPlayer = _GameData.NumPlayer; + _ToScreenNames.ProfileIDs = _GameData.ProfileIDs; + screen.DataToScreen(_ToScreenNames); } break; case EStage.Names: - _Screens.TryGetValue("PartyScreenChallengeMedleyMain", out Screen); + _Screens.TryGetValue("PartyScreenChallengeMedleyMain", out screen); if (_Screens != null) { CBase.Songs.ResetPartySongSung(); - ToScreenMain.ResultTable = new List(); - GameData.ResultTable = new List(); - GameData.Rounds = new ChallengeRounds(GameData.NumRounds, GameData.NumPlayer, GameData.NumPlayerAtOnce); - GameData.CurrentRoundNr = 1; - ToScreenMain.CurrentRoundNr = 1; - ToScreenMain.NumPlayerAtOnce = GameData.NumPlayerAtOnce; - ToScreenMain.Combs = GameData.Rounds.Rounds; - ToScreenMain.ProfileIDs = GameData.ProfileIDs; - UpdateScores(); - ToScreenMain.ResultTable = GameData.ResultTable; - ToScreenMain.Results = GameData.Results; - Screen.DataToScreen(ToScreenMain); + _ToScreenMain.ResultTable = new List(); + _GameData.ResultTable = new List(); + _GameData.Rounds = new CChallengeRounds(_GameData.NumRounds, _GameData.NumPlayer, _GameData.NumPlayerAtOnce); + _GameData.CurrentRoundNr = 1; + _ToScreenMain.CurrentRoundNr = 1; + _ToScreenMain.NumPlayerAtOnce = _GameData.NumPlayerAtOnce; + _ToScreenMain.Combs = _GameData.Rounds.Rounds; + _ToScreenMain.ProfileIDs = _GameData.ProfileIDs; + _UpdateScores(); + _ToScreenMain.ResultTable = _GameData.ResultTable; + _ToScreenMain.Results = _GameData.Results; + screen.DataToScreen(_ToScreenMain); } break; case EStage.Main: //nothing to do break; case EStage.Singing: - _Screens.TryGetValue("PartyScreenChallengeMedleyMain", out Screen); + _Screens.TryGetValue("PartyScreenChallengeMedleyMain", out screen); if (_Screens != null) { - UpdateScores(); - ToScreenMain.CurrentRoundNr = GameData.CurrentRoundNr; - ToScreenMain.Combs = GameData.Rounds.Rounds; - ToScreenMain.Results = GameData.Results; - Screen.DataToScreen(ToScreenMain); + _UpdateScores(); + _ToScreenMain.CurrentRoundNr = _GameData.CurrentRoundNr; + _ToScreenMain.Combs = _GameData.Rounds.Rounds; + _ToScreenMain.Results = _GameData.Results; + screen.DataToScreen(_ToScreenMain); } break; } - return Screen; + return screen; } public override EScreens GetStartScreen() @@ -348,7 +348,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley return EScreens.ScreenPartyDummy; } - public override ScreenSongOptions GetScreenSongOptions() + public override SScreenSongOptions GetScreenSongOptions() { _ScreenSongOptions.Sorting.SongSorting = CBase.Config.GetSongSorting(); _ScreenSongOptions.Sorting.Tabs = CBase.Config.GetTabs(); @@ -357,130 +357,130 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley return _ScreenSongOptions; } - public override void OnSongChange(int SongIndex, ref ScreenSongOptions ScreenSongOptions) + public override void OnSongChange(int songIndex, ref SScreenSongOptions screenSongOptions) { if (_ScreenSongOptions.Selection.SongIndex != -1) _ScreenSongOptions.Selection.SongIndex = -1; - if (_ScreenSongOptions.Selection.SelectNextRandomSong && SongIndex != -1) + if (_ScreenSongOptions.Selection.SelectNextRandomSong && songIndex != -1) { _ScreenSongOptions.Selection.SelectNextRandomSong = false; - CreateCatSongIndices(); + _CreateCatSongIndices(); - if (GameData.CatSongIndices != null) + if (_GameData.CatSongIndices != null) { - if (GameData.CatSongIndices[CBase.Songs.GetCurrentCategoryIndex()] == -1) - GameData.CatSongIndices[CBase.Songs.GetCurrentCategoryIndex()] = SongIndex; + if (_GameData.CatSongIndices[CBase.Songs.GetCurrentCategoryIndex()] == -1) + _GameData.CatSongIndices[CBase.Songs.GetCurrentCategoryIndex()] = songIndex; } } - ScreenSongOptions = _ScreenSongOptions; + screenSongOptions = _ScreenSongOptions; } - public override void OnCategoryChange(int CategoryIndex, ref ScreenSongOptions ScreenSongOptions) + public override void OnCategoryChange(int categoryIndex, ref SScreenSongOptions screenSongOptions) { - if (GameData.CatSongIndices != null && CategoryIndex != -1) + if (_GameData.CatSongIndices != null && categoryIndex != -1) { - if (GameData.CatSongIndices[CategoryIndex] == -1) + if (_GameData.CatSongIndices[categoryIndex] == -1) _ScreenSongOptions.Selection.SelectNextRandomSong = true; else - _ScreenSongOptions.Selection.SongIndex = GameData.CatSongIndices[CategoryIndex]; + _ScreenSongOptions.Selection.SongIndex = _GameData.CatSongIndices[categoryIndex]; } - if (GameData.CatSongIndices == null && CategoryIndex != -1) + if (_GameData.CatSongIndices == null && categoryIndex != -1) _ScreenSongOptions.Selection.SelectNextRandomSong = true; - if (CategoryIndex == -1) + if (categoryIndex == -1) _ScreenSongOptions.Selection.RandomOnly = false; - if (_ScreenSongOptions.Sorting.Tabs == EOffOn.TR_CONFIG_OFF || CategoryIndex != -1) + if (_ScreenSongOptions.Sorting.Tabs == EOffOn.TR_CONFIG_OFF || categoryIndex != -1) _ScreenSongOptions.Selection.RandomOnly = true; - ScreenSongOptions = _ScreenSongOptions; + screenSongOptions = _ScreenSongOptions; } - public override void SetSearchString(string SearchString, bool Visible) + public override void SetSearchString(string searchString, bool visible) { - _ScreenSongOptions.Sorting.SearchString = SearchString; - _ScreenSongOptions.Sorting.SearchActive = Visible; + _ScreenSongOptions.Sorting.SearchString = searchString; + _ScreenSongOptions.Sorting.SearchActive = visible; } public override int GetMaxPlayer() { - return MaxPlayer; + return _MaxPlayer; } public override int GetMinPlayer() { - return MinPlayer; + return _MinPlayer; } public override int GetMaxTeams() { - return MaxTeams; + return _MaxTeams; } public override int GetMinTeams() { - return MinTeams; + return _MinTeams; } public override int GetMaxNumRounds() { - return MaxNumRounds; + return _MaxNumRounds; } - public override void JokerUsed(int TeamNr) + public override void JokerUsed(int teamNr) { if (_ScreenSongOptions.Selection.NumJokers == null) return; - if (TeamNr >= _ScreenSongOptions.Selection.NumJokers.Length) + if (teamNr >= _ScreenSongOptions.Selection.NumJokers.Length) return; - _ScreenSongOptions.Selection.NumJokers[TeamNr]--; + _ScreenSongOptions.Selection.NumJokers[teamNr]--; _ScreenSongOptions.Selection.RandomOnly = true; _ScreenSongOptions.Selection.CategoryChangeAllowed = false; } - public override void SongSelected(int SongID) {} + public override void SongSelected(int songID) {} public override void LeavingHighscore() { - GameData.CurrentRoundNr++; + _GameData.CurrentRoundNr++; CBase.Graphics.FadeTo(EScreens.ScreenPartyDummy); } - private void StartNextRound() + private void _StartNextRound() { _ScreenSongOptions.Selection.RandomOnly = _ScreenSongOptions.Sorting.Tabs != EOffOn.TR_CONFIG_ON; _ScreenSongOptions.Selection.CategoryChangeAllowed = _ScreenSongOptions.Sorting.Tabs == EOffOn.TR_CONFIG_ON; - SetNumJokers(); - SetTeamNames(); - GameData.CatSongIndices = null; + _SetNumJokers(); + _SetTeamNames(); + _GameData.CatSongIndices = null; - if (RandomizeSongs()) + if (_RandomizeSongs()) CBase.Graphics.FadeTo(EScreens.ScreenSing); } - private bool RandomizeSongs() + private bool _RandomizeSongs() { CBase.Game.Reset(); CBase.Game.ClearSongs(); #region PlayerNames - CBase.Game.SetNumPlayer(GameData.NumPlayerAtOnce); + CBase.Game.SetNumPlayer(_GameData.NumPlayerAtOnce); SPlayer[] player = CBase.Game.GetPlayer(); if (player == null) return false; - if (player.Length < GameData.NumPlayerAtOnce) + if (player.Length < _GameData.NumPlayerAtOnce) return false; SProfile[] profiles = CBase.Profiles.GetProfiles(); - Combination c = GameData.Rounds.GetRound(GameData.CurrentRoundNr - 1); + CCombination c = _GameData.Rounds.GetRound(_GameData.CurrentRoundNr - 1); - for (int i = 0; i < GameData.NumPlayerAtOnce; i++) + for (int i = 0; i < _GameData.NumPlayerAtOnce; i++) { //default values player[i].Name = "foobar"; @@ -490,41 +490,41 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley //try to fill with the right data if (c != null) { - if (GameData.ProfileIDs[c.Player[i]] < profiles.Length) + if (_GameData.ProfileIDs[c.Player[i]] < profiles.Length) { - player[i].Name = profiles[GameData.ProfileIDs[c.Player[i]]].PlayerName; - player[i].Difficulty = profiles[GameData.ProfileIDs[c.Player[i]]].Difficulty; - player[i].ProfileID = GameData.ProfileIDs[c.Player[i]]; + player[i].Name = profiles[_GameData.ProfileIDs[c.Player[i]]].PlayerName; + player[i].Difficulty = profiles[_GameData.ProfileIDs[c.Player[i]]].Difficulty; + player[i].ProfileID = _GameData.ProfileIDs[c.Player[i]]; } } } #endregion PlayerNames #region SongQueque - if (CBase.Songs.GetNumVisibleSongs() < NumSongs) + if (CBase.Songs.GetNumVisibleSongs() < _NumSongs) CBase.Songs.ResetPartySongSung(); EGameMode gm = EGameMode.TR_GAMEMODE_MEDLEY; - List IDs = new List(); + List iDs = new List(); - CSong[] VisSongs = CBase.Songs.GetSongsNotSung(); - if (VisSongs == null) + CSong[] visSongs = CBase.Songs.GetSongsNotSung(); + if (visSongs == null) { CBase.Log.LogError("PartyChallengeMedleyMode Error: There are no songs!"); CBase.Graphics.FadeTo(EScreens.ScreenParty); return false; } - for (int i = 0; i < VisSongs.Length; i++) + for (int i = 0; i < visSongs.Length; i++) { - foreach (EGameMode mode in VisSongs[i].AvailableGameModes) + foreach (EGameMode mode in visSongs[i].AvailableGameModes) { if (mode == EGameMode.TR_GAMEMODE_MEDLEY) - IDs.Add(VisSongs[i].ID); + iDs.Add(visSongs[i].ID); } } - if (IDs.Count == 0) + if (iDs.Count == 0) { CBase.Log.LogError("PartyChallengeMedleyMode Error: There are no medley songs!"); CBase.Graphics.FadeTo(EScreens.ScreenParty); @@ -532,21 +532,21 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley } int s = 0; - while (s < NumSongs && IDs.Count > 0) + while (s < _NumSongs && iDs.Count > 0) { - int SongID = IDs[CBase.Game.GetRandom(IDs.Count)]; - CBase.Game.AddSong(SongID, gm); - CBase.Songs.AddPartySongSung(SongID); - IDs.Remove(SongID); + int songID = iDs[CBase.Game.GetRandom(iDs.Count)]; + CBase.Game.AddSong(songID, gm); + CBase.Songs.AddPartySongSung(songID); + iDs.Remove(songID); s++; } return true; #endregion SongQueque } - private void SetNumJokers() + private void _SetNumJokers() { - switch (GameData.NumPlayerAtOnce) + switch (_GameData.NumPlayerAtOnce) { case 1: _ScreenSongOptions.Selection.NumJokers = new int[] {10}; @@ -577,7 +577,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley } } - private void SetTeamNames() + private void _SetTeamNames() { SProfile[] profiles = CBase.Profiles.GetProfiles(); @@ -587,21 +587,21 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley return; } - if (GameData.NumPlayerAtOnce < 1 || GameData.ProfileIDs.Count < GameData.NumPlayerAtOnce || profiles.Length < GameData.NumPlayerAtOnce) + if (_GameData.NumPlayerAtOnce < 1 || _GameData.ProfileIDs.Count < _GameData.NumPlayerAtOnce || profiles.Length < _GameData.NumPlayerAtOnce) { _ScreenSongOptions.Selection.TeamNames = new string[] {"foo", "bar"}; return; } - _ScreenSongOptions.Selection.TeamNames = new string[GameData.NumPlayerAtOnce]; - Combination c = GameData.Rounds.GetRound(GameData.CurrentRoundNr - 1); + _ScreenSongOptions.Selection.TeamNames = new string[_GameData.NumPlayerAtOnce]; + CCombination c = _GameData.Rounds.GetRound(_GameData.CurrentRoundNr - 1); - for (int i = 0; i < GameData.NumPlayerAtOnce; i++) + for (int i = 0; i < _GameData.NumPlayerAtOnce; i++) { if (c != null) { - if (GameData.ProfileIDs[c.Player[i]] < profiles.Length) - _ScreenSongOptions.Selection.TeamNames[i] = profiles[GameData.ProfileIDs[c.Player[i]]].PlayerName; + if (_GameData.ProfileIDs[c.Player[i]] < profiles.Length) + _ScreenSongOptions.Selection.TeamNames[i] = profiles[_GameData.ProfileIDs[c.Player[i]]].PlayerName; else _ScreenSongOptions.Selection.TeamNames[i] = "foobar"; } @@ -610,66 +610,66 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley } } - private void UpdateScores() + private void _UpdateScores() { - if (GameData.ResultTable.Count == 0) + if (_GameData.ResultTable.Count == 0) { - for (int i = 0; i < GameData.NumPlayer; i++) + for (int i = 0; i < _GameData.NumPlayer; i++) { - ResultTableRow row = new ResultTableRow(); - row.PlayerID = GameData.ProfileIDs[i]; + CResultTableRow row = new CResultTableRow(); + row.PlayerID = _GameData.ProfileIDs[i]; row.NumPlayed = 0; row.NumRounds = 0; row.NumWon = 0; row.NumSingPoints = 0; row.NumGamePoints = 0; - GameData.ResultTable.Add(row); + _GameData.ResultTable.Add(row); } - GameData.Results = new int[GameData.NumRounds,GameData.NumPlayerAtOnce]; - for (int i = 0; i < GameData.NumRounds; i++) + _GameData.Results = new int[_GameData.NumRounds,_GameData.NumPlayerAtOnce]; + for (int i = 0; i < _GameData.NumRounds; i++) { - for (int j = 0; j < GameData.NumPlayerAtOnce; j++) - GameData.Results[i, j] = 0; + for (int j = 0; j < _GameData.NumPlayerAtOnce; j++) + _GameData.Results[i, j] = 0; } } else { - CPoints GamePoints = CBase.Game.GetPoints(); - if (GamePoints == null || GamePoints.NumPlayer < GameData.NumPlayerAtOnce) + CPoints gamePoints = CBase.Game.GetPoints(); + if (gamePoints == null || gamePoints.NumPlayer < _GameData.NumPlayerAtOnce) return; - SPlayer[] results = GamePoints.GetPlayer(0, GameData.NumPlayerAtOnce); + SPlayer[] results = gamePoints.GetPlayer(0, _GameData.NumPlayerAtOnce); if (results == null) return; - if (results.Length < GameData.NumPlayerAtOnce) + if (results.Length < _GameData.NumPlayerAtOnce) return; - if (GamePoints.NumRounds == 0) + if (gamePoints.NumRounds == 0) return; - for (int i = 1; i < GamePoints.NumRounds; i++) + for (int i = 1; i < gamePoints.NumRounds; i++) { - SPlayer[] temp = GamePoints.GetPlayer(i, GameData.NumPlayerAtOnce); - for (int p = 0; p < GameData.NumPlayerAtOnce; p++) + SPlayer[] temp = gamePoints.GetPlayer(i, _GameData.NumPlayerAtOnce); + for (int p = 0; p < _GameData.NumPlayerAtOnce; p++) results[p].Points += temp[p].Points; } - for (int j = 0; j < GameData.NumPlayerAtOnce; j++) + for (int j = 0; j < _GameData.NumPlayerAtOnce; j++) { - results[j].Points = results[j].Points / GamePoints.NumRounds; - GameData.Results[GameData.CurrentRoundNr - 2, j] = (int)Math.Round(results[j].Points); + results[j].Points = results[j].Points / gamePoints.NumRounds; + _GameData.Results[_GameData.CurrentRoundNr - 2, j] = (int)Math.Round(results[j].Points); } - List points = GetPointsForPlayer(results); + List points = _GetPointsForPlayer(results); - for (int i = 0; i < GameData.NumPlayerAtOnce; i++) + for (int i = 0; i < _GameData.NumPlayerAtOnce; i++) { int index = -1; - for (int j = 0; j < GameData.ResultTable.Count; j++) + for (int j = 0; j < _GameData.ResultTable.Count; j++) { - if (points[i].ProfileID == GameData.ResultTable[j].PlayerID) + if (points[i].ProfileID == _GameData.ResultTable[j].PlayerID) { index = j; break; @@ -678,7 +678,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley if (index != -1) { - ResultTableRow row = GameData.ResultTable[index]; + CResultTableRow row = _GameData.ResultTable[index]; row.NumPlayed++; row.NumWon += points[i].Won; @@ -686,41 +686,41 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley row.NumSingPoints += points[i].SingPoints; row.NumGamePoints += points[i].GamePoints; - GameData.ResultTable[index] = row; + _GameData.ResultTable[index] = row; } } } - GameData.ResultTable.Sort(); + _GameData.ResultTable.Sort(); //Update position-number int pos = 1; int lastPoints = 0; int lastSingPoints = 0; - for (int i = 0; i < GameData.ResultTable.Count; i++) + for (int i = 0; i < _GameData.ResultTable.Count; i++) { - if (lastPoints > GameData.ResultTable[i].NumGamePoints || lastSingPoints > GameData.ResultTable[i].NumSingPoints) + if (lastPoints > _GameData.ResultTable[i].NumGamePoints || lastSingPoints > _GameData.ResultTable[i].NumSingPoints) pos++; - GameData.ResultTable[i].Position = pos; - lastPoints = GameData.ResultTable[i].NumGamePoints; - lastSingPoints = GameData.ResultTable[i].NumSingPoints; + _GameData.ResultTable[i].Position = pos; + lastPoints = _GameData.ResultTable[i].NumGamePoints; + lastSingPoints = _GameData.ResultTable[i].NumSingPoints; } } - private List GetPointsForPlayer(SPlayer[] Results) + private List _GetPointsForPlayer(SPlayer[] results) { - List result = new List(); - for (int i = 0; i < GameData.NumPlayerAtOnce; i++) + List result = new List(); + for (int i = 0; i < _GameData.NumPlayerAtOnce; i++) { - Stats stat = new Stats(); - stat.ProfileID = Results[i].ProfileID; - stat.SingPoints = (int)Math.Round(Results[i].Points); + SStats stat = new SStats(); + stat.ProfileID = results[i].ProfileID; + stat.SingPoints = (int)Math.Round(results[i].Points); stat.Won = 0; stat.GamePoints = 0; result.Add(stat); } - result.Sort(delegate(Stats s1, Stats s2) { return s1.SingPoints.CompareTo(s2.SingPoints); }); + result.Sort(delegate(SStats s1, SStats s2) { return s1.SingPoints.CompareTo(s2.SingPoints); }); int current = result[result.Count - 1].SingPoints; int points = result.Count; @@ -728,7 +728,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley for (int i = result.Count - 1; i >= 0; i--) { - Stats res = result[i]; + SStats res = result[i]; if (i < result.Count - 1) { @@ -760,17 +760,17 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley return result; } - private void CreateCatSongIndices() + private void _CreateCatSongIndices() { - if (GameData.CatSongIndices == null && CBase.Songs.GetNumCategories() > 0 && _ScreenSongOptions.Sorting.Tabs == EOffOn.TR_CONFIG_ON) + if (_GameData.CatSongIndices == null && CBase.Songs.GetNumCategories() > 0 && _ScreenSongOptions.Sorting.Tabs == EOffOn.TR_CONFIG_ON) { - GameData.CatSongIndices = new int[CBase.Songs.GetNumCategories()]; - for (int i = 0; i < GameData.CatSongIndices.Length; i++) - GameData.CatSongIndices[i] = -1; + _GameData.CatSongIndices = new int[CBase.Songs.GetNumCategories()]; + for (int i = 0; i < _GameData.CatSongIndices.Length; i++) + _GameData.CatSongIndices[i] = -1; } if (CBase.Songs.GetNumCategories() == 0 || _ScreenSongOptions.Sorting.Tabs == EOffOn.TR_CONFIG_OFF) - GameData.CatSongIndices = null; + _GameData.CatSongIndices = null; } } } \ No newline at end of file diff --git a/PartyModes/PartyModeChallengeMedley/PartyScreenChallengeMedleyConfig.cs b/PartyModes/PartyModeChallengeMedley/PartyScreenChallengeMedleyConfig.cs index 08fdac7e..111049b5 100644 --- a/PartyModes/PartyModeChallengeMedley/PartyScreenChallengeMedleyConfig.cs +++ b/PartyModes/PartyModeChallengeMedley/PartyScreenChallengeMedleyConfig.cs @@ -4,7 +4,7 @@ using VocaluxeLib.Menu; namespace VocaluxeLib.PartyModes.ChallengeMedley { - public class PartyScreenChallengeMedleyConfig : CMenuParty + public class CPartyScreenChallengeMedleyConfig : CMenuParty { // Version number for theme files. Increment it, if you've changed something on the theme files! protected override int _ScreenVersion @@ -12,43 +12,43 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley get { return 1; } } - private const string SelectSlideNumPlayers = "SelectSlideNumPlayers"; - private const string SelectSlideNumMics = "SelectSlideNumMics"; - private const string SelectSlideNumRounds = "SelectSlideNumRounds"; - private const string ButtonNext = "ButtonNext"; - private const string ButtonBack = "ButtonBack"; + private const string _SelectSlideNumPlayers = "SelectSlideNumPlayers"; + private const string _SelectSlideNumMics = "SelectSlideNumMics"; + private const string _SelectSlideNumRounds = "SelectSlideNumRounds"; + private const string _ButtonNext = "ButtonNext"; + private const string _ButtonBack = "ButtonBack"; private int _MaxNumMics = 2; private int _MaxNumRounds = 100; private int _RoundSteps = 1; - private DataFromScreen Data; + private SDataFromScreen _Data; public override void Init() { base.Init(); - _ThemeSelectSlides = new string[] {SelectSlideNumPlayers, SelectSlideNumMics, SelectSlideNumRounds}; - _ThemeButtons = new string[] {ButtonNext, ButtonBack}; + _ThemeSelectSlides = new string[] {_SelectSlideNumPlayers, _SelectSlideNumMics, _SelectSlideNumRounds}; + _ThemeButtons = new string[] {_ButtonNext, _ButtonBack}; - Data = new DataFromScreen(); - FromScreenConfig config = new FromScreenConfig(); + _Data = new SDataFromScreen(); + SFromScreenConfig config = new SFromScreenConfig(); config.NumPlayer = 4; config.NumPlayerAtOnce = 2; config.NumRounds = 12; - Data.ScreenConfig = config; + _Data.ScreenConfig = config; } - public override void DataToScreen(object ReceivedData) + public override void DataToScreen(object receivedData) { - DataToScreenConfig config = new DataToScreenConfig(); + SDataToScreenConfig config = new SDataToScreenConfig(); try { - config = (DataToScreenConfig)ReceivedData; - Data.ScreenConfig.NumPlayer = config.NumPlayer; - Data.ScreenConfig.NumPlayerAtOnce = config.NumPlayerAtOnce; - Data.ScreenConfig.NumRounds = config.NumRounds; + config = (SDataToScreenConfig)receivedData; + _Data.ScreenConfig.NumPlayer = config.NumPlayer; + _Data.ScreenConfig.NumPlayerAtOnce = config.NumPlayerAtOnce; + _Data.ScreenConfig.NumRounds = config.NumRounds; } catch (Exception e) { @@ -56,7 +56,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley } } - public override bool HandleInput(KeyEvent keyEvent) + public override bool HandleInput(SKeyEvent keyEvent) { base.HandleInput(keyEvent); @@ -67,47 +67,47 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley { case Keys.Back: case Keys.Escape: - Back(); + _Back(); break; case Keys.Enter: - UpdateSlides(); + _UpdateSlides(); - if (Buttons[ButtonBack].Selected) - Back(); + if (Buttons[_ButtonBack].Selected) + _Back(); - if (Buttons[ButtonNext].Selected) - Next(); + if (Buttons[_ButtonNext].Selected) + _Next(); break; case Keys.Left: - UpdateSlides(); + _UpdateSlides(); break; case Keys.Right: - UpdateSlides(); + _UpdateSlides(); break; } } return true; } - public override bool HandleMouse(MouseEvent mouseEvent) + public override bool HandleMouse(SMouseEvent mouseEvent) { base.HandleMouse(mouseEvent); if (mouseEvent.LB && IsMouseOver(mouseEvent)) { - UpdateSlides(); - if (Buttons[ButtonBack].Selected) - Back(); + _UpdateSlides(); + if (Buttons[_ButtonBack].Selected) + _Back(); - if (Buttons[ButtonNext].Selected) - Next(); + if (Buttons[_ButtonNext].Selected) + _Next(); } if (mouseEvent.RB) - Back(); + _Back(); return true; } @@ -122,7 +122,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley _MaxNumRounds = _PartyMode.GetMaxNumRounds(); - RebuildSlides(); + _RebuildSlides(); } public override bool UpdateGame() @@ -136,92 +136,92 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley return true; } - private void RebuildSlides() + private void _RebuildSlides() { // build num player slide (min player ... max player); - SelectSlides[SelectSlideNumPlayers].Clear(); + SelectSlides[_SelectSlideNumPlayers].Clear(); for (int i = _PartyMode.GetMinPlayer(); i <= _PartyMode.GetMaxPlayer(); i++) - SelectSlides[SelectSlideNumPlayers].AddValue(i.ToString()); - SelectSlides[SelectSlideNumPlayers].Selection = Data.ScreenConfig.NumPlayer - _PartyMode.GetMinPlayer(); + SelectSlides[_SelectSlideNumPlayers].AddValue(i.ToString()); + SelectSlides[_SelectSlideNumPlayers].Selection = _Data.ScreenConfig.NumPlayer - _PartyMode.GetMinPlayer(); - UpdateMicsAtOnce(); - SetRoundSteps(); - UpdateSlideRounds(); + _UpdateMicsAtOnce(); + _SetRoundSteps(); + _UpdateSlideRounds(); } - private void UpdateSlides() + private void _UpdateSlides() { - int player = Data.ScreenConfig.NumPlayer; - int mics = Data.ScreenConfig.NumPlayerAtOnce; - Data.ScreenConfig.NumPlayer = SelectSlides[SelectSlideNumPlayers].Selection + _PartyMode.GetMinPlayer(); - Data.ScreenConfig.NumPlayerAtOnce = SelectSlides[SelectSlideNumMics].Selection + _PartyMode.GetMinPlayer(); - Data.ScreenConfig.NumRounds = (SelectSlides[SelectSlideNumRounds].Selection + 1) * _RoundSteps; + int player = _Data.ScreenConfig.NumPlayer; + int mics = _Data.ScreenConfig.NumPlayerAtOnce; + _Data.ScreenConfig.NumPlayer = SelectSlides[_SelectSlideNumPlayers].Selection + _PartyMode.GetMinPlayer(); + _Data.ScreenConfig.NumPlayerAtOnce = SelectSlides[_SelectSlideNumMics].Selection + _PartyMode.GetMinPlayer(); + _Data.ScreenConfig.NumRounds = (SelectSlides[_SelectSlideNumRounds].Selection + 1) * _RoundSteps; - UpdateMicsAtOnce(); - SetRoundSteps(); + _UpdateMicsAtOnce(); + _SetRoundSteps(); - if (player != Data.ScreenConfig.NumPlayer || mics != Data.ScreenConfig.NumPlayerAtOnce) + if (player != _Data.ScreenConfig.NumPlayer || mics != _Data.ScreenConfig.NumPlayerAtOnce) { - int num = CHelper.CombinationCount(Data.ScreenConfig.NumPlayer, Data.ScreenConfig.NumPlayerAtOnce); + int num = CHelper.CombinationCount(_Data.ScreenConfig.NumPlayer, _Data.ScreenConfig.NumPlayerAtOnce); while (num > _MaxNumRounds) num -= _RoundSteps; - Data.ScreenConfig.NumRounds = num; + _Data.ScreenConfig.NumRounds = num; } - UpdateSlideRounds(); + _UpdateSlideRounds(); } - private void UpdateMicsAtOnce() + private void _UpdateMicsAtOnce() { //Data.ScreenConfig.NumPlayerAtOnce - int MaxNum = _MaxNumMics; - if (Data.ScreenConfig.NumPlayer < _MaxNumMics) - MaxNum = Data.ScreenConfig.NumPlayer; + int maxNum = _MaxNumMics; + if (_Data.ScreenConfig.NumPlayer < _MaxNumMics) + maxNum = _Data.ScreenConfig.NumPlayer; - if (Data.ScreenConfig.NumPlayerAtOnce > MaxNum) - Data.ScreenConfig.NumPlayerAtOnce = MaxNum; + if (_Data.ScreenConfig.NumPlayerAtOnce > maxNum) + _Data.ScreenConfig.NumPlayerAtOnce = maxNum; // build mics at once slide - SelectSlides[SelectSlideNumMics].Clear(); - for (int i = 1; i <= MaxNum; i++) - SelectSlides[SelectSlideNumMics].AddValue(i.ToString()); - SelectSlides[SelectSlideNumMics].Selection = Data.ScreenConfig.NumPlayerAtOnce - _PartyMode.GetMinPlayer(); + SelectSlides[_SelectSlideNumMics].Clear(); + for (int i = 1; i <= maxNum; i++) + SelectSlides[_SelectSlideNumMics].AddValue(i.ToString()); + SelectSlides[_SelectSlideNumMics].Selection = _Data.ScreenConfig.NumPlayerAtOnce - _PartyMode.GetMinPlayer(); } - private void UpdateSlideRounds() + private void _UpdateSlideRounds() { // build num rounds slide - SelectSlides[SelectSlideNumRounds].Clear(); + SelectSlides[_SelectSlideNumRounds].Clear(); for (int i = _RoundSteps; i <= _MaxNumRounds; i += _RoundSteps) - SelectSlides[SelectSlideNumRounds].AddValue(i.ToString()); - SelectSlides[SelectSlideNumRounds].Selection = Data.ScreenConfig.NumRounds / _RoundSteps - 1; + SelectSlides[_SelectSlideNumRounds].AddValue(i.ToString()); + SelectSlides[_SelectSlideNumRounds].Selection = _Data.ScreenConfig.NumRounds / _RoundSteps - 1; } - private void SetRoundSteps() + private void _SetRoundSteps() { - if (Data.ScreenConfig.NumPlayerAtOnce < 1 || Data.ScreenConfig.NumPlayer < 1 || Data.ScreenConfig.NumPlayerAtOnce > Data.ScreenConfig.NumPlayer) + if (_Data.ScreenConfig.NumPlayerAtOnce < 1 || _Data.ScreenConfig.NumPlayer < 1 || _Data.ScreenConfig.NumPlayerAtOnce > _Data.ScreenConfig.NumPlayer) { _RoundSteps = 1; return; } - int res = Data.ScreenConfig.NumPlayer / Data.ScreenConfig.NumPlayerAtOnce; - int mod = Data.ScreenConfig.NumPlayer % Data.ScreenConfig.NumPlayerAtOnce; + int res = _Data.ScreenConfig.NumPlayer / _Data.ScreenConfig.NumPlayerAtOnce; + int mod = _Data.ScreenConfig.NumPlayer % _Data.ScreenConfig.NumPlayerAtOnce; if (mod == 0) _RoundSteps = res; else - _RoundSteps = Data.ScreenConfig.NumPlayer; + _RoundSteps = _Data.ScreenConfig.NumPlayer; } - private void Back() + private void _Back() { - FadeTo(EScreens.ScreenParty); + _FadeTo(EScreens.ScreenParty); } - private void Next() + private void _Next() { - _PartyMode.DataFromScreen(ThemeName, Data); + _PartyMode.DataFromScreen(ThemeName, _Data); } } } \ No newline at end of file diff --git a/PartyModes/PartyModeChallengeMedley/PartyScreenChallengeMedleyMain.cs b/PartyModes/PartyModeChallengeMedley/PartyScreenChallengeMedleyMain.cs index 0e377470..4a0dd98f 100644 --- a/PartyModes/PartyModeChallengeMedley/PartyScreenChallengeMedleyMain.cs +++ b/PartyModes/PartyModeChallengeMedley/PartyScreenChallengeMedleyMain.cs @@ -5,7 +5,7 @@ using VocaluxeLib.Menu; namespace VocaluxeLib.PartyModes.ChallengeMedley { - struct TableRow + struct STableRow { public CText Pos; public CText Name; @@ -15,14 +15,14 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley public CText GamePoints; } - class RoundsTableRow + class CRoundsTableRow { public CText Number; public List TextPlayer; public List TextScores; } - public class PartyScreenChallengeMedleyMain : CMenuParty + public class CPartyScreenChallengeMedleyMain : CMenuParty { // Version number for theme files. Increment it, if you've changed something on the theme files! protected override int _ScreenVersion @@ -30,55 +30,55 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley get { return 1; } } - private const string TextPosition = "TextPosition"; - private const string TextPlayerName = "TextPlayerName"; - private const string TextNumPlayed = "TextNumPlayed"; - private const string TextWon = "TextWon"; - private const string TextSingPoints = "TextSingPoints"; - private const string TextGamePoints = "TextGamePoints"; - private const string TextNextPlayer = "TextNextPlayer"; - private const string TextPopupReallyExit = "TextPopupReallyExit"; - private const string TextRoundPlayer = "TextRoundPlayer"; - private const string TextRoundScore = "TextRoundScore"; - private const string TextRoundNumber = "TextRoundNumber"; - private const string TextFinishMessage = "TextFinishMessage"; - private const string TextFinishPlayerWin = "TextFinishPlayerWin"; - private const string TextNextPlayerMessage = "TextNextPlayerMessage"; + private const string _TextPosition = "TextPosition"; + private const string _TextPlayerName = "TextPlayerName"; + private const string _TextNumPlayed = "TextNumPlayed"; + private const string _TextWon = "TextWon"; + private const string _TextSingPoints = "TextSingPoints"; + private const string _TextGamePoints = "TextGamePoints"; + private const string _TextNextPlayer = "TextNextPlayer"; + private const string _TextPopupReallyExit = "TextPopupReallyExit"; + private const string _TextRoundPlayer = "TextRoundPlayer"; + private const string _TextRoundScore = "TextRoundScore"; + private const string _TextRoundNumber = "TextRoundNumber"; + private const string _TextFinishMessage = "TextFinishMessage"; + private const string _TextFinishPlayerWin = "TextFinishPlayerWin"; + private const string _TextNextPlayerMessage = "TextNextPlayerMessage"; - private const string ButtonNextRound = "ButtonNextRound"; - private const string ButtonBack = "ButtonBack"; - private const string ButtonExit = "ButtonExit"; - private const string ButtonPopupYes = "ButtonPopupYes"; - private const string ButtonPopupNo = "ButtonPopupNo"; - private const string ButtonPlayerScrollUp = "ButtonPlayerScrollUp"; - private const string ButtonPlayerScrollDown = "ButtonPlayerScrollDown"; - private const string ButtonRoundsScrollUp = "ButtonRoundsScrollUp"; - private const string ButtonRoundsScrollDown = "ButtonRoundsScrollDown"; + private const string _ButtonNextRound = "ButtonNextRound"; + private const string _ButtonBack = "ButtonBack"; + private const string _ButtonExit = "ButtonExit"; + private const string _ButtonPopupYes = "ButtonPopupYes"; + private const string _ButtonPopupNo = "ButtonPopupNo"; + private const string _ButtonPlayerScrollUp = "ButtonPlayerScrollUp"; + private const string _ButtonPlayerScrollDown = "ButtonPlayerScrollDown"; + private const string _ButtonRoundsScrollUp = "ButtonRoundsScrollUp"; + private const string _ButtonRoundsScrollDown = "ButtonRoundsScrollDown"; - private const string StaticPopupBG = "StaticPopupBG"; - private const string StaticNextPlayer = "StaticNextPlayer"; + private const string _StaticPopupBG = "StaticPopupBG"; + private const string _StaticNextPlayer = "StaticNextPlayer"; - private bool ExitPopupVisible; + private bool _ExitPopupVisible; - private DataFromScreen Data; - private DataToScreenMain GameState; - private List PlayerTable; - private List RoundsTable; + private SDataFromScreen _Data; + private SDataToScreenMain _GameState; + private List _PlayerTable; + private List _RoundsTable; - private List NextPlayerTexts; - private List NextPlayerStatics; + private List _NextPlayerTexts; + private List _NextPlayerStatics; - private SRectF RoundsTableScrollArea; - private SRectF PlayerTableScrollArea; - private int RoundsTableOffset; - private int PlayerTableOffset; - private int NumPlayerVisible = 10; - private int NumRoundsVisible = 3; + private SRectF _RoundsTableScrollArea; + private SRectF _PlayerTableScrollArea; + private int _RoundsTableOffset; + private int _PlayerTableOffset; + private int _NumPlayerVisible = 10; + private int _NumRoundsVisible = 3; - public PartyScreenChallengeMedleyMain() + public CPartyScreenChallengeMedleyMain() { - Data = new DataFromScreen(); - Data.ScreenMain = new FromScreenMain(); + _Data = new SDataFromScreen(); + _Data.ScreenMain = new SFromScreenMain(); } public override void Init() @@ -87,41 +87,41 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley _ThemeTexts = new string[] { - TextPosition, TextPlayerName, TextNumPlayed, TextWon, TextSingPoints, TextGamePoints, TextNextPlayer, TextPopupReallyExit, TextRoundNumber, TextRoundPlayer, - TextRoundScore, TextFinishMessage, TextFinishPlayerWin, TextNextPlayerMessage + _TextPosition, _TextPlayerName, _TextNumPlayed, _TextWon, _TextSingPoints, _TextGamePoints, _TextNextPlayer, _TextPopupReallyExit, _TextRoundNumber, _TextRoundPlayer, + _TextRoundScore, _TextFinishMessage, _TextFinishPlayerWin, _TextNextPlayerMessage }; _ThemeButtons = new string[] - {ButtonNextRound, ButtonBack, ButtonExit, ButtonPopupYes, ButtonPopupNo, ButtonPlayerScrollDown, ButtonPlayerScrollUp, ButtonRoundsScrollDown, ButtonRoundsScrollUp}; - _ThemeStatics = new string[] {StaticPopupBG, StaticNextPlayer}; + {_ButtonNextRound, _ButtonBack, _ButtonExit, _ButtonPopupYes, _ButtonPopupNo, _ButtonPlayerScrollDown, _ButtonPlayerScrollUp, _ButtonRoundsScrollDown, _ButtonRoundsScrollUp}; + _ThemeStatics = new string[] {_StaticPopupBG, _StaticNextPlayer}; } - public override void LoadTheme(string XmlPath) + public override void LoadTheme(string xmlPath) { - base.LoadTheme(XmlPath); + base.LoadTheme(xmlPath); - GameState = new DataToScreenMain(); - BuildPlayerTable(); - CreateRoundsTable(); - NextPlayerTexts = new List(); - NextPlayerStatics = new List(); + _GameState = new SDataToScreenMain(); + _BuildPlayerTable(); + _CreateRoundsTable(); + _NextPlayerTexts = new List(); + _NextPlayerStatics = new List(); for (int i = 0; i < _PartyMode.GetMaxPlayer(); i++) { - NextPlayerTexts.Add(GetNewText(Texts[TextNextPlayer])); - AddText(NextPlayerTexts[NextPlayerTexts.Count - 1]); - NextPlayerStatics.Add(GetNewStatic(Statics[StaticNextPlayer])); - AddStatic(NextPlayerStatics[NextPlayerStatics.Count - 1]); + _NextPlayerTexts.Add(GetNewText(Texts[_TextNextPlayer])); + AddText(_NextPlayerTexts[_NextPlayerTexts.Count - 1]); + _NextPlayerStatics.Add(GetNewStatic(Statics[_StaticNextPlayer])); + AddStatic(_NextPlayerStatics[_NextPlayerStatics.Count - 1]); } } - public override void DataToScreen(object ReceivedData) + public override void DataToScreen(object receivedData) { - DataToScreenMain data = new DataToScreenMain(); + SDataToScreenMain data = new SDataToScreenMain(); try { - data = (DataToScreenMain)ReceivedData; - GameState = data; + data = (SDataToScreenMain)receivedData; + _GameState = data; } catch (Exception e) { @@ -129,7 +129,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley } } - public override bool HandleInput(KeyEvent keyEvent) + public override bool HandleInput(SKeyEvent keyEvent) { base.HandleInput(keyEvent); @@ -140,41 +140,41 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley { case Keys.Back: case Keys.Escape: - if (!ExitPopupVisible) + if (!_ExitPopupVisible) { - if (GameState.CurrentRoundNr == 1) - Back(); + if (_GameState.CurrentRoundNr == 1) + _Back(); else - ShowPopup(true); + _ShowPopup(true); } else - ShowPopup(false); + _ShowPopup(false); break; case Keys.Enter: - if (!ExitPopupVisible) + if (!_ExitPopupVisible) { - if (Buttons[ButtonNextRound].Selected) - NextRound(); - if (Buttons[ButtonBack].Selected && GameState.CurrentRoundNr == 1) - Back(); - if (Buttons[ButtonExit].Selected && GameState.CurrentRoundNr > 1) - ShowPopup(true); - if (Buttons[ButtonPlayerScrollUp].Selected) - ScrollPlayerTable(-1); - if (Buttons[ButtonPlayerScrollDown].Selected) - ScrollPlayerTable(1); - if (Buttons[ButtonRoundsScrollUp].Selected) - ScrollRoundsTable(-1); - if (Buttons[ButtonRoundsScrollDown].Selected) - ScrollRoundsTable(1); + if (Buttons[_ButtonNextRound].Selected) + _NextRound(); + if (Buttons[_ButtonBack].Selected && _GameState.CurrentRoundNr == 1) + _Back(); + if (Buttons[_ButtonExit].Selected && _GameState.CurrentRoundNr > 1) + _ShowPopup(true); + if (Buttons[_ButtonPlayerScrollUp].Selected) + _ScrollPlayerTable(-1); + if (Buttons[_ButtonPlayerScrollDown].Selected) + _ScrollPlayerTable(1); + if (Buttons[_ButtonRoundsScrollUp].Selected) + _ScrollRoundsTable(-1); + if (Buttons[_ButtonRoundsScrollDown].Selected) + _ScrollRoundsTable(1); } else { - if (Buttons[ButtonPopupYes].Selected) - EndParty(); - if (Buttons[ButtonPopupNo].Selected) - ShowPopup(false); + if (Buttons[_ButtonPopupYes].Selected) + _EndParty(); + if (Buttons[_ButtonPopupNo].Selected) + _ShowPopup(false); } break; } @@ -182,57 +182,57 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley return true; } - public override bool HandleMouse(MouseEvent mouseEvent) + public override bool HandleMouse(SMouseEvent mouseEvent) { base.HandleMouse(mouseEvent); if (mouseEvent.LB && IsMouseOver(mouseEvent)) { - if (!ExitPopupVisible) + if (!_ExitPopupVisible) { - if (Buttons[ButtonNextRound].Selected) - NextRound(); - if (Buttons[ButtonBack].Selected && GameState.CurrentRoundNr == 1) - Back(); - if (Buttons[ButtonExit].Selected && GameState.CurrentRoundNr > 1) - ShowPopup(true); - if (Buttons[ButtonPlayerScrollUp].Selected) - ScrollPlayerTable(-1); - if (Buttons[ButtonPlayerScrollDown].Selected) - ScrollPlayerTable(1); - if (Buttons[ButtonRoundsScrollUp].Selected) - ScrollRoundsTable(-1); - if (Buttons[ButtonRoundsScrollDown].Selected) - ScrollRoundsTable(1); + if (Buttons[_ButtonNextRound].Selected) + _NextRound(); + if (Buttons[_ButtonBack].Selected && _GameState.CurrentRoundNr == 1) + _Back(); + if (Buttons[_ButtonExit].Selected && _GameState.CurrentRoundNr > 1) + _ShowPopup(true); + if (Buttons[_ButtonPlayerScrollUp].Selected) + _ScrollPlayerTable(-1); + if (Buttons[_ButtonPlayerScrollDown].Selected) + _ScrollPlayerTable(1); + if (Buttons[_ButtonRoundsScrollUp].Selected) + _ScrollRoundsTable(-1); + if (Buttons[_ButtonRoundsScrollDown].Selected) + _ScrollRoundsTable(1); } else { - if (Buttons[ButtonPopupYes].Selected) - EndParty(); - if (Buttons[ButtonPopupNo].Selected) - ShowPopup(false); + if (Buttons[_ButtonPopupYes].Selected) + _EndParty(); + if (Buttons[_ButtonPopupNo].Selected) + _ShowPopup(false); } } if (mouseEvent.RB) { - if (!ExitPopupVisible) + if (!_ExitPopupVisible) { - if (GameState.CurrentRoundNr == 1) - Back(); + if (_GameState.CurrentRoundNr == 1) + _Back(); else - ShowPopup(true); + _ShowPopup(true); } else - ShowPopup(false); + _ShowPopup(false); } if (mouseEvent.Wheel != 0) { - if (CHelper.IsInBounds(RoundsTableScrollArea, mouseEvent)) - ScrollRoundsTable(mouseEvent.Wheel); - if (CHelper.IsInBounds(PlayerTableScrollArea, mouseEvent)) - ScrollPlayerTable(mouseEvent.Wheel); + if (CHelper.IsInBounds(_RoundsTableScrollArea, mouseEvent)) + _ScrollRoundsTable(mouseEvent.Wheel); + if (CHelper.IsInBounds(_PlayerTableScrollArea, mouseEvent)) + _ScrollPlayerTable(mouseEvent.Wheel); } return true; @@ -242,46 +242,46 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley { base.OnShow(); - PlayerTableOffset = 0; - RoundsTableOffset = 0; + _PlayerTableOffset = 0; + _RoundsTableOffset = 0; - UpdatePlayerTable(); - UpdateNextPlayerPositions(); - UpdateNextPlayerContents(); - if (GameState.CurrentRoundNr == 1) - BuildRoundsTable(); + _UpdatePlayerTable(); + _UpdateNextPlayerPositions(); + _UpdateNextPlayerContents(); + if (_GameState.CurrentRoundNr == 1) + _BuildRoundsTable(); else - ScrollRoundsTable(GameState.CurrentRoundNr - 2); - UpdateRoundsTable(); + _ScrollRoundsTable(_GameState.CurrentRoundNr - 2); + _UpdateRoundsTable(); - if (GameState.CurrentRoundNr == 1) + if (_GameState.CurrentRoundNr == 1) { - Buttons[ButtonBack].Visible = true; - Buttons[ButtonExit].Visible = false; + Buttons[_ButtonBack].Visible = true; + Buttons[_ButtonExit].Visible = false; } else { - Buttons[ButtonBack].Visible = false; - Buttons[ButtonExit].Visible = true; + Buttons[_ButtonBack].Visible = false; + Buttons[_ButtonExit].Visible = true; } - if (GameState.CurrentRoundNr <= GameState.Combs.Count) + if (_GameState.CurrentRoundNr <= _GameState.Combs.Count) { - Buttons[ButtonNextRound].Visible = true; - Texts[TextFinishMessage].Visible = false; - Texts[TextFinishPlayerWin].Visible = false; - SetInteractionToButton(Buttons[ButtonNextRound]); + Buttons[_ButtonNextRound].Visible = true; + Texts[_TextFinishMessage].Visible = false; + Texts[_TextFinishPlayerWin].Visible = false; + SetInteractionToButton(Buttons[_ButtonNextRound]); } else { - Buttons[ButtonNextRound].Visible = false; - Texts[TextFinishMessage].Visible = true; - Texts[TextFinishPlayerWin].Visible = true; - Texts[TextFinishPlayerWin].Text = GetPlayerWinString(); - SetInteractionToButton(Buttons[ButtonExit]); + Buttons[_ButtonNextRound].Visible = false; + Texts[_TextFinishMessage].Visible = true; + Texts[_TextFinishPlayerWin].Visible = true; + Texts[_TextFinishPlayerWin].Text = _GetPlayerWinString(); + SetInteractionToButton(Buttons[_ButtonExit]); } - ShowPopup(false); + _ShowPopup(false); } public override bool UpdateGame() @@ -295,246 +295,246 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley return true; } - private void NextRound() + private void _NextRound() { - Data.ScreenMain.FadeToNameSelection = false; - Data.ScreenMain.FadeToSongSelection = true; - _PartyMode.DataFromScreen(ThemeName, Data); + _Data.ScreenMain.FadeToNameSelection = false; + _Data.ScreenMain.FadeToSongSelection = true; + _PartyMode.DataFromScreen(ThemeName, _Data); } - private void EndParty() + private void _EndParty() { - FadeTo(EScreens.ScreenParty); + _FadeTo(EScreens.ScreenParty); } - private void ShowPopup(bool Visible) + private void _ShowPopup(bool visible) { - ExitPopupVisible = Visible; + _ExitPopupVisible = visible; - Statics[StaticPopupBG].Visible = ExitPopupVisible; - Texts[TextPopupReallyExit].Visible = ExitPopupVisible; - Buttons[ButtonPopupYes].Visible = ExitPopupVisible; - Buttons[ButtonPopupNo].Visible = ExitPopupVisible; + Statics[_StaticPopupBG].Visible = _ExitPopupVisible; + Texts[_TextPopupReallyExit].Visible = _ExitPopupVisible; + Buttons[_ButtonPopupYes].Visible = _ExitPopupVisible; + Buttons[_ButtonPopupNo].Visible = _ExitPopupVisible; - if (ExitPopupVisible) - SetInteractionToButton(Buttons[ButtonPopupNo]); + if (_ExitPopupVisible) + SetInteractionToButton(Buttons[_ButtonPopupNo]); } - private void Back() + private void _Back() { - Data.ScreenMain.FadeToNameSelection = true; - Data.ScreenMain.FadeToSongSelection = false; - _PartyMode.DataFromScreen(ThemeName, Data); + _Data.ScreenMain.FadeToNameSelection = true; + _Data.ScreenMain.FadeToSongSelection = false; + _PartyMode.DataFromScreen(ThemeName, _Data); } - private void UpdateNextPlayerPositions() + private void _UpdateNextPlayerPositions() { - float x = CBase.Settings.GetRenderW() / 2 - ((GameState.NumPlayerAtOnce * Statics[StaticNextPlayer].Rect.W) + ((GameState.NumPlayerAtOnce - 1) * 15)) / 2; - float static_y = 590; - float text_y = 550; - for (int i = 0; i < GameState.NumPlayerAtOnce; i++) + float x = CBase.Settings.GetRenderW() / 2 - ((_GameState.NumPlayerAtOnce * Statics[_StaticNextPlayer].Rect.W) + ((_GameState.NumPlayerAtOnce - 1) * 15)) / 2; + float staticY = 590; + float textY = 550; + for (int i = 0; i < _GameState.NumPlayerAtOnce; i++) { //static - NextPlayerStatics[i].Rect.X = x; - NextPlayerStatics[i].Rect.Y = static_y; - NextPlayerStatics[i].Visible = true; + _NextPlayerStatics[i].Rect.X = x; + _NextPlayerStatics[i].Rect.Y = staticY; + _NextPlayerStatics[i].Visible = true; //text - NextPlayerTexts[i].X = x + Statics[StaticNextPlayer].Rect.W / 2; - NextPlayerTexts[i].Y = text_y; - NextPlayerTexts[i].Visible = true; + _NextPlayerTexts[i].X = x + Statics[_StaticNextPlayer].Rect.W / 2; + _NextPlayerTexts[i].Y = textY; + _NextPlayerTexts[i].Visible = true; - x += Statics[StaticNextPlayer].Rect.W + 15; + x += Statics[_StaticNextPlayer].Rect.W + 15; } - for (int i = GameState.NumPlayerAtOnce; i < _PartyMode.GetMaxPlayer(); i++) + for (int i = _GameState.NumPlayerAtOnce; i < _PartyMode.GetMaxPlayer(); i++) { - NextPlayerStatics[i].Visible = false; - NextPlayerTexts[i].Visible = false; + _NextPlayerStatics[i].Visible = false; + _NextPlayerTexts[i].Visible = false; } } - private void UpdateNextPlayerContents() + private void _UpdateNextPlayerContents() { - if (GameState.CurrentRoundNr <= GameState.Combs.Count) + if (_GameState.CurrentRoundNr <= _GameState.Combs.Count) { - Texts[TextNextPlayerMessage].Visible = true; + Texts[_TextNextPlayerMessage].Visible = true; SProfile[] profiles = CBase.Profiles.GetProfiles(); - for (int i = 0; i < GameState.NumPlayerAtOnce; i++) + for (int i = 0; i < _GameState.NumPlayerAtOnce; i++) { - int pid = GameState.Combs[GameState.CurrentRoundNr - 1].Player[i]; - NextPlayerStatics[i].Texture = profiles[GameState.ProfileIDs[pid]].Avatar.Texture; - NextPlayerTexts[i].Text = profiles[GameState.ProfileIDs[pid]].PlayerName; - NextPlayerTexts[i].Color = CBase.Theme.GetPlayerColor(i + 1); + int pid = _GameState.Combs[_GameState.CurrentRoundNr - 1].Player[i]; + _NextPlayerStatics[i].Texture = profiles[_GameState.ProfileIDs[pid]].Avatar.Texture; + _NextPlayerTexts[i].Text = profiles[_GameState.ProfileIDs[pid]].PlayerName; + _NextPlayerTexts[i].Color = CBase.Theme.GetPlayerColor(i + 1); } } else { - Texts[TextNextPlayerMessage].Visible = false; - for (int i = 0; i < GameState.NumPlayerAtOnce; i++) + Texts[_TextNextPlayerMessage].Visible = false; + for (int i = 0; i < _GameState.NumPlayerAtOnce; i++) { - NextPlayerStatics[i].Visible = false; - NextPlayerTexts[i].Visible = false; + _NextPlayerStatics[i].Visible = false; + _NextPlayerTexts[i].Visible = false; } } } - private void CreateRoundsTable() + private void _CreateRoundsTable() { //Create lists - RoundsTable = new List(); + _RoundsTable = new List(); for (int i = 0; i < 5; i++) { - RoundsTableRow rtr = new RoundsTableRow(); + CRoundsTableRow rtr = new CRoundsTableRow(); rtr.TextPlayer = new List(); rtr.TextScores = new List(); - RoundsTable.Add(rtr); + _RoundsTable.Add(rtr); } //Create statics and texts for rounds - for (int round = 0; round < RoundsTable.Count; round++) + for (int round = 0; round < _RoundsTable.Count; round++) { //Round-number - CText text = GetNewText(Texts[TextRoundNumber]); + CText text = GetNewText(Texts[_TextRoundNumber]); AddText(text); - RoundsTable[round].Number = text; + _RoundsTable[round].Number = text; for (int row = 0; row < 2; row++) { for (int column = 0; column < 3; column++) { //Player - text = GetNewText(Texts[TextRoundPlayer]); + text = GetNewText(Texts[_TextRoundPlayer]); AddText(text); - RoundsTable[round].TextPlayer.Add(text); + _RoundsTable[round].TextPlayer.Add(text); //Score - text = GetNewText(Texts[TextRoundScore]); + text = GetNewText(Texts[_TextRoundScore]); AddText(text); - RoundsTable[round].TextScores.Add(text); + _RoundsTable[round].TextScores.Add(text); } } } } - private void BuildRoundsTable() + private void _BuildRoundsTable() { - RoundsTableScrollArea = new SRectF(); + _RoundsTableScrollArea = new SRectF(); - int NumPlayerInOneRow = 3; - if (GameState.NumPlayerAtOnce <= NumPlayerInOneRow) - NumRoundsVisible = 5; + int numPlayerInOneRow = 3; + if (_GameState.NumPlayerAtOnce <= numPlayerInOneRow) + _NumRoundsVisible = 5; else - NumRoundsVisible = 3; + _NumRoundsVisible = 3; - if (NumRoundsVisible > GameState.Combs.Count) - NumRoundsVisible = GameState.Combs.Count; + if (_NumRoundsVisible > _GameState.Combs.Count) + _NumRoundsVisible = _GameState.Combs.Count; - float numberX = Texts[TextRoundNumber].X; - float numberY = Texts[TextRoundNumber].Y; + float numberX = Texts[_TextRoundNumber].X; + float numberY = Texts[_TextRoundNumber].Y; - RoundsTableScrollArea.X = numberX; - RoundsTableScrollArea.Y = numberY; - RoundsTableScrollArea.W = CBase.Settings.GetRenderW() - Texts[TextRoundNumber].X - 20; + _RoundsTableScrollArea.X = numberX; + _RoundsTableScrollArea.Y = numberY; + _RoundsTableScrollArea.W = CBase.Settings.GetRenderW() - Texts[_TextRoundNumber].X - 20; - float delta = Texts[TextRoundNumber].Height; + float delta = Texts[_TextRoundNumber].Height; //Update statics and texts for rounds - for (int round = 0; round < RoundsTable.Count; round++) + for (int round = 0; round < _RoundsTable.Count; round++) { //Round-number - RoundsTable[round].Number.X = numberX; - RoundsTable[round].Number.Y = numberY; - int NumInnerRows = (int)Math.Ceiling(GameState.NumPlayerAtOnce / ((double)NumPlayerInOneRow)); - for (int row = 0; row < NumInnerRows; row++) + _RoundsTable[round].Number.X = numberX; + _RoundsTable[round].Number.Y = numberY; + int numInnerRows = (int)Math.Ceiling(_GameState.NumPlayerAtOnce / ((double)numPlayerInOneRow)); + for (int row = 0; row < numInnerRows; row++) { - int num = (row + 1) * NumPlayerInOneRow; - int NumPlayerInThisRow = NumPlayerInOneRow; - if (num > GameState.NumPlayerAtOnce) + int num = (row + 1) * numPlayerInOneRow; + int numPlayerInThisRow = numPlayerInOneRow; + if (num > _GameState.NumPlayerAtOnce) { - num = GameState.NumPlayerAtOnce; - NumPlayerInThisRow = GameState.NumPlayerAtOnce - (row * NumPlayerInOneRow); + num = _GameState.NumPlayerAtOnce; + numPlayerInThisRow = _GameState.NumPlayerAtOnce - (row * numPlayerInOneRow); } - for (int column = row * NumPlayerInOneRow; column < num; column++) + for (int column = row * numPlayerInOneRow; column < num; column++) { //Player - float _x = numberX + 15 + (CBase.Settings.GetRenderW() - Texts[TextRoundNumber].X - 20) / NumPlayerInThisRow * (column - row * NumPlayerInOneRow) + - ((CBase.Settings.GetRenderW() - Texts[TextRoundNumber].X - 20) / NumPlayerInThisRow) / 2; - float maxw = ((CBase.Settings.GetRenderW() - Texts[TextRoundNumber].X - 20) / NumPlayerInThisRow) / 2 - 5; - RoundsTable[round].TextPlayer[column].X = _x; - RoundsTable[round].TextPlayer[column].Y = numberY; - RoundsTable[round].TextPlayer[column].MaxWidth = maxw; + float x = numberX + 15 + (CBase.Settings.GetRenderW() - Texts[_TextRoundNumber].X - 20) / numPlayerInThisRow * (column - row * numPlayerInOneRow) + + ((CBase.Settings.GetRenderW() - Texts[_TextRoundNumber].X - 20) / numPlayerInThisRow) / 2; + float maxw = ((CBase.Settings.GetRenderW() - Texts[_TextRoundNumber].X - 20) / numPlayerInThisRow) / 2 - 5; + _RoundsTable[round].TextPlayer[column].X = x; + _RoundsTable[round].TextPlayer[column].Y = numberY; + _RoundsTable[round].TextPlayer[column].MaxWidth = maxw; //Score - RoundsTable[round].TextScores[column] = RoundsTable[round].TextScores[column]; - RoundsTable[round].TextScores[column].X = _x; - RoundsTable[round].TextScores[column].Y = numberY + delta; - RoundsTable[round].TextScores[column].MaxWidth = maxw; + _RoundsTable[round].TextScores[column] = _RoundsTable[round].TextScores[column]; + _RoundsTable[round].TextScores[column].X = x; + _RoundsTable[round].TextScores[column].Y = numberY + delta; + _RoundsTable[round].TextScores[column].MaxWidth = maxw; } numberY = numberY + delta + delta; } numberY = numberY + delta / 2; } - RoundsTableScrollArea.H = numberY - RoundsTableScrollArea.Y; + _RoundsTableScrollArea.H = numberY - _RoundsTableScrollArea.Y; } - private void UpdateRoundsTable() + private void _UpdateRoundsTable() { SProfile[] profile = CBase.Profiles.GetProfiles(); - for (int i = 0; i < RoundsTable.Count; i++) + for (int i = 0; i < _RoundsTable.Count; i++) { - for (int p = 0; p < RoundsTable[i].TextPlayer.Count; p++) + for (int p = 0; p < _RoundsTable[i].TextPlayer.Count; p++) { - if (GameState.Combs.Count > i + RoundsTableOffset && GameState.Combs[i + RoundsTableOffset].Player.Count > p) + if (_GameState.Combs.Count > i + _RoundsTableOffset && _GameState.Combs[i + _RoundsTableOffset].Player.Count > p) { - RoundsTable[i].Number.Visible = true; - RoundsTable[i].TextPlayer[p].Visible = true; - RoundsTable[i].TextScores[p].Visible = true; - RoundsTable[i].Number.Text = (i + 1 + RoundsTableOffset).ToString() + ")"; - int pID = GameState.ProfileIDs[GameState.Combs[i + RoundsTableOffset].Player[p]]; - RoundsTable[i].TextPlayer[p].Text = profile[pID].PlayerName; - if ((GameState.CurrentRoundNr - 1) > i + RoundsTableOffset) - RoundsTable[i].TextScores[p].Text = GameState.Results[i + RoundsTableOffset, p].ToString(); + _RoundsTable[i].Number.Visible = true; + _RoundsTable[i].TextPlayer[p].Visible = true; + _RoundsTable[i].TextScores[p].Visible = true; + _RoundsTable[i].Number.Text = (i + 1 + _RoundsTableOffset).ToString() + ")"; + int pID = _GameState.ProfileIDs[_GameState.Combs[i + _RoundsTableOffset].Player[p]]; + _RoundsTable[i].TextPlayer[p].Text = profile[pID].PlayerName; + if ((_GameState.CurrentRoundNr - 1) > i + _RoundsTableOffset) + _RoundsTable[i].TextScores[p].Text = _GameState.Results[i + _RoundsTableOffset, p].ToString(); else - RoundsTable[i].TextScores[p].Text = ""; + _RoundsTable[i].TextScores[p].Text = ""; } else { - RoundsTable[i].TextPlayer[p].Visible = false; - RoundsTable[i].TextScores[p].Visible = false; + _RoundsTable[i].TextPlayer[p].Visible = false; + _RoundsTable[i].TextScores[p].Visible = false; } } - if (GameState.Combs.Count < i + RoundsTableOffset || i + 1 > NumRoundsVisible) + if (_GameState.Combs.Count < i + _RoundsTableOffset || i + 1 > _NumRoundsVisible) { - RoundsTable[i].Number.Visible = false; - for (int p = 0; p < RoundsTable[i].TextPlayer.Count; p++) + _RoundsTable[i].Number.Visible = false; + for (int p = 0; p < _RoundsTable[i].TextPlayer.Count; p++) { - RoundsTable[i].TextPlayer[p].Visible = false; - RoundsTable[i].TextScores[p].Visible = false; + _RoundsTable[i].TextPlayer[p].Visible = false; + _RoundsTable[i].TextScores[p].Visible = false; } } } - Buttons[ButtonRoundsScrollUp].Visible = RoundsTableOffset > 0; - Buttons[ButtonRoundsScrollDown].Visible = GameState.Combs.Count - NumRoundsVisible - RoundsTableOffset > 0; + Buttons[_ButtonRoundsScrollUp].Visible = _RoundsTableOffset > 0; + Buttons[_ButtonRoundsScrollDown].Visible = _GameState.Combs.Count - _NumRoundsVisible - _RoundsTableOffset > 0; } - private void BuildPlayerTable() + private void _BuildPlayerTable() { - PlayerTableScrollArea = new SRectF(); - PlayerTableScrollArea.X = Texts[TextPosition].X; - PlayerTableScrollArea.Y = Texts[TextPosition].Y; - PlayerTableScrollArea.W = Texts[TextGamePoints].X - Texts[TextPosition].X; + _PlayerTableScrollArea = new SRectF(); + _PlayerTableScrollArea.X = Texts[_TextPosition].X; + _PlayerTableScrollArea.Y = Texts[_TextPosition].Y; + _PlayerTableScrollArea.W = Texts[_TextGamePoints].X - Texts[_TextPosition].X; - PlayerTable = new List(); - float delta = Texts[TextPosition].Height * 1.2f; + _PlayerTable = new List(); + float delta = Texts[_TextPosition].Height * 1.2f; float h = 0; for (int i = 0; i < 10; i++) { - TableRow row = new TableRow(); + STableRow row = new STableRow(); - row.Pos = GetNewText(Texts[TextPosition]); - row.Name = GetNewText(Texts[TextPlayerName]); - row.Rounds = GetNewText(Texts[TextNumPlayed]); - row.Won = GetNewText(Texts[TextWon]); - row.SingPoints = GetNewText(Texts[TextSingPoints]); - row.GamePoints = GetNewText(Texts[TextGamePoints]); + row.Pos = GetNewText(Texts[_TextPosition]); + row.Name = GetNewText(Texts[_TextPlayerName]); + row.Rounds = GetNewText(Texts[_TextNumPlayed]); + row.Won = GetNewText(Texts[_TextWon]); + row.SingPoints = GetNewText(Texts[_TextSingPoints]); + row.GamePoints = GetNewText(Texts[_TextGamePoints]); row.Pos.Y += delta * (i + 1); row.Name.Y += delta * (i + 1); @@ -559,22 +559,22 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley AddText(row.SingPoints); AddText(row.GamePoints); - PlayerTable.Add(row); + _PlayerTable.Add(row); h = delta * (i + 1); } - PlayerTableScrollArea.H = h + delta; + _PlayerTableScrollArea.H = h + delta; } - private void UpdatePlayerTable() + private void _UpdatePlayerTable() { SProfile[] profiles = CBase.Profiles.GetProfiles(); - for (int i = 0; i < PlayerTable.Count; i++) + for (int i = 0; i < _PlayerTable.Count; i++) { - TableRow row = PlayerTable[i]; + STableRow row = _PlayerTable[i]; - if (i + PlayerTableOffset < GameState.ResultTable.Count) + if (i + _PlayerTableOffset < _GameState.ResultTable.Count) { row.Pos.Visible = true; row.Name.Visible = true; @@ -583,12 +583,12 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley row.SingPoints.Visible = true; row.GamePoints.Visible = true; - row.Pos.Text = GameState.ResultTable[i + PlayerTableOffset].Position.ToString() + "."; - row.Name.Text = profiles[GameState.ResultTable[i + PlayerTableOffset].PlayerID].PlayerName; - row.Rounds.Text = GameState.ResultTable[i + PlayerTableOffset].NumRounds.ToString(); - row.Won.Text = GameState.ResultTable[i + PlayerTableOffset].NumWon.ToString(); - row.SingPoints.Text = GameState.ResultTable[i + PlayerTableOffset].NumSingPoints.ToString(); - row.GamePoints.Text = GameState.ResultTable[i + PlayerTableOffset].NumGamePoints.ToString(); + row.Pos.Text = _GameState.ResultTable[i + _PlayerTableOffset].Position.ToString() + "."; + row.Name.Text = profiles[_GameState.ResultTable[i + _PlayerTableOffset].PlayerID].PlayerName; + row.Rounds.Text = _GameState.ResultTable[i + _PlayerTableOffset].NumRounds.ToString(); + row.Won.Text = _GameState.ResultTable[i + _PlayerTableOffset].NumWon.ToString(); + row.SingPoints.Text = _GameState.ResultTable[i + _PlayerTableOffset].NumSingPoints.ToString(); + row.GamePoints.Text = _GameState.ResultTable[i + _PlayerTableOffset].NumGamePoints.ToString(); } else { @@ -601,54 +601,54 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley } } - Buttons[ButtonPlayerScrollUp].Visible = PlayerTableOffset > 0; - Buttons[ButtonPlayerScrollDown].Visible = GameState.ProfileIDs.Count - NumPlayerVisible - PlayerTableOffset > 0; + Buttons[_ButtonPlayerScrollUp].Visible = _PlayerTableOffset > 0; + Buttons[_ButtonPlayerScrollDown].Visible = _GameState.ProfileIDs.Count - _NumPlayerVisible - _PlayerTableOffset > 0; } - private void ScrollPlayerTable(int Offset) + private void _ScrollPlayerTable(int offset) { - if (GameState.ProfileIDs.Count <= NumPlayerVisible) - PlayerTableOffset = 0; - else if (Offset < 0 && PlayerTableOffset + Offset >= 0) - PlayerTableOffset += Offset; - else if (Offset < 0 && PlayerTableOffset + Offset < 0) - PlayerTableOffset = 0; - else if (Offset > 0 && PlayerTableOffset + Offset <= GameState.ProfileIDs.Count - NumPlayerVisible) - PlayerTableOffset += Offset; - else if (Offset > 0 && PlayerTableOffset + Offset > GameState.ProfileIDs.Count - NumPlayerVisible) - PlayerTableOffset = GameState.ProfileIDs.Count - NumPlayerVisible; + if (_GameState.ProfileIDs.Count <= _NumPlayerVisible) + _PlayerTableOffset = 0; + else if (offset < 0 && _PlayerTableOffset + offset >= 0) + _PlayerTableOffset += offset; + else if (offset < 0 && _PlayerTableOffset + offset < 0) + _PlayerTableOffset = 0; + else if (offset > 0 && _PlayerTableOffset + offset <= _GameState.ProfileIDs.Count - _NumPlayerVisible) + _PlayerTableOffset += offset; + else if (offset > 0 && _PlayerTableOffset + offset > _GameState.ProfileIDs.Count - _NumPlayerVisible) + _PlayerTableOffset = _GameState.ProfileIDs.Count - _NumPlayerVisible; - UpdatePlayerTable(); + _UpdatePlayerTable(); } - private void ScrollRoundsTable(int Offset) + private void _ScrollRoundsTable(int offset) { - if (GameState.Combs.Count <= NumRoundsVisible) - RoundsTableOffset = 0; - else if (Offset < 0 && RoundsTableOffset + Offset >= 0) - RoundsTableOffset += Offset; - else if (Offset < 0 && RoundsTableOffset + Offset < 0) - RoundsTableOffset = 0; - else if (Offset > 0 && RoundsTableOffset + Offset <= GameState.Combs.Count - NumRoundsVisible) - RoundsTableOffset += Offset; - else if (Offset > 0 && RoundsTableOffset + Offset > GameState.Combs.Count - NumRoundsVisible) - RoundsTableOffset = GameState.Combs.Count - NumRoundsVisible; + if (_GameState.Combs.Count <= _NumRoundsVisible) + _RoundsTableOffset = 0; + else if (offset < 0 && _RoundsTableOffset + offset >= 0) + _RoundsTableOffset += offset; + else if (offset < 0 && _RoundsTableOffset + offset < 0) + _RoundsTableOffset = 0; + else if (offset > 0 && _RoundsTableOffset + offset <= _GameState.Combs.Count - _NumRoundsVisible) + _RoundsTableOffset += offset; + else if (offset > 0 && _RoundsTableOffset + offset > _GameState.Combs.Count - _NumRoundsVisible) + _RoundsTableOffset = _GameState.Combs.Count - _NumRoundsVisible; - UpdateRoundsTable(); + _UpdateRoundsTable(); } - private string GetPlayerWinString() + private string _GetPlayerWinString() { string s = ""; SProfile[] profiles = CBase.Profiles.GetProfiles(); - for (int i = 0; i < GameState.ResultTable.Count; i++) + for (int i = 0; i < _GameState.ResultTable.Count; i++) { - if (GameState.ResultTable[i].Position == 1) + if (_GameState.ResultTable[i].Position == 1) { if (i > 0) s += ", "; - s += profiles[GameState.ResultTable[i].PlayerID].PlayerName; + s += profiles[_GameState.ResultTable[i].PlayerID].PlayerName; } else break; diff --git a/PartyModes/PartyModeChallengeMedley/PartyScreenChallengeMedleyNames.cs b/PartyModes/PartyModeChallengeMedley/PartyScreenChallengeMedleyNames.cs index e2f24897..45626757 100644 --- a/PartyModes/PartyModeChallengeMedley/PartyScreenChallengeMedleyNames.cs +++ b/PartyModes/PartyModeChallengeMedley/PartyScreenChallengeMedleyNames.cs @@ -5,7 +5,7 @@ using VocaluxeLib.Menu; namespace VocaluxeLib.PartyModes.ChallengeMedley { - public class PartyScreenChallengeMedleyNames : CMenuParty + public class CPartyScreenChallengeMedleyNames : CMenuParty { // Version number for theme files. Increment it, if you've changed something on the theme files! protected override int _ScreenVersion @@ -13,40 +13,40 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley get { return 1; } } - private const string ButtonNext = "ButtonNext"; - private const string ButtonBack = "ButtonBack"; - private const string ButtonPlayerDestination = "ButtonPlayerDestination"; - private const string ButtonPlayerChoose = "ButtonPlayerChoose"; + private const string _ButtonNext = "ButtonNext"; + private const string _ButtonBack = "ButtonBack"; + private const string _ButtonPlayerDestination = "ButtonPlayerDestination"; + private const string _ButtonPlayerChoose = "ButtonPlayerChoose"; - private List PlayerChooseButtons; - private List PlayerDestinationButtons; + private List _PlayerChooseButtons; + private List _PlayerDestinationButtons; //PlayerDestinationButtons-Option - private const int PlayerDestinationButtonsNumH = 3; - private const int PlayerDestinationButtonsNumW = 4; - private const int PlayerDestinationButtonsFirstX = 900; - private const int PlayerDestinationButtonsFirstY = 105; - private const int PlayerDestinationButtonsSpaceH = 15; - private const int PlayerDestinationButtonsSpaceW = 25; + private const int _PlayerDestinationButtonsNumH = 3; + private const int _PlayerDestinationButtonsNumW = 4; + private const int _PlayerDestinationButtonsFirstX = 900; + private const int _PlayerDestinationButtonsFirstY = 105; + private const int _PlayerDestinationButtonsSpaceH = 15; + private const int _PlayerDestinationButtonsSpaceW = 25; //PlayerChooseButtons-Option - private List PlayerChooseButtonsVisibleProfiles; - private const int PlayerChooseButtonsNumH = 7; - private const int PlayerChooseButtonsNumW = 4; - private const int PlayerChooseButtonsFirstX = 52; - private const int PlayerChooseButtonsFirstY = 105; - private const int PlayerChooseButtonsSpaceH = 15; - private const int PlayerChooseButtonsSpaceW = 25; - private int PlayerChooseButtonsOffset = 0; + private List _PlayerChooseButtonsVisibleProfiles; + private const int _PlayerChooseButtonsNumH = 7; + private const int _PlayerChooseButtonsNumW = 4; + private const int _PlayerChooseButtonsFirstX = 52; + private const int _PlayerChooseButtonsFirstY = 105; + private const int _PlayerChooseButtonsSpaceH = 15; + private const int _PlayerChooseButtonsSpaceW = 25; + private int _PlayerChooseButtonsOffset = 0; - private CStatic chooseAvatarStatic; - private bool SelectingMouseActive; - private int OldMouseX; - private int OldMouseY; - private int SelectedPlayerNr = -1; - private bool ButtonsAdded; + private CStatic _ChooseAvatarStatic; + private bool _SelectingMouseActive; + private int _OldMouseX; + private int _OldMouseY; + private int _SelectedPlayerNr = -1; + private bool _ButtonsAdded; - private int NumPlayer = 4; + private int _NumPlayer = 4; - private DataFromScreen Data; + private SDataFromScreen _Data; private class CPlayerChooseButton { @@ -58,39 +58,39 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley { base.Init(); - chooseAvatarStatic = GetNewStatic(); - chooseAvatarStatic.Visible = false; + _ChooseAvatarStatic = GetNewStatic(); + _ChooseAvatarStatic.Visible = false; - PlayerChooseButtonsVisibleProfiles = new List(); + _PlayerChooseButtonsVisibleProfiles = new List(); - Data.ScreenNames.ProfileIDs = new List(); + _Data.ScreenNames.ProfileIDs = new List(); List buttons = new List(); - _ThemeButtons = new string[] {ButtonBack, ButtonNext, ButtonPlayerDestination, ButtonPlayerChoose}; + _ThemeButtons = new string[] {_ButtonBack, _ButtonNext, _ButtonPlayerDestination, _ButtonPlayerChoose}; - Data = new DataFromScreen(); - FromScreenNames names = new FromScreenNames(); + _Data = new SDataFromScreen(); + SFromScreenNames names = new SFromScreenNames(); names.FadeToConfig = false; names.FadeToMain = false; names.ProfileIDs = new List(); - Data.ScreenNames = names; + _Data.ScreenNames = names; } - public override void DataToScreen(object ReceivedData) + public override void DataToScreen(object receivedData) { - DataToScreenNames config = new DataToScreenNames(); + SDataToScreenNames config = new SDataToScreenNames(); try { - config = (DataToScreenNames)ReceivedData; - Data.ScreenNames.ProfileIDs = config.ProfileIDs; - if (Data.ScreenNames.ProfileIDs == null) - Data.ScreenNames.ProfileIDs = new List(); + config = (SDataToScreenNames)receivedData; + _Data.ScreenNames.ProfileIDs = config.ProfileIDs; + if (_Data.ScreenNames.ProfileIDs == null) + _Data.ScreenNames.ProfileIDs = new List(); - NumPlayer = config.NumPlayer; + _NumPlayer = config.NumPlayer; - while (Data.ScreenNames.ProfileIDs.Count > NumPlayer) - Data.ScreenNames.ProfileIDs.RemoveAt(Data.ScreenNames.ProfileIDs.Count - 1); + while (_Data.ScreenNames.ProfileIDs.Count > _NumPlayer) + _Data.ScreenNames.ProfileIDs.RemoveAt(_Data.ScreenNames.ProfileIDs.Count - 1); } catch (Exception e) { @@ -98,7 +98,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley } } - public override bool HandleInput(KeyEvent keyEvent) + public override bool HandleInput(SKeyEvent keyEvent) { base.HandleInput(keyEvent); @@ -109,29 +109,29 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley { case Keys.Back: case Keys.Escape: - Back(); + _Back(); break; case Keys.Enter: - if (Buttons[ButtonBack].Selected) - Back(); + if (Buttons[_ButtonBack].Selected) + _Back(); - if (Buttons[ButtonNext].Selected) - Next(); + if (Buttons[_ButtonNext].Selected) + _Next(); - if (!OnAdd()) - OnRemove(); + if (!_OnAdd()) + _OnRemove(); break; case Keys.Delete: - OnRemove(); + _OnRemove(); break; } } return true; } - public override bool HandleMouse(MouseEvent mouseEvent) + public override bool HandleMouse(SMouseEvent mouseEvent) { base.HandleMouse(mouseEvent); @@ -164,74 +164,74 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley }*/ //Check if LeftButton is hold and Select-Mode active - if (mouseEvent.LBH && SelectingMouseActive) + if (mouseEvent.LBH && _SelectingMouseActive) { //Update coords for Drag/Drop-Texture - chooseAvatarStatic.Rect.X += mouseEvent.X - OldMouseX; - chooseAvatarStatic.Rect.Y += mouseEvent.Y - OldMouseY; - OldMouseX = mouseEvent.X; - OldMouseY = mouseEvent.Y; + _ChooseAvatarStatic.Rect.X += mouseEvent.X - _OldMouseX; + _ChooseAvatarStatic.Rect.Y += mouseEvent.Y - _OldMouseY; + _OldMouseX = mouseEvent.X; + _OldMouseY = mouseEvent.Y; } // LeftButton isn't hold anymore, but Selec-Mode is still active -> "Drop" of Avatar - else if (SelectingMouseActive) + else if (_SelectingMouseActive) { //Check if really a player was selected - if (SelectedPlayerNr != -1) + if (_SelectedPlayerNr != -1) { //Foreach Drop-Area - for (int i = 0; i < PlayerDestinationButtons.Count; i++) + for (int i = 0; i < _PlayerDestinationButtons.Count; i++) { //Check first, if area is "active" - if (PlayerDestinationButtons[i].Visible) + if (_PlayerDestinationButtons[i].Visible) { //Check if Mouse is in area - if (CHelper.IsInBounds(PlayerDestinationButtons[i].Rect, mouseEvent)) + if (CHelper.IsInBounds(_PlayerDestinationButtons[i].Rect, mouseEvent)) { int added = -1; //Add Player-ID to list. - if (Data.ScreenNames.ProfileIDs.Count < (i + 1)) + if (_Data.ScreenNames.ProfileIDs.Count < (i + 1)) { - Data.ScreenNames.ProfileIDs.Add(SelectedPlayerNr); - added = Data.ScreenNames.ProfileIDs.Count - 1; + _Data.ScreenNames.ProfileIDs.Add(_SelectedPlayerNr); + added = _Data.ScreenNames.ProfileIDs.Count - 1; } - else if (Data.ScreenNames.ProfileIDs.Count >= (i + 1)) + else if (_Data.ScreenNames.ProfileIDs.Count >= (i + 1)) { - Data.ScreenNames.ProfileIDs[i] = SelectedPlayerNr; + _Data.ScreenNames.ProfileIDs[i] = _SelectedPlayerNr; added = i; } - UpdateButtonNext(); + _UpdateButtonNext(); //Update texture and name - PlayerDestinationButtons[added].Color = new SColorF(1, 1, 1, 0.6f); - PlayerDestinationButtons[added].SelColor = new SColorF(1, 1, 1, 1); - PlayerDestinationButtons[added].Texture = chooseAvatarStatic.Texture; - PlayerDestinationButtons[added].SelTexture = chooseAvatarStatic.Texture; - PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetProfiles()[SelectedPlayerNr].PlayerName; + _PlayerDestinationButtons[added].Color = new SColorF(1, 1, 1, 0.6f); + _PlayerDestinationButtons[added].SelColor = new SColorF(1, 1, 1, 1); + _PlayerDestinationButtons[added].Texture = _ChooseAvatarStatic.Texture; + _PlayerDestinationButtons[added].SelTexture = _ChooseAvatarStatic.Texture; + _PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetProfiles()[_SelectedPlayerNr].PlayerName; //Update Tiles-List - UpdateButtonPlayerChoose(); + _UpdateButtonPlayerChoose(); } } } - SelectedPlayerNr = -1; + _SelectedPlayerNr = -1; } //Reset variables - SelectingMouseActive = false; - chooseAvatarStatic.Visible = false; + _SelectingMouseActive = false; + _ChooseAvatarStatic.Visible = false; } if (mouseEvent.LB && IsMouseOver(mouseEvent)) { - if (Buttons[ButtonBack].Selected) - Back(); + if (Buttons[_ButtonBack].Selected) + _Back(); - if (Buttons[ButtonNext].Selected) - Next(); + if (Buttons[_ButtonNext].Selected) + _Next(); - if (!OnAdd()) - OnRemove(); + if (!_OnAdd()) + _OnRemove(); } if (mouseEvent.RB) - Back(); + _Back(); return true; } @@ -240,17 +240,17 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley { base.OnShow(); - if (!ButtonsAdded) + if (!_ButtonsAdded) { - AddButtonPlayerDestination(); - AddButtonPlayerChoose(); - ButtonsAdded = true; + _AddButtonPlayerDestination(); + _AddButtonPlayerChoose(); + _ButtonsAdded = true; } - UpdateButtonPlayerDestination(); - UpdateButtonPlayerChoose(); + _UpdateButtonPlayerDestination(); + _UpdateButtonPlayerChoose(); - UpdateButtonNext(); + _UpdateButtonNext(); } public override bool UpdateGame() @@ -261,25 +261,25 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley public override bool Draw() { base.Draw(); - if (chooseAvatarStatic.Visible) - chooseAvatarStatic.Draw(); + if (_ChooseAvatarStatic.Visible) + _ChooseAvatarStatic.Draw(); return true; } - private void AddButtonPlayerDestination() + private void _AddButtonPlayerDestination() { - Buttons[ButtonPlayerDestination].Visible = false; - PlayerDestinationButtons = new List(); + Buttons[_ButtonPlayerDestination].Visible = false; + _PlayerDestinationButtons = new List(); int row = 0; int column = 0; for (int i = 1; i <= _PartyMode.GetMaxPlayer(); i++) { - CButton b = GetNewButton(Buttons[ButtonPlayerDestination]); - b.Rect.X = PlayerDestinationButtonsFirstX + column * (b.Rect.W + PlayerDestinationButtonsSpaceH); - b.Rect.Y = PlayerDestinationButtonsFirstY + row * (b.Rect.H + PlayerDestinationButtonsSpaceW); - PlayerDestinationButtons.Add(b); + CButton b = GetNewButton(Buttons[_ButtonPlayerDestination]); + b.Rect.X = _PlayerDestinationButtonsFirstX + column * (b.Rect.W + _PlayerDestinationButtonsSpaceH); + b.Rect.Y = _PlayerDestinationButtonsFirstY + row * (b.Rect.H + _PlayerDestinationButtonsSpaceW); + _PlayerDestinationButtons.Add(b); column++; - if (column >= PlayerDestinationButtonsNumH) + if (column >= _PlayerDestinationButtonsNumH) { row++; column = 0; @@ -290,23 +290,23 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley } } - private void AddButtonPlayerChoose() + private void _AddButtonPlayerChoose() { - Buttons[ButtonPlayerChoose].Visible = false; - PlayerChooseButtons = new List(); + Buttons[_ButtonPlayerChoose].Visible = false; + _PlayerChooseButtons = new List(); int row = 0; int column = 0; - for (int i = 1; i <= PlayerChooseButtonsNumH * PlayerChooseButtonsNumW; i++) + for (int i = 1; i <= _PlayerChooseButtonsNumH * _PlayerChooseButtonsNumW; i++) { - CButton b = GetNewButton(Buttons[ButtonPlayerChoose]); - b.Rect.X = PlayerChooseButtonsFirstX + column * (b.Rect.W + PlayerChooseButtonsSpaceH); - b.Rect.Y = PlayerChooseButtonsFirstY + row * (b.Rect.H + PlayerChooseButtonsSpaceW); + CButton b = GetNewButton(Buttons[_ButtonPlayerChoose]); + b.Rect.X = _PlayerChooseButtonsFirstX + column * (b.Rect.W + _PlayerChooseButtonsSpaceH); + b.Rect.Y = _PlayerChooseButtonsFirstY + row * (b.Rect.H + _PlayerChooseButtonsSpaceW); CPlayerChooseButton pcb = new CPlayerChooseButton(); pcb.Button = b; pcb.ProfileID = -1; - PlayerChooseButtons.Add(pcb); + _PlayerChooseButtons.Add(pcb); column++; - if (column >= PlayerChooseButtonsNumH) + if (column >= _PlayerChooseButtonsNumH) { row++; column = 0; @@ -317,53 +317,53 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley } } - private void UpdateButtonPlayerChoose() + private void _UpdateButtonPlayerChoose() { - UpdateVisibleProfiles(); - if ((PlayerChooseButtonsNumW * PlayerChooseButtonsNumH) * (PlayerChooseButtonsOffset + 1) - PlayerChooseButtonsVisibleProfiles.Count >= - (PlayerChooseButtonsNumW * PlayerChooseButtonsNumH) * PlayerChooseButtonsOffset) - UpdateButtonPlayerChoose(PlayerChooseButtonsOffset - 1); + _UpdateVisibleProfiles(); + if ((_PlayerChooseButtonsNumW * _PlayerChooseButtonsNumH) * (_PlayerChooseButtonsOffset + 1) - _PlayerChooseButtonsVisibleProfiles.Count >= + (_PlayerChooseButtonsNumW * _PlayerChooseButtonsNumH) * _PlayerChooseButtonsOffset) + _UpdateButtonPlayerChoose(_PlayerChooseButtonsOffset - 1); else - UpdateButtonPlayerChoose(PlayerChooseButtonsOffset); + _UpdateButtonPlayerChoose(_PlayerChooseButtonsOffset); } - private void UpdateButtonPlayerChoose(int Offset) + private void _UpdateButtonPlayerChoose(int offset) { - int NumButtonPlayerChoose = PlayerChooseButtonsNumW * PlayerChooseButtonsNumH; - if (Offset < 0) - Offset = 0; + int numButtonPlayerChoose = _PlayerChooseButtonsNumW * _PlayerChooseButtonsNumH; + if (offset < 0) + offset = 0; - if (NumButtonPlayerChoose * (Offset + 1) - PlayerChooseButtonsVisibleProfiles.Count <= NumButtonPlayerChoose) + if (numButtonPlayerChoose * (offset + 1) - _PlayerChooseButtonsVisibleProfiles.Count <= numButtonPlayerChoose) { - for (int i = 0; i < NumButtonPlayerChoose; i++) + for (int i = 0; i < numButtonPlayerChoose; i++) { - if ((i + Offset * NumButtonPlayerChoose) < PlayerChooseButtonsVisibleProfiles.Count) + if ((i + offset * numButtonPlayerChoose) < _PlayerChooseButtonsVisibleProfiles.Count) { - PlayerChooseButtons[i].ProfileID = PlayerChooseButtonsVisibleProfiles[i + Offset * NumButtonPlayerChoose]; - PlayerChooseButtons[i].Button.Text.Text = CBase.Profiles.GetProfiles()[PlayerChooseButtonsVisibleProfiles[i + Offset * NumButtonPlayerChoose]].PlayerName; - PlayerChooseButtons[i].Button.Texture = CBase.Profiles.GetProfiles()[PlayerChooseButtonsVisibleProfiles[i + Offset * NumButtonPlayerChoose]].Avatar.Texture; - PlayerChooseButtons[i].Button.SelTexture = CBase.Profiles.GetProfiles()[PlayerChooseButtonsVisibleProfiles[i + Offset * NumButtonPlayerChoose]].Avatar.Texture; - PlayerChooseButtons[i].Button.Color = new SColorF(1, 1, 1, 0.6f); - PlayerChooseButtons[i].Button.SelColor = new SColorF(1, 1, 1, 1); - PlayerChooseButtons[i].Button.Enabled = true; + _PlayerChooseButtons[i].ProfileID = _PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose]; + _PlayerChooseButtons[i].Button.Text.Text = CBase.Profiles.GetProfiles()[_PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose]].PlayerName; + _PlayerChooseButtons[i].Button.Texture = CBase.Profiles.GetProfiles()[_PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose]].Avatar.Texture; + _PlayerChooseButtons[i].Button.SelTexture = CBase.Profiles.GetProfiles()[_PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose]].Avatar.Texture; + _PlayerChooseButtons[i].Button.Color = new SColorF(1, 1, 1, 0.6f); + _PlayerChooseButtons[i].Button.SelColor = new SColorF(1, 1, 1, 1); + _PlayerChooseButtons[i].Button.Enabled = true; } else { - PlayerChooseButtons[i].ProfileID = -1; - PlayerChooseButtons[i].Button.Text.Text = String.Empty; - PlayerChooseButtons[i].Button.Texture = Buttons[ButtonPlayerChoose].Texture; - PlayerChooseButtons[i].Button.SelTexture = Buttons[ButtonPlayerChoose].SelTexture; - PlayerChooseButtons[i].Button.Color = Buttons[ButtonPlayerChoose].Color; - PlayerChooseButtons[i].Button.SelColor = Buttons[ButtonPlayerChoose].SelColor; - PlayerChooseButtons[i].Button.Enabled = false; + _PlayerChooseButtons[i].ProfileID = -1; + _PlayerChooseButtons[i].Button.Text.Text = String.Empty; + _PlayerChooseButtons[i].Button.Texture = Buttons[_ButtonPlayerChoose].Texture; + _PlayerChooseButtons[i].Button.SelTexture = Buttons[_ButtonPlayerChoose].SelTexture; + _PlayerChooseButtons[i].Button.Color = Buttons[_ButtonPlayerChoose].Color; + _PlayerChooseButtons[i].Button.SelColor = Buttons[_ButtonPlayerChoose].SelColor; + _PlayerChooseButtons[i].Button.Enabled = false; } } } } - private void UpdateVisibleProfiles() + private void _UpdateVisibleProfiles() { - PlayerChooseButtonsVisibleProfiles.Clear(); + _PlayerChooseButtonsVisibleProfiles.Clear(); for (int i = 0; i < CBase.Profiles.GetProfiles().Length; i++) { bool visible = false; @@ -372,10 +372,10 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley { visible = true; - for (int p = 0; p < Data.ScreenNames.ProfileIDs.Count; p++) + for (int p = 0; p < _Data.ScreenNames.ProfileIDs.Count; p++) { //Don't show profile if is selected - if (Data.ScreenNames.ProfileIDs[p] == i) + if (_Data.ScreenNames.ProfileIDs[p] == i) { visible = false; break; @@ -383,82 +383,82 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley } } if (visible) - PlayerChooseButtonsVisibleProfiles.Add(i); + _PlayerChooseButtonsVisibleProfiles.Add(i); } } - private void UpdateButtonPlayerDestination() + private void _UpdateButtonPlayerDestination() { - for (int i = 0; i < PlayerDestinationButtons.Count; i++) + for (int i = 0; i < _PlayerDestinationButtons.Count; i++) { - if (NumPlayer > i) + if (_NumPlayer > i) { - PlayerDestinationButtons[i].Visible = true; - PlayerDestinationButtons[i].Enabled = true; + _PlayerDestinationButtons[i].Visible = true; + _PlayerDestinationButtons[i].Enabled = true; } else { - PlayerDestinationButtons[i].Visible = false; - PlayerDestinationButtons[i].Enabled = false; + _PlayerDestinationButtons[i].Visible = false; + _PlayerDestinationButtons[i].Enabled = false; } } - for (int i = 0; i < NumPlayer; i++) + for (int i = 0; i < _NumPlayer; i++) { - if (i < Data.ScreenNames.ProfileIDs.Count) + if (i < _Data.ScreenNames.ProfileIDs.Count) { - if (Data.ScreenNames.ProfileIDs[i] != -1) + if (_Data.ScreenNames.ProfileIDs[i] != -1) { - PlayerDestinationButtons[i].Color = new SColorF(1, 1, 1, 0.6f); - PlayerDestinationButtons[i].SelColor = new SColorF(1, 1, 1, 1); - PlayerDestinationButtons[i].Texture = CBase.Profiles.GetProfiles()[Data.ScreenNames.ProfileIDs[i]].Avatar.Texture; - PlayerDestinationButtons[i].SelTexture = CBase.Profiles.GetProfiles()[Data.ScreenNames.ProfileIDs[i]].Avatar.Texture; - PlayerDestinationButtons[i].Text.Text = CBase.Profiles.GetProfiles()[Data.ScreenNames.ProfileIDs[i]].PlayerName; - PlayerDestinationButtons[i].Enabled = true; + _PlayerDestinationButtons[i].Color = new SColorF(1, 1, 1, 0.6f); + _PlayerDestinationButtons[i].SelColor = new SColorF(1, 1, 1, 1); + _PlayerDestinationButtons[i].Texture = CBase.Profiles.GetProfiles()[_Data.ScreenNames.ProfileIDs[i]].Avatar.Texture; + _PlayerDestinationButtons[i].SelTexture = CBase.Profiles.GetProfiles()[_Data.ScreenNames.ProfileIDs[i]].Avatar.Texture; + _PlayerDestinationButtons[i].Text.Text = CBase.Profiles.GetProfiles()[_Data.ScreenNames.ProfileIDs[i]].PlayerName; + _PlayerDestinationButtons[i].Enabled = true; } } else { - PlayerDestinationButtons[i].Color = Buttons[ButtonPlayerDestination].Color; - PlayerDestinationButtons[i].SelColor = Buttons[ButtonPlayerDestination].SelColor; - PlayerDestinationButtons[i].Texture = Buttons[ButtonPlayerDestination].Texture; - PlayerDestinationButtons[i].SelTexture = Buttons[ButtonPlayerDestination].SelTexture; - PlayerDestinationButtons[i].Text.Text = String.Empty; - PlayerDestinationButtons[i].Enabled = false; + _PlayerDestinationButtons[i].Color = Buttons[_ButtonPlayerDestination].Color; + _PlayerDestinationButtons[i].SelColor = Buttons[_ButtonPlayerDestination].SelColor; + _PlayerDestinationButtons[i].Texture = Buttons[_ButtonPlayerDestination].Texture; + _PlayerDestinationButtons[i].SelTexture = Buttons[_ButtonPlayerDestination].SelTexture; + _PlayerDestinationButtons[i].Text.Text = String.Empty; + _PlayerDestinationButtons[i].Enabled = false; } } } - private void UpdateButtonNext() + private void _UpdateButtonNext() { - if (Data.ScreenNames.ProfileIDs.Count == NumPlayer) + if (_Data.ScreenNames.ProfileIDs.Count == _NumPlayer) { - Buttons[ButtonNext].Visible = true; - SetInteractionToButton(Buttons[ButtonNext]); + Buttons[_ButtonNext].Visible = true; + SetInteractionToButton(Buttons[_ButtonNext]); } else - Buttons[ButtonNext].Visible = false; + Buttons[_ButtonNext].Visible = false; } - private bool OnAdd() + private bool _OnAdd() { - for (int i = 0; i < PlayerChooseButtons.Count; i++) + for (int i = 0; i < _PlayerChooseButtons.Count; i++) { - if (PlayerChooseButtons[i].Button.Selected && PlayerChooseButtons[i].ProfileID != -1) + if (_PlayerChooseButtons[i].Button.Selected && _PlayerChooseButtons[i].ProfileID != -1) { - if (Data.ScreenNames.ProfileIDs.Count < NumPlayer) + if (_Data.ScreenNames.ProfileIDs.Count < _NumPlayer) { - Data.ScreenNames.ProfileIDs.Add(PlayerChooseButtons[i].ProfileID); - int added = Data.ScreenNames.ProfileIDs.Count - 1; - UpdateButtonNext(); + _Data.ScreenNames.ProfileIDs.Add(_PlayerChooseButtons[i].ProfileID); + int added = _Data.ScreenNames.ProfileIDs.Count - 1; + _UpdateButtonNext(); //Update texture and name - PlayerDestinationButtons[added].Color = new SColorF(1, 1, 1, 0.6f); - PlayerDestinationButtons[added].SelColor = new SColorF(1, 1, 1, 1); - PlayerDestinationButtons[added].Texture = CBase.Profiles.GetProfiles()[PlayerChooseButtons[i].ProfileID].Avatar.Texture; - PlayerDestinationButtons[added].SelTexture = CBase.Profiles.GetProfiles()[PlayerChooseButtons[i].ProfileID].Avatar.Texture; - PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetProfiles()[PlayerChooseButtons[i].ProfileID].PlayerName; - PlayerDestinationButtons[added].Enabled = true; + _PlayerDestinationButtons[added].Color = new SColorF(1, 1, 1, 0.6f); + _PlayerDestinationButtons[added].SelColor = new SColorF(1, 1, 1, 1); + _PlayerDestinationButtons[added].Texture = CBase.Profiles.GetProfiles()[_PlayerChooseButtons[i].ProfileID].Avatar.Texture; + _PlayerDestinationButtons[added].SelTexture = CBase.Profiles.GetProfiles()[_PlayerChooseButtons[i].ProfileID].Avatar.Texture; + _PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetProfiles()[_PlayerChooseButtons[i].ProfileID].PlayerName; + _PlayerDestinationButtons[added].Enabled = true; //Update Tiles-List - UpdateButtonPlayerChoose(); + _UpdateButtonPlayerChoose(); CheckInteraction(); return true; } @@ -467,18 +467,18 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley return false; } - private bool OnRemove() + private bool _OnRemove() { - for (int i = 0; i < PlayerDestinationButtons.Count; i++) + for (int i = 0; i < _PlayerDestinationButtons.Count; i++) { - if (PlayerDestinationButtons[i].Selected) + if (_PlayerDestinationButtons[i].Selected) { - if ((i + 1) <= Data.ScreenNames.ProfileIDs.Count) + if ((i + 1) <= _Data.ScreenNames.ProfileIDs.Count) { - Data.ScreenNames.ProfileIDs.RemoveAt(i); - UpdateButtonNext(); - UpdateButtonPlayerDestination(); - UpdateButtonPlayerChoose(); + _Data.ScreenNames.ProfileIDs.RemoveAt(i); + _UpdateButtonNext(); + _UpdateButtonPlayerDestination(); + _UpdateButtonPlayerChoose(); CheckInteraction(); return true; } @@ -487,18 +487,18 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley return false; } - private void Back() + private void _Back() { - Data.ScreenNames.FadeToConfig = true; - Data.ScreenNames.FadeToMain = false; - _PartyMode.DataFromScreen(ThemeName, Data); + _Data.ScreenNames.FadeToConfig = true; + _Data.ScreenNames.FadeToMain = false; + _PartyMode.DataFromScreen(ThemeName, _Data); } - private void Next() + private void _Next() { - Data.ScreenNames.FadeToConfig = false; - Data.ScreenNames.FadeToMain = true; - _PartyMode.DataFromScreen(ThemeName, Data); + _Data.ScreenNames.FadeToConfig = false; + _Data.ScreenNames.FadeToMain = true; + _PartyMode.DataFromScreen(ThemeName, _Data); } } } \ No newline at end of file diff --git a/PartyModes/PartyModeTicTacToe/PartyModeTicTacToe.cs b/PartyModes/PartyModeTicTacToe/PartyModeTicTacToe.cs index b8a42fcd..f541c242 100644 --- a/PartyModes/PartyModeTicTacToe/PartyModeTicTacToe.cs +++ b/PartyModes/PartyModeTicTacToe/PartyModeTicTacToe.cs @@ -9,19 +9,23 @@ namespace VocaluxeLib.PartyModes.TicTacToe { public enum ESongSource { + // ReSharper disable InconsistentNaming TR_ALLSONGS, TR_CATEGORY, TR_PLAYLIST + // ReSharper restore InconsistentNaming } public enum EPartyGameMode { + // ReSharper disable InconsistentNaming TR_GAMEMODE_NORMAL, TR_GAMEMODE_SHORTSONG, TR_GAMEMODE_DUET + // ReSharper restore InconsistentNaming } - public class Round + public class CRound { public int SongID; public int SingerTeam1; @@ -35,7 +39,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe #region Communication #region ToScreen - public struct DataToScreenConfig + public struct SDataToScreenConfig { public int NumPlayerTeam1; public int NumPlayerTeam2; @@ -46,7 +50,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe public EPartyGameMode GameMode; } - public struct DataToScreenNames + public struct SDataToScreenNames { public int NumPlayerTeam1; public int NumPlayerTeam2; @@ -54,14 +58,14 @@ namespace VocaluxeLib.PartyModes.TicTacToe public List ProfileIDsTeam2; } - public struct DataToScreenMain + public struct SDataToScreenMain { public int CurrentRoundNr; public int Team; public int NumPlayerTeam1; public int NumPlayerTeam2; public int NumFields; - public List Rounds; + public List Rounds; public List Songs; public List ProfileIDsTeam1; public List ProfileIDsTeam2; @@ -71,14 +75,14 @@ namespace VocaluxeLib.PartyModes.TicTacToe public int[] NumJokerRetry; } - public struct DataFromScreen + public struct SDataFromScreen { - public FromScreenConfig ScreenConfig; - public FromScreenNames ScreenNames; - public FromScreenMain ScreenMain; + public SFromScreenConfig ScreenConfig; + public SFromScreenNames ScreenNames; + public SFromScreenMain ScreenMain; } - public struct FromScreenConfig + public struct SFromScreenConfig { public int NumPlayerTeam1; public int NumPlayerTeam2; @@ -89,7 +93,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe public EPartyGameMode GameMode; } - public struct FromScreenNames + public struct SFromScreenNames { public bool FadeToConfig; public bool FadeToMain; @@ -97,13 +101,13 @@ namespace VocaluxeLib.PartyModes.TicTacToe public List ProfileIDsTeam2; } - public struct FromScreenMain + public struct SFromScreenMain { public bool FadeToSinging; public bool FadeToNameSelection; public List PlayerTeam1; public List PlayerTeam2; - public List Rounds; + public List Rounds; public int SingRoundNr; public List Songs; } @@ -111,13 +115,13 @@ namespace VocaluxeLib.PartyModes.TicTacToe #endregion Communication - public sealed class PartyModeTicTacToe : CPartyMode + public sealed class CPartyModeTicTacToe : CPartyMode { - private const int MaxPlayer = 20; - private const int MinPlayer = 2; - private const int MaxTeams = 2; - private const int MinTeams = 2; - private const int NumFields = 9; + private const int _MaxPlayer = 20; + private const int _MinPlayer = 2; + private const int _MaxTeams = 2; + private const int _MinTeams = 2; + private const int _NumFields = 9; private enum EStage { @@ -128,7 +132,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe Singing } - private struct Data + private struct SData { public int NumPlayerTeam1; public int NumPlayerTeam2; @@ -145,7 +149,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe public EPartyGameMode GameMode; - public List Rounds; + public List Rounds; public List Songs; public int CurrentRoundNr; @@ -155,14 +159,14 @@ namespace VocaluxeLib.PartyModes.TicTacToe public int[] NumJokerRetry; } - private DataToScreenConfig ToScreenConfig; - private DataToScreenNames ToScreenNames; - private DataToScreenMain ToScreenMain; + private SDataToScreenConfig _ToScreenConfig; + private SDataToScreenNames _ToScreenNames; + private SDataToScreenMain _ToScreenMain; - private Data GameData; + private SData _GameData; private EStage _Stage; - public PartyModeTicTacToe() + public CPartyModeTicTacToe() { _ScreenSongOptions.Selection.RandomOnly = false; _ScreenSongOptions.Selection.PartyMode = true; @@ -176,28 +180,28 @@ namespace VocaluxeLib.PartyModes.TicTacToe _Stage = EStage.NotStarted; - ToScreenConfig = new DataToScreenConfig(); - ToScreenNames = new DataToScreenNames(); - ToScreenMain = new DataToScreenMain(); + _ToScreenConfig = new SDataToScreenConfig(); + _ToScreenNames = new SDataToScreenNames(); + _ToScreenMain = new SDataToScreenMain(); - GameData = new Data(); - GameData.NumFields = 9; - GameData.NumPlayerTeam1 = 2; - GameData.NumPlayerTeam2 = 2; - GameData.ProfileIDsTeam1 = new List(); - GameData.ProfileIDsTeam2 = new List(); - GameData.PlayerTeam1 = new List(); - GameData.PlayerTeam2 = new List(); - GameData.CurrentRoundNr = 0; - GameData.SingRoundNr = 0; - GameData.SongSource = ESongSource.TR_ALLSONGS; - GameData.PlaylistID = 0; - GameData.CategoryID = 0; - GameData.GameMode = EPartyGameMode.TR_GAMEMODE_NORMAL; - GameData.Rounds = new List(); - GameData.Songs = new List(); - GameData.NumJokerRandom = new int[2]; - GameData.NumJokerRetry = new int[2]; + _GameData = new SData(); + _GameData.NumFields = 9; + _GameData.NumPlayerTeam1 = 2; + _GameData.NumPlayerTeam2 = 2; + _GameData.ProfileIDsTeam1 = new List(); + _GameData.ProfileIDsTeam2 = new List(); + _GameData.PlayerTeam1 = new List(); + _GameData.PlayerTeam2 = new List(); + _GameData.CurrentRoundNr = 0; + _GameData.SingRoundNr = 0; + _GameData.SongSource = ESongSource.TR_ALLSONGS; + _GameData.PlaylistID = 0; + _GameData.CategoryID = 0; + _GameData.GameMode = EPartyGameMode.TR_GAMEMODE_NORMAL; + _GameData.Rounds = new List(); + _GameData.Songs = new List(); + _GameData.NumJokerRandom = new int[2]; + _GameData.NumJokerRetry = new int[2]; } public override bool Init() @@ -212,58 +216,58 @@ namespace VocaluxeLib.PartyModes.TicTacToe if (CBase.Config.GetTabs() == EOffOn.TR_CONFIG_ON && _ScreenSongOptions.Sorting.SongSorting != ESongSorting.TR_CONFIG_NONE) _ScreenSongOptions.Sorting.Tabs = EOffOn.TR_CONFIG_ON; - ToScreenMain.Rounds = new List(); - ToScreenMain.Songs = new List(); - ToScreenMain.PlayerTeam1 = new List(); - ToScreenMain.PlayerTeam2 = new List(); - GameData.Songs = new List(); - GameData.Rounds = new List(); - GameData.PlayerTeam1 = new List(); - GameData.PlayerTeam2 = new List(); + _ToScreenMain.Rounds = new List(); + _ToScreenMain.Songs = new List(); + _ToScreenMain.PlayerTeam1 = new List(); + _ToScreenMain.PlayerTeam2 = new List(); + _GameData.Songs = new List(); + _GameData.Rounds = new List(); + _GameData.PlayerTeam1 = new List(); + _GameData.PlayerTeam2 = new List(); return true; } - public override void DataFromScreen(string ScreenName, Object Data) + public override void DataFromScreen(string screenName, Object data) { - DataFromScreen dataFrom = new DataFromScreen(); - switch (ScreenName) + SDataFromScreen dataFrom = new SDataFromScreen(); + switch (screenName) { case "PartyScreenTicTacToeConfig": try { - dataFrom = (DataFromScreen)Data; - GameData.NumPlayerTeam1 = dataFrom.ScreenConfig.NumPlayerTeam1; - GameData.NumPlayerTeam2 = dataFrom.ScreenConfig.NumPlayerTeam2; - GameData.NumFields = dataFrom.ScreenConfig.NumFields; - GameData.SongSource = dataFrom.ScreenConfig.SongSource; - GameData.CategoryID = dataFrom.ScreenConfig.CategoryID; - GameData.PlaylistID = dataFrom.ScreenConfig.PlaylistID; - GameData.GameMode = dataFrom.ScreenConfig.GameMode; + dataFrom = (SDataFromScreen)data; + _GameData.NumPlayerTeam1 = dataFrom.ScreenConfig.NumPlayerTeam1; + _GameData.NumPlayerTeam2 = dataFrom.ScreenConfig.NumPlayerTeam2; + _GameData.NumFields = dataFrom.ScreenConfig.NumFields; + _GameData.SongSource = dataFrom.ScreenConfig.SongSource; + _GameData.CategoryID = dataFrom.ScreenConfig.CategoryID; + _GameData.PlaylistID = dataFrom.ScreenConfig.PlaylistID; + _GameData.GameMode = dataFrom.ScreenConfig.GameMode; _Stage = EStage.Config; CBase.Graphics.FadeTo(EScreens.ScreenPartyDummy); } catch (Exception e) { - CBase.Log.LogError("Error in party mode TicTacToe. Can't cast received data from screen " + ScreenName + ". " + e.Message); + CBase.Log.LogError("Error in party mode TicTacToe. Can't cast received data from screen " + screenName + ". " + e.Message); } break; case "PartyScreenTicTacToeNames": try { - dataFrom = (DataFromScreen)Data; + dataFrom = (SDataFromScreen)data; if (dataFrom.ScreenNames.FadeToConfig) _Stage = EStage.NotStarted; else { if (CBase.Game.GetRandom(100) < 50) - GameData.Team = 0; + _GameData.Team = 0; else - GameData.Team = 1; - GameData.ProfileIDsTeam1 = dataFrom.ScreenNames.ProfileIDsTeam1; - GameData.ProfileIDsTeam2 = dataFrom.ScreenNames.ProfileIDsTeam2; + _GameData.Team = 1; + _GameData.ProfileIDsTeam1 = dataFrom.ScreenNames.ProfileIDsTeam1; + _GameData.ProfileIDsTeam2 = dataFrom.ScreenNames.ProfileIDsTeam2; _Stage = EStage.Names; } @@ -271,40 +275,40 @@ namespace VocaluxeLib.PartyModes.TicTacToe } catch (Exception e) { - CBase.Log.LogError("Error in party mode TicTacToe. Can't cast received data from screen " + ScreenName + ". " + e.Message); + CBase.Log.LogError("Error in party mode TicTacToe. Can't cast received data from screen " + screenName + ". " + e.Message); } break; case "PartyScreenTicTacToeMain": try { - dataFrom = (DataFromScreen)Data; + dataFrom = (SDataFromScreen)data; if (dataFrom.ScreenMain.FadeToSinging) { _Stage = EStage.Singing; - GameData.Rounds = dataFrom.ScreenMain.Rounds; - GameData.SingRoundNr = dataFrom.ScreenMain.SingRoundNr; - GameData.Songs = dataFrom.ScreenMain.Songs; - GameData.PlayerTeam1 = dataFrom.ScreenMain.PlayerTeam1; - GameData.PlayerTeam2 = dataFrom.ScreenMain.PlayerTeam2; + _GameData.Rounds = dataFrom.ScreenMain.Rounds; + _GameData.SingRoundNr = dataFrom.ScreenMain.SingRoundNr; + _GameData.Songs = dataFrom.ScreenMain.Songs; + _GameData.PlayerTeam1 = dataFrom.ScreenMain.PlayerTeam1; + _GameData.PlayerTeam2 = dataFrom.ScreenMain.PlayerTeam2; } if (dataFrom.ScreenMain.FadeToNameSelection) _Stage = EStage.Config; } catch (Exception e) { - CBase.Log.LogError("Error in party mode TicTacToe. Can't cast received data from screen " + ScreenName + ". " + e.Message); + CBase.Log.LogError("Error in party mode TicTacToe. Can't cast received data from screen " + screenName + ". " + e.Message); } if (_Stage == EStage.Singing) - StartRound(dataFrom.ScreenMain.SingRoundNr); + _StartRound(dataFrom.ScreenMain.SingRoundNr); if (_Stage == EStage.Config) CBase.Graphics.FadeTo(EScreens.ScreenPartyDummy); break; default: - CBase.Log.LogError("Error in party mode TicTacToe. Wrong screen is sending: " + ScreenName); + CBase.Log.LogError("Error in party mode TicTacToe. Wrong screen is sending: " + screenName); break; } } @@ -318,100 +322,100 @@ namespace VocaluxeLib.PartyModes.TicTacToe _ScreenSongOptions.Selection.RandomOnly = false;*/ } - public override CMenuParty GetNextPartyScreen(out EScreens AlternativeScreen) + public override CMenuParty GetNextPartyScreen(out EScreens alternativeScreen) { - CMenuParty Screen = null; - AlternativeScreen = EScreens.ScreenSong; + CMenuParty screen = null; + alternativeScreen = EScreens.ScreenSong; switch (_Stage) { case EStage.NotStarted: - _Screens.TryGetValue("PartyScreenTicTacToeConfig", out Screen); + _Screens.TryGetValue("PartyScreenTicTacToeConfig", out screen); if (_Screens != null) { - ToScreenConfig.NumPlayerTeam1 = GameData.NumPlayerTeam1; - ToScreenConfig.NumPlayerTeam2 = GameData.NumPlayerTeam2; - ToScreenConfig.NumFields = GameData.NumFields; - ToScreenConfig.SongSource = GameData.SongSource; - ToScreenConfig.CategoryID = GameData.CategoryID; - ToScreenConfig.PlaylistID = GameData.PlaylistID; - ToScreenConfig.GameMode = GameData.GameMode; - Screen.DataToScreen(ToScreenConfig); + _ToScreenConfig.NumPlayerTeam1 = _GameData.NumPlayerTeam1; + _ToScreenConfig.NumPlayerTeam2 = _GameData.NumPlayerTeam2; + _ToScreenConfig.NumFields = _GameData.NumFields; + _ToScreenConfig.SongSource = _GameData.SongSource; + _ToScreenConfig.CategoryID = _GameData.CategoryID; + _ToScreenConfig.PlaylistID = _GameData.PlaylistID; + _ToScreenConfig.GameMode = _GameData.GameMode; + screen.DataToScreen(_ToScreenConfig); } break; case EStage.Config: - _Screens.TryGetValue("PartyScreenTicTacToeNames", out Screen); + _Screens.TryGetValue("PartyScreenTicTacToeNames", out screen); if (_Screens != null) { - ToScreenNames.NumPlayerTeam1 = GameData.NumPlayerTeam1; - ToScreenNames.NumPlayerTeam2 = GameData.NumPlayerTeam2; - ToScreenNames.ProfileIDsTeam1 = GameData.ProfileIDsTeam1; - ToScreenNames.ProfileIDsTeam2 = GameData.ProfileIDsTeam2; - Screen.DataToScreen(ToScreenNames); + _ToScreenNames.NumPlayerTeam1 = _GameData.NumPlayerTeam1; + _ToScreenNames.NumPlayerTeam2 = _GameData.NumPlayerTeam2; + _ToScreenNames.ProfileIDsTeam1 = _GameData.ProfileIDsTeam1; + _ToScreenNames.ProfileIDsTeam2 = _GameData.ProfileIDsTeam2; + screen.DataToScreen(_ToScreenNames); } break; case EStage.Names: - _Screens.TryGetValue("PartyScreenTicTacToeMain", out Screen); + _Screens.TryGetValue("PartyScreenTicTacToeMain", out screen); if (_Screens != null) { - if (GameData.Team == 1) - GameData.Team = 0; + if (_GameData.Team == 1) + _GameData.Team = 0; else - GameData.Team = 1; + _GameData.Team = 1; CBase.Songs.ResetPartySongSung(); - GameData.CurrentRoundNr = 1; - ToScreenMain.CurrentRoundNr = 1; - ToScreenMain.NumPlayerTeam1 = GameData.NumPlayerTeam1; - ToScreenMain.NumPlayerTeam2 = GameData.NumPlayerTeam2; - ToScreenMain.NumFields = GameData.NumFields; - ToScreenMain.ProfileIDsTeam1 = GameData.ProfileIDsTeam1; - ToScreenMain.ProfileIDsTeam2 = GameData.ProfileIDsTeam2; - CreateRounds(); - SetNumJokers(); - PreparePlayerList(0); - PrepareSongList(); - ToScreenMain.Rounds = GameData.Rounds; - ToScreenMain.Songs = GameData.Songs; - ToScreenMain.PlayerTeam1 = GameData.PlayerTeam1; - ToScreenMain.PlayerTeam1 = GameData.PlayerTeam2; - ToScreenMain.NumJokerRandom = GameData.NumJokerRandom; - ToScreenMain.NumJokerRetry = GameData.NumJokerRetry; - ToScreenMain.Team = GameData.Team; - Screen.DataToScreen(ToScreenMain); + _GameData.CurrentRoundNr = 1; + _ToScreenMain.CurrentRoundNr = 1; + _ToScreenMain.NumPlayerTeam1 = _GameData.NumPlayerTeam1; + _ToScreenMain.NumPlayerTeam2 = _GameData.NumPlayerTeam2; + _ToScreenMain.NumFields = _GameData.NumFields; + _ToScreenMain.ProfileIDsTeam1 = _GameData.ProfileIDsTeam1; + _ToScreenMain.ProfileIDsTeam2 = _GameData.ProfileIDsTeam2; + _CreateRounds(); + _SetNumJokers(); + _PreparePlayerList(0); + _PrepareSongList(); + _ToScreenMain.Rounds = _GameData.Rounds; + _ToScreenMain.Songs = _GameData.Songs; + _ToScreenMain.PlayerTeam1 = _GameData.PlayerTeam1; + _ToScreenMain.PlayerTeam1 = _GameData.PlayerTeam2; + _ToScreenMain.NumJokerRandom = _GameData.NumJokerRandom; + _ToScreenMain.NumJokerRetry = _GameData.NumJokerRetry; + _ToScreenMain.Team = _GameData.Team; + screen.DataToScreen(_ToScreenMain); } break; case EStage.Main: //nothing to do break; case EStage.Singing: - _Screens.TryGetValue("PartyScreenTicTacToeMain", out Screen); + _Screens.TryGetValue("PartyScreenTicTacToeMain", out screen); if (_Screens != null) { - if (GameData.Team == 1) - GameData.Team = 0; + if (_GameData.Team == 1) + _GameData.Team = 0; else - GameData.Team = 1; - UpdateSongList(); - UpdatePlayerList(); - ToScreenMain.CurrentRoundNr = GameData.CurrentRoundNr; - ToScreenMain.NumPlayerTeam1 = GameData.NumPlayerTeam1; - ToScreenMain.NumPlayerTeam2 = GameData.NumPlayerTeam2; - ToScreenMain.NumFields = GameData.NumFields; - ToScreenMain.ProfileIDsTeam1 = GameData.ProfileIDsTeam1; - ToScreenMain.ProfileIDsTeam2 = GameData.ProfileIDsTeam2; - ToScreenMain.Rounds = GameData.Rounds; - ToScreenMain.Songs = GameData.Songs; - ToScreenMain.PlayerTeam1 = GameData.PlayerTeam1; - ToScreenMain.PlayerTeam2 = GameData.PlayerTeam2; - ToScreenMain.NumJokerRandom = GameData.NumJokerRandom; - ToScreenMain.NumJokerRetry = GameData.NumJokerRetry; - ToScreenMain.Team = GameData.Team; - Screen.DataToScreen(ToScreenMain); + _GameData.Team = 1; + _UpdateSongList(); + _UpdatePlayerList(); + _ToScreenMain.CurrentRoundNr = _GameData.CurrentRoundNr; + _ToScreenMain.NumPlayerTeam1 = _GameData.NumPlayerTeam1; + _ToScreenMain.NumPlayerTeam2 = _GameData.NumPlayerTeam2; + _ToScreenMain.NumFields = _GameData.NumFields; + _ToScreenMain.ProfileIDsTeam1 = _GameData.ProfileIDsTeam1; + _ToScreenMain.ProfileIDsTeam2 = _GameData.ProfileIDsTeam2; + _ToScreenMain.Rounds = _GameData.Rounds; + _ToScreenMain.Songs = _GameData.Songs; + _ToScreenMain.PlayerTeam1 = _GameData.PlayerTeam1; + _ToScreenMain.PlayerTeam2 = _GameData.PlayerTeam2; + _ToScreenMain.NumJokerRandom = _GameData.NumJokerRandom; + _ToScreenMain.NumJokerRetry = _GameData.NumJokerRetry; + _ToScreenMain.Team = _GameData.Team; + screen.DataToScreen(_ToScreenMain); } break; } - return Screen; + return screen; } public override EScreens GetStartScreen() @@ -424,7 +428,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe return EScreens.ScreenPartyDummy; } - public override ScreenSongOptions GetScreenSongOptions() + public override SScreenSongOptions GetScreenSongOptions() { _ScreenSongOptions.Sorting.SongSorting = CBase.Config.GetSongSorting(); _ScreenSongOptions.Sorting.Tabs = CBase.Config.GetTabs(); @@ -433,54 +437,54 @@ namespace VocaluxeLib.PartyModes.TicTacToe return _ScreenSongOptions; } - public override void OnSongChange(int SongIndex, ref ScreenSongOptions ScreenSongOptions) + public override void OnSongChange(int songIndex, ref SScreenSongOptions screenSongOptions) { - ScreenSongOptions = _ScreenSongOptions; + screenSongOptions = _ScreenSongOptions; } - public override void OnCategoryChange(int CategoryIndex, ref ScreenSongOptions ScreenSongOptions) + public override void OnCategoryChange(int categoryIndex, ref SScreenSongOptions screenSongOptions) { - ScreenSongOptions = _ScreenSongOptions; + screenSongOptions = _ScreenSongOptions; } - public override void SetSearchString(string SearchString, bool Visible) + public override void SetSearchString(string searchString, bool visible) { - _ScreenSongOptions.Sorting.SearchString = SearchString; - _ScreenSongOptions.Sorting.SearchActive = Visible; + _ScreenSongOptions.Sorting.SearchString = searchString; + _ScreenSongOptions.Sorting.SearchActive = visible; } public override int GetMaxPlayer() { - return MaxPlayer; + return _MaxPlayer; } public override int GetMinPlayer() { - return MinPlayer; + return _MinPlayer; } public override int GetMaxTeams() { - return MaxTeams; + return _MaxTeams; } public override int GetMinTeams() { - return MinTeams; + return _MinTeams; } public override int GetMaxNumRounds() { - return NumFields; + return _NumFields; } - public override void JokerUsed(int TeamNr) {} + public override void JokerUsed(int teamNr) {} - public override void SongSelected(int SongID) + public override void SongSelected(int songID) { EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL; - switch (GameData.GameMode) + switch (_GameData.GameMode) { case EPartyGameMode.TR_GAMEMODE_NORMAL: gm = EGameMode.TR_GAMEMODE_NORMAL; @@ -494,131 +498,131 @@ namespace VocaluxeLib.PartyModes.TicTacToe gm = EGameMode.TR_GAMEMODE_SHORTSONG; break; } - CBase.Game.AddSong(SongID, gm); + CBase.Game.AddSong(songID, gm); - CBase.Songs.AddPartySongSung(SongID); + CBase.Songs.AddPartySongSung(songID); CBase.Graphics.FadeTo(EScreens.ScreenSing); } public override void LeavingHighscore() { - UpdateScores(); + _UpdateScores(); CBase.Graphics.FadeTo(EScreens.ScreenPartyDummy); } - private void CreateRounds() + private void _CreateRounds() { - GameData.Rounds = new List(); - for (int i = 0; i < GameData.NumFields; i++) + _GameData.Rounds = new List(); + for (int i = 0; i < _GameData.NumFields; i++) { - Round r = new Round(); - GameData.Rounds.Add(r); + CRound r = new CRound(); + _GameData.Rounds.Add(r); } } - private void PreparePlayerList(int Team) + private void _PreparePlayerList(int team) { - if (Team == 0) + if (team == 0) { - GameData.PlayerTeam1 = new List(); - GameData.PlayerTeam2 = new List(); + _GameData.PlayerTeam1 = new List(); + _GameData.PlayerTeam2 = new List(); //Prepare Player-IDs - List IDs1 = new List(); - List IDs2 = new List(); + List iDs1 = new List(); + List iDs2 = new List(); int num = 0; int random = 0; //Add IDs to team-list - while (GameData.PlayerTeam1.Count < GameData.NumFields + GameData.NumJokerRetry[0] && IDs1.Count == 0 && - GameData.PlayerTeam2.Count < GameData.NumFields + GameData.NumJokerRetry[1] && IDs2.Count == 0) + while (_GameData.PlayerTeam1.Count < _GameData.NumFields + _GameData.NumJokerRetry[0] && iDs1.Count == 0 && + _GameData.PlayerTeam2.Count < _GameData.NumFields + _GameData.NumJokerRetry[1] && iDs2.Count == 0) { - if (IDs1.Count == 0) + if (iDs1.Count == 0) { - for (int i = 0; i < GameData.NumPlayerTeam1; i++) - IDs1.Add(i); + for (int i = 0; i < _GameData.NumPlayerTeam1; i++) + iDs1.Add(i); } - if (IDs2.Count == 0) + if (iDs2.Count == 0) { - for (int i = 0; i < GameData.NumPlayerTeam2; i++) - IDs2.Add(i); + for (int i = 0; i < _GameData.NumPlayerTeam2; i++) + iDs2.Add(i); } - if (GameData.PlayerTeam1.Count < GameData.NumFields + GameData.NumJokerRetry[0]) + if (_GameData.PlayerTeam1.Count < _GameData.NumFields + _GameData.NumJokerRetry[0]) { - random = CBase.Game.GetRandom((IDs1.Count - 1) * 10); + random = CBase.Game.GetRandom((iDs1.Count - 1) * 10); num = (int)Math.Round((double)random / 10); - if (num >= IDs1.Count) - num = IDs1.Count - 1; - GameData.PlayerTeam1.Add(IDs1[num]); - IDs1.RemoveAt(num); + if (num >= iDs1.Count) + num = iDs1.Count - 1; + _GameData.PlayerTeam1.Add(iDs1[num]); + iDs1.RemoveAt(num); } - if (GameData.PlayerTeam2.Count < GameData.NumFields + GameData.NumJokerRetry[1]) + if (_GameData.PlayerTeam2.Count < _GameData.NumFields + _GameData.NumJokerRetry[1]) { - random = CBase.Game.GetRandom((IDs2.Count - 1) * 20); + random = CBase.Game.GetRandom((iDs2.Count - 1) * 20); num = (int)Math.Round((double)random / 20); - if (num >= IDs2.Count) - num = IDs2.Count - 1; - GameData.PlayerTeam2.Add(IDs2[num]); - IDs2.RemoveAt(num); + if (num >= iDs2.Count) + num = iDs2.Count - 1; + _GameData.PlayerTeam2.Add(iDs2[num]); + iDs2.RemoveAt(num); } } } - else if (Team == 1) + else if (team == 1) { //Prepare Player-IDs - List IDs = new List(); + List iDs = new List(); int num = 0; int random = 0; //Add IDs to team-list - while (GameData.PlayerTeam1.Count < GameData.NumFields + GameData.NumJokerRetry[0] && IDs.Count == 0) + while (_GameData.PlayerTeam1.Count < _GameData.NumFields + _GameData.NumJokerRetry[0] && iDs.Count == 0) { - if (IDs.Count == 0) + if (iDs.Count == 0) { - for (int i = 0; i < GameData.NumPlayerTeam1; i++) - IDs.Add(i); + for (int i = 0; i < _GameData.NumPlayerTeam1; i++) + iDs.Add(i); } - if (GameData.PlayerTeam1.Count < GameData.NumFields + GameData.NumJokerRetry[0]) + if (_GameData.PlayerTeam1.Count < _GameData.NumFields + _GameData.NumJokerRetry[0]) { - random = CBase.Game.GetRandom((IDs.Count - 1) * 10); + random = CBase.Game.GetRandom((iDs.Count - 1) * 10); num = (int)Math.Round((double)random / 10); - if (num >= IDs.Count) - num = IDs.Count - 1; - GameData.PlayerTeam1.Add(IDs[num]); - IDs.RemoveAt(num); + if (num >= iDs.Count) + num = iDs.Count - 1; + _GameData.PlayerTeam1.Add(iDs[num]); + iDs.RemoveAt(num); } } } - else if (Team == 2) + else if (team == 2) { //Prepare Player-IDs - List IDs = new List(); + List iDs = new List(); int num = 0; int random = 0; //Add IDs to team-list - while (GameData.PlayerTeam2.Count < GameData.NumFields + GameData.NumJokerRetry[1] && IDs.Count == 0) + while (_GameData.PlayerTeam2.Count < _GameData.NumFields + _GameData.NumJokerRetry[1] && iDs.Count == 0) { - if (IDs.Count == 0) + if (iDs.Count == 0) { - for (int i = 0; i < GameData.NumPlayerTeam2; i++) - IDs.Add(i); + for (int i = 0; i < _GameData.NumPlayerTeam2; i++) + iDs.Add(i); } - if (GameData.PlayerTeam2.Count < GameData.NumFields + GameData.NumJokerRetry[1]) + if (_GameData.PlayerTeam2.Count < _GameData.NumFields + _GameData.NumJokerRetry[1]) { - random = CBase.Game.GetRandom((IDs.Count - 1) * 20); + random = CBase.Game.GetRandom((iDs.Count - 1) * 20); num = (int)Math.Round((double)random / 20); - if (num >= IDs.Count) - num = IDs.Count - 1; - GameData.PlayerTeam2.Add(IDs[num]); - IDs.RemoveAt(num); + if (num >= iDs.Count) + num = iDs.Count - 1; + _GameData.PlayerTeam2.Add(iDs[num]); + iDs.RemoveAt(num); } } } } - private void PrepareSongList() + private void _PrepareSongList() { EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL; - switch (GameData.GameMode) + switch (_GameData.GameMode) { case EPartyGameMode.TR_GAMEMODE_NORMAL: gm = EGameMode.TR_GAMEMODE_NORMAL; @@ -633,19 +637,19 @@ namespace VocaluxeLib.PartyModes.TicTacToe break; } - while (GameData.Songs.Count < (GameData.NumFields + GameData.NumJokerRandom[0] + GameData.NumJokerRandom[1])) + while (_GameData.Songs.Count < (_GameData.NumFields + _GameData.NumJokerRandom[0] + _GameData.NumJokerRandom[1])) { - List Songs = new List(); - switch (GameData.SongSource) + List songs = new List(); + switch (_GameData.SongSource) { case ESongSource.TR_PLAYLIST: - for (int i = 0; i < CBase.Playlist.GetPlaylistSongCount(GameData.PlaylistID); i++) + for (int i = 0; i < CBase.Playlist.GetPlaylistSongCount(_GameData.PlaylistID); i++) { - int id = CBase.Playlist.GetPlaylistSong(GameData.PlaylistID, i).SongID; + int id = CBase.Playlist.GetPlaylistSong(_GameData.PlaylistID, i).SongID; foreach (EGameMode mode in CBase.Songs.GetSongByID(id).AvailableGameModes) { if (mode == gm) - Songs.Add(id); + songs.Add(id); } } break; @@ -656,47 +660,47 @@ namespace VocaluxeLib.PartyModes.TicTacToe foreach (EGameMode mode in CBase.Songs.GetSongByID(i).AvailableGameModes) { if (mode == gm) - Songs.Add(i); + songs.Add(i); } } break; case ESongSource.TR_CATEGORY: - CBase.Songs.SetCategory(GameData.CategoryID); - for (int i = 0; i < CBase.Songs.NumSongsInCategory(GameData.CategoryID); i++) + CBase.Songs.SetCategory(_GameData.CategoryID); + for (int i = 0; i < CBase.Songs.NumSongsInCategory(_GameData.CategoryID); i++) { foreach (EGameMode mode in CBase.Songs.GetVisibleSong(i).AvailableGameModes) { if (mode == gm) - Songs.Add(CBase.Songs.GetVisibleSong(i).ID); + songs.Add(CBase.Songs.GetVisibleSong(i).ID); } } CBase.Songs.SetCategory(-1); break; } - while (Songs.Count > 0) + while (songs.Count > 0) { - GameData.Songs.Add(Songs[CBase.Game.GetRandom(Songs.Count - 1)]); - Songs.Remove(GameData.Songs[GameData.Songs.Count - 1]); + _GameData.Songs.Add(songs[CBase.Game.GetRandom(songs.Count - 1)]); + songs.Remove(_GameData.Songs[_GameData.Songs.Count - 1]); } } } - private void UpdatePlayerList() + private void _UpdatePlayerList() { - if (GameData.PlayerTeam1.Count == 0) - PreparePlayerList(1); - if (GameData.PlayerTeam2.Count == 0) - PreparePlayerList(2); + if (_GameData.PlayerTeam1.Count == 0) + _PreparePlayerList(1); + if (_GameData.PlayerTeam2.Count == 0) + _PreparePlayerList(2); } - private void UpdateSongList() + private void _UpdateSongList() { - if (GameData.Songs.Count == 0) - PrepareSongList(); + if (_GameData.Songs.Count == 0) + _PrepareSongList(); } - private void StartRound(int RoundNr) + private void _StartRound(int roundNr) { CBase.Game.Reset(); CBase.Game.ClearSongs(); @@ -711,7 +715,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe return; SProfile[] profiles = CBase.Profiles.GetProfiles(); - Round r = GameData.Rounds[RoundNr]; + CRound r = _GameData.Rounds[roundNr]; bool isDuet = CBase.Songs.GetSongByID(r.SongID).IsDuet; for (int i = 0; i < 2; i++) @@ -725,19 +729,19 @@ namespace VocaluxeLib.PartyModes.TicTacToe //try to fill with the right data if (r != null) { - if (GameData.ProfileIDsTeam1[r.SingerTeam1] < profiles.Length) + if (_GameData.ProfileIDsTeam1[r.SingerTeam1] < profiles.Length) { - player[0].Name = profiles[GameData.ProfileIDsTeam1[r.SingerTeam1]].PlayerName; - player[0].Difficulty = profiles[GameData.ProfileIDsTeam1[r.SingerTeam1]].Difficulty; - player[0].ProfileID = GameData.ProfileIDsTeam1[r.SingerTeam1]; + player[0].Name = profiles[_GameData.ProfileIDsTeam1[r.SingerTeam1]].PlayerName; + player[0].Difficulty = profiles[_GameData.ProfileIDsTeam1[r.SingerTeam1]].Difficulty; + player[0].ProfileID = _GameData.ProfileIDsTeam1[r.SingerTeam1]; if (isDuet) player[0].LineNr = 0; } - if (GameData.ProfileIDsTeam2[r.SingerTeam2] < profiles.Length) + if (_GameData.ProfileIDsTeam2[r.SingerTeam2] < profiles.Length) { - player[1].Name = profiles[GameData.ProfileIDsTeam2[r.SingerTeam2]].PlayerName; - player[1].Difficulty = profiles[GameData.ProfileIDsTeam2[r.SingerTeam2]].Difficulty; - player[1].ProfileID = GameData.ProfileIDsTeam2[r.SingerTeam2]; + player[1].Name = profiles[_GameData.ProfileIDsTeam2[r.SingerTeam2]].PlayerName; + player[1].Difficulty = profiles[_GameData.ProfileIDsTeam2[r.SingerTeam2]].Difficulty; + player[1].ProfileID = _GameData.ProfileIDsTeam2[r.SingerTeam2]; if (isDuet) player[1].LineNr = 1; } @@ -747,37 +751,37 @@ namespace VocaluxeLib.PartyModes.TicTacToe return; } - private void SetNumJokers() + private void _SetNumJokers() { - switch (GameData.NumFields) + switch (_GameData.NumFields) { case 9: - GameData.NumJokerRandom[0] = 1; - GameData.NumJokerRandom[1] = 1; - GameData.NumJokerRetry[0] = 0; - GameData.NumJokerRetry[1] = 0; + _GameData.NumJokerRandom[0] = 1; + _GameData.NumJokerRandom[1] = 1; + _GameData.NumJokerRetry[0] = 0; + _GameData.NumJokerRetry[1] = 0; break; case 16: - GameData.NumJokerRandom[0] = 2; - GameData.NumJokerRandom[1] = 2; - GameData.NumJokerRetry[0] = 1; - GameData.NumJokerRetry[1] = 1; + _GameData.NumJokerRandom[0] = 2; + _GameData.NumJokerRandom[1] = 2; + _GameData.NumJokerRetry[0] = 1; + _GameData.NumJokerRetry[1] = 1; break; case 25: - GameData.NumJokerRandom[0] = 3; - GameData.NumJokerRandom[1] = 3; - GameData.NumJokerRetry[0] = 2; - GameData.NumJokerRetry[1] = 2; + _GameData.NumJokerRandom[0] = 3; + _GameData.NumJokerRandom[1] = 3; + _GameData.NumJokerRetry[0] = 2; + _GameData.NumJokerRetry[1] = 2; break; } } - private void UpdateScores() + private void _UpdateScores() { - if (!GameData.Rounds[GameData.SingRoundNr].Finished) - GameData.CurrentRoundNr++; + if (!_GameData.Rounds[_GameData.SingRoundNr].Finished) + _GameData.CurrentRoundNr++; SPlayer[] results = CBase.Game.GetPlayer(); if (results == null) @@ -786,17 +790,17 @@ namespace VocaluxeLib.PartyModes.TicTacToe if (results.Length < 2) return; - GameData.Rounds[GameData.SingRoundNr].PointsTeam1 = (int)Math.Round(results[0].Points); - GameData.Rounds[GameData.SingRoundNr].PointsTeam2 = (int)Math.Round(results[1].Points); - GameData.Rounds[GameData.SingRoundNr].Finished = true; - if (GameData.Rounds[GameData.SingRoundNr].PointsTeam1 < GameData.Rounds[GameData.SingRoundNr].PointsTeam2) - GameData.Rounds[GameData.SingRoundNr].Winner = 2; - else if (GameData.Rounds[GameData.SingRoundNr].PointsTeam1 > GameData.Rounds[GameData.SingRoundNr].PointsTeam2) - GameData.Rounds[GameData.SingRoundNr].Winner = 1; + _GameData.Rounds[_GameData.SingRoundNr].PointsTeam1 = (int)Math.Round(results[0].Points); + _GameData.Rounds[_GameData.SingRoundNr].PointsTeam2 = (int)Math.Round(results[1].Points); + _GameData.Rounds[_GameData.SingRoundNr].Finished = true; + if (_GameData.Rounds[_GameData.SingRoundNr].PointsTeam1 < _GameData.Rounds[_GameData.SingRoundNr].PointsTeam2) + _GameData.Rounds[_GameData.SingRoundNr].Winner = 2; + else if (_GameData.Rounds[_GameData.SingRoundNr].PointsTeam1 > _GameData.Rounds[_GameData.SingRoundNr].PointsTeam2) + _GameData.Rounds[_GameData.SingRoundNr].Winner = 1; else { - GameData.Rounds[GameData.SingRoundNr].Finished = false; - GameData.CurrentRoundNr--; + _GameData.Rounds[_GameData.SingRoundNr].Finished = false; + _GameData.CurrentRoundNr--; } } } diff --git a/PartyModes/PartyModeTicTacToe/PartyScreenTicTacToeConfig.cs b/PartyModes/PartyModeTicTacToe/PartyScreenTicTacToeConfig.cs index 5e4012ab..a1af9b1b 100644 --- a/PartyModes/PartyModeTicTacToe/PartyScreenTicTacToeConfig.cs +++ b/PartyModes/PartyModeTicTacToe/PartyScreenTicTacToeConfig.cs @@ -4,7 +4,7 @@ using VocaluxeLib.Menu; namespace VocaluxeLib.PartyModes.TicTacToe { - public class PartyScreenTicTacToeConfig : CMenuParty + public class CPartyScreenTicTacToeConfig : CMenuParty { // Version number for theme files. Increment it, if you've changed something on the theme files! protected override int _ScreenVersion @@ -12,30 +12,30 @@ namespace VocaluxeLib.PartyModes.TicTacToe get { return 1; } } - private const string SelectSlideNumPlayerTeam1 = "SelectSlideNumPlayerTeam1"; - private const string SelectSlideNumPlayerTeam2 = "SelectSlideNumPlayerTeam2"; - private const string SelectSlideNumFields = "SelectSlideNumFields"; - private const string SelectSlideSongSource = "SelectSlideSongSource"; - private const string SelectSlidePlaylist = "SelectSlidePlaylist"; - private const string SelectSlideCategory = "SelectSlideCategory"; - private const string SelectSlideGameMode = "SelectSlideGameMode"; - private const string ButtonNext = "ButtonNext"; - private const string ButtonBack = "ButtonBack"; + private const string _SelectSlideNumPlayerTeam1 = "SelectSlideNumPlayerTeam1"; + private const string _SelectSlideNumPlayerTeam2 = "SelectSlideNumPlayerTeam2"; + private const string _SelectSlideNumFields = "SelectSlideNumFields"; + private const string _SelectSlideSongSource = "SelectSlideSongSource"; + private const string _SelectSlidePlaylist = "SelectSlidePlaylist"; + private const string _SelectSlideCategory = "SelectSlideCategory"; + private const string _SelectSlideGameMode = "SelectSlideGameMode"; + private const string _ButtonNext = "ButtonNext"; + private const string _ButtonBack = "ButtonBack"; - private bool ConfigOk = true; + private bool _ConfigOk = true; - private DataFromScreen Data; + private SDataFromScreen _Data; public override void Init() { base.Init(); _ThemeSelectSlides = new string[] - {SelectSlideNumPlayerTeam1, SelectSlideNumPlayerTeam2, SelectSlideNumFields, SelectSlideSongSource, SelectSlidePlaylist, SelectSlideCategory, SelectSlideGameMode}; - _ThemeButtons = new string[] {ButtonNext, ButtonBack}; + {_SelectSlideNumPlayerTeam1, _SelectSlideNumPlayerTeam2, _SelectSlideNumFields, _SelectSlideSongSource, _SelectSlidePlaylist, _SelectSlideCategory, _SelectSlideGameMode}; + _ThemeButtons = new string[] {_ButtonNext, _ButtonBack}; - Data = new DataFromScreen(); - FromScreenConfig config = new FromScreenConfig(); + _Data = new SDataFromScreen(); + SFromScreenConfig config = new SFromScreenConfig(); config.PlaylistID = 0; config.NumFields = 9; config.NumPlayerTeam1 = 2; @@ -43,23 +43,23 @@ namespace VocaluxeLib.PartyModes.TicTacToe config.GameMode = EPartyGameMode.TR_GAMEMODE_NORMAL; config.CategoryID = 0; config.SongSource = ESongSource.TR_ALLSONGS; - Data.ScreenConfig = config; + _Data.ScreenConfig = config; } - public override void DataToScreen(object ReceivedData) + public override void DataToScreen(object receivedData) { - DataToScreenConfig config = new DataToScreenConfig(); + SDataToScreenConfig config = new SDataToScreenConfig(); try { - config = (DataToScreenConfig)ReceivedData; - Data.ScreenConfig.NumFields = config.NumFields; - Data.ScreenConfig.NumPlayerTeam1 = config.NumPlayerTeam1; - Data.ScreenConfig.NumPlayerTeam2 = config.NumPlayerTeam2; - Data.ScreenConfig.PlaylistID = config.PlaylistID; - Data.ScreenConfig.CategoryID = config.CategoryID; - Data.ScreenConfig.SongSource = config.SongSource; - Data.ScreenConfig.GameMode = config.GameMode; + config = (SDataToScreenConfig)receivedData; + _Data.ScreenConfig.NumFields = config.NumFields; + _Data.ScreenConfig.NumPlayerTeam1 = config.NumPlayerTeam1; + _Data.ScreenConfig.NumPlayerTeam2 = config.NumPlayerTeam2; + _Data.ScreenConfig.PlaylistID = config.PlaylistID; + _Data.ScreenConfig.CategoryID = config.CategoryID; + _Data.ScreenConfig.SongSource = config.SongSource; + _Data.ScreenConfig.GameMode = config.GameMode; } catch (Exception e) { @@ -67,7 +67,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe } } - public override bool HandleInput(KeyEvent keyEvent) + public override bool HandleInput(SKeyEvent keyEvent) { base.HandleInput(keyEvent); @@ -78,47 +78,47 @@ namespace VocaluxeLib.PartyModes.TicTacToe { case Keys.Back: case Keys.Escape: - Back(); + _Back(); break; case Keys.Enter: - UpdateSlides(); + _UpdateSlides(); - if (Buttons[ButtonBack].Selected) - Back(); + if (Buttons[_ButtonBack].Selected) + _Back(); - if (Buttons[ButtonNext].Selected) - Next(); + if (Buttons[_ButtonNext].Selected) + _Next(); break; case Keys.Left: - UpdateSlides(); + _UpdateSlides(); break; case Keys.Right: - UpdateSlides(); + _UpdateSlides(); break; } } return true; } - public override bool HandleMouse(MouseEvent mouseEvent) + public override bool HandleMouse(SMouseEvent mouseEvent) { base.HandleMouse(mouseEvent); if (mouseEvent.LB && IsMouseOver(mouseEvent)) { - UpdateSlides(); - if (Buttons[ButtonBack].Selected) - Back(); + _UpdateSlides(); + if (Buttons[_ButtonBack].Selected) + _Back(); - if (Buttons[ButtonNext].Selected) - Next(); + if (Buttons[_ButtonNext].Selected) + _Next(); } if (mouseEvent.RB) - Back(); + _Back(); return true; } @@ -128,15 +128,15 @@ namespace VocaluxeLib.PartyModes.TicTacToe base.OnShow(); if (CBase.Config.GetMaxNumMics() >= 2) - ConfigOk = true; + _ConfigOk = true; - FillSlides(); - UpdateSlides(); + _FillSlides(); + _UpdateSlides(); } public override bool UpdateGame() { - Buttons[ButtonNext].Visible = ConfigOk; + Buttons[_ButtonNext].Visible = _ConfigOk; return true; } @@ -146,79 +146,79 @@ namespace VocaluxeLib.PartyModes.TicTacToe return true; } - private void FillSlides() + private void _FillSlides() { // build num player slide (min player ... max player); - SelectSlides[SelectSlideNumPlayerTeam1].Clear(); + SelectSlides[_SelectSlideNumPlayerTeam1].Clear(); for (int i = _PartyMode.GetMinPlayer() / 2; i <= _PartyMode.GetMaxPlayer() / 2; i++) - SelectSlides[SelectSlideNumPlayerTeam1].AddValue(i.ToString()); - SelectSlides[SelectSlideNumPlayerTeam1].Selection = Data.ScreenConfig.NumPlayerTeam1 - (_PartyMode.GetMinPlayer() / 2); + SelectSlides[_SelectSlideNumPlayerTeam1].AddValue(i.ToString()); + SelectSlides[_SelectSlideNumPlayerTeam1].Selection = _Data.ScreenConfig.NumPlayerTeam1 - (_PartyMode.GetMinPlayer() / 2); - SelectSlides[SelectSlideNumPlayerTeam2].Clear(); + SelectSlides[_SelectSlideNumPlayerTeam2].Clear(); for (int i = _PartyMode.GetMinPlayer() / 2; i <= _PartyMode.GetMaxPlayer() / 2; i++) - SelectSlides[SelectSlideNumPlayerTeam2].AddValue(i.ToString()); - SelectSlides[SelectSlideNumPlayerTeam2].Selection = Data.ScreenConfig.NumPlayerTeam2 - (_PartyMode.GetMinPlayer() / 2); + SelectSlides[_SelectSlideNumPlayerTeam2].AddValue(i.ToString()); + SelectSlides[_SelectSlideNumPlayerTeam2].Selection = _Data.ScreenConfig.NumPlayerTeam2 - (_PartyMode.GetMinPlayer() / 2); - SelectSlides[SelectSlideNumFields].Clear(); - SelectSlides[SelectSlideNumFields].AddValue("9"); - SelectSlides[SelectSlideNumFields].AddValue("16"); - SelectSlides[SelectSlideNumFields].AddValue("25"); - if (Data.ScreenConfig.NumFields == 9) - SelectSlides[SelectSlideNumFields].Selection = 0; - else if (Data.ScreenConfig.NumFields == 16) - SelectSlides[SelectSlideNumFields].Selection = 1; - else if (Data.ScreenConfig.NumFields == 25) - SelectSlides[SelectSlideNumFields].Selection = 2; + SelectSlides[_SelectSlideNumFields].Clear(); + SelectSlides[_SelectSlideNumFields].AddValue("9"); + SelectSlides[_SelectSlideNumFields].AddValue("16"); + SelectSlides[_SelectSlideNumFields].AddValue("25"); + if (_Data.ScreenConfig.NumFields == 9) + SelectSlides[_SelectSlideNumFields].Selection = 0; + else if (_Data.ScreenConfig.NumFields == 16) + SelectSlides[_SelectSlideNumFields].Selection = 1; + else if (_Data.ScreenConfig.NumFields == 25) + SelectSlides[_SelectSlideNumFields].Selection = 2; - SelectSlides[SelectSlideSongSource].Clear(); - SelectSlides[SelectSlideSongSource].SetValues((int)Data.ScreenConfig.SongSource); + SelectSlides[_SelectSlideSongSource].Clear(); + SelectSlides[_SelectSlideSongSource].SetValues((int)_Data.ScreenConfig.SongSource); - string[] _Playlists = CBase.Playlist.GetPlaylistNames(); - SelectSlides[SelectSlidePlaylist].Clear(); - for (int i = 0; i < _Playlists.Length; i++) + string[] playlists = CBase.Playlist.GetPlaylistNames(); + SelectSlides[_SelectSlidePlaylist].Clear(); + for (int i = 0; i < playlists.Length; i++) { - string value = _Playlists[i] + " (" + CBase.Playlist.GetPlaylistSongCount(i) + " " + CBase.Language.Translate("TR_SONGS", _PartyModeID) + ")"; - SelectSlides[SelectSlidePlaylist].AddValue(value); + string value = playlists[i] + " (" + CBase.Playlist.GetPlaylistSongCount(i) + " " + CBase.Language.Translate("TR_SONGS", _PartyModeID) + ")"; + SelectSlides[_SelectSlidePlaylist].AddValue(value); } - SelectSlides[SelectSlidePlaylist].Selection = Data.ScreenConfig.PlaylistID; - SelectSlides[SelectSlidePlaylist].Visible = Data.ScreenConfig.SongSource == ESongSource.TR_PLAYLIST; + SelectSlides[_SelectSlidePlaylist].Selection = _Data.ScreenConfig.PlaylistID; + SelectSlides[_SelectSlidePlaylist].Visible = _Data.ScreenConfig.SongSource == ESongSource.TR_PLAYLIST; - string[] _Categories = new string[CBase.Songs.GetNumCategories()]; + string[] categories = new string[CBase.Songs.GetNumCategories()]; for (int i = 0; i < CBase.Songs.GetNumCategories(); i++) - _Categories[i] = CBase.Songs.GetCategory(i).Name; - SelectSlides[SelectSlideCategory].Clear(); - for (int i = 0; i < _Categories.Length; i++) + categories[i] = CBase.Songs.GetCategory(i).Name; + SelectSlides[_SelectSlideCategory].Clear(); + for (int i = 0; i < categories.Length; i++) { - string value = _Categories[i] + " (" + CBase.Songs.NumSongsInCategory(i) + " " + CBase.Language.Translate("TR_SONGS", _PartyModeID) + ")"; - SelectSlides[SelectSlideCategory].AddValue(value); + string value = categories[i] + " (" + CBase.Songs.NumSongsInCategory(i) + " " + CBase.Language.Translate("TR_SONGS", _PartyModeID) + ")"; + SelectSlides[_SelectSlideCategory].AddValue(value); } - SelectSlides[SelectSlideCategory].Selection = Data.ScreenConfig.CategoryID; - SelectSlides[SelectSlideCategory].Visible = Data.ScreenConfig.SongSource == ESongSource.TR_CATEGORY; + SelectSlides[_SelectSlideCategory].Selection = _Data.ScreenConfig.CategoryID; + SelectSlides[_SelectSlideCategory].Visible = _Data.ScreenConfig.SongSource == ESongSource.TR_CATEGORY; - SelectSlides[SelectSlideGameMode].Visible = true; - SelectSlides[SelectSlideGameMode].SetValues((int)Data.ScreenConfig.GameMode); + SelectSlides[_SelectSlideGameMode].Visible = true; + SelectSlides[_SelectSlideGameMode].SetValues((int)_Data.ScreenConfig.GameMode); } - private void UpdateSlides() + private void _UpdateSlides() { - Data.ScreenConfig.NumPlayerTeam1 = SelectSlides[SelectSlideNumPlayerTeam1].Selection + (_PartyMode.GetMinPlayer() / 2); - Data.ScreenConfig.NumPlayerTeam2 = SelectSlides[SelectSlideNumPlayerTeam2].Selection + (_PartyMode.GetMinPlayer() / 2); + _Data.ScreenConfig.NumPlayerTeam1 = SelectSlides[_SelectSlideNumPlayerTeam1].Selection + (_PartyMode.GetMinPlayer() / 2); + _Data.ScreenConfig.NumPlayerTeam2 = SelectSlides[_SelectSlideNumPlayerTeam2].Selection + (_PartyMode.GetMinPlayer() / 2); - if (SelectSlides[SelectSlideNumFields].Selection == 0) - Data.ScreenConfig.NumFields = 9; - else if (SelectSlides[SelectSlideNumFields].Selection == 1) - Data.ScreenConfig.NumFields = 16; - else if (SelectSlides[SelectSlideNumFields].Selection == 2) - Data.ScreenConfig.NumFields = 25; + if (SelectSlides[_SelectSlideNumFields].Selection == 0) + _Data.ScreenConfig.NumFields = 9; + else if (SelectSlides[_SelectSlideNumFields].Selection == 1) + _Data.ScreenConfig.NumFields = 16; + else if (SelectSlides[_SelectSlideNumFields].Selection == 2) + _Data.ScreenConfig.NumFields = 25; - Data.ScreenConfig.SongSource = (ESongSource)SelectSlides[SelectSlideSongSource].Selection; - Data.ScreenConfig.PlaylistID = SelectSlides[SelectSlidePlaylist].Selection; - Data.ScreenConfig.CategoryID = SelectSlides[SelectSlideCategory].Selection; - Data.ScreenConfig.GameMode = (EPartyGameMode)SelectSlides[SelectSlideGameMode].Selection; + _Data.ScreenConfig.SongSource = (ESongSource)SelectSlides[_SelectSlideSongSource].Selection; + _Data.ScreenConfig.PlaylistID = SelectSlides[_SelectSlidePlaylist].Selection; + _Data.ScreenConfig.CategoryID = SelectSlides[_SelectSlideCategory].Selection; + _Data.ScreenConfig.GameMode = (EPartyGameMode)SelectSlides[_SelectSlideGameMode].Selection; EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL; - switch (Data.ScreenConfig.GameMode) + switch (_Data.ScreenConfig.GameMode) { case EPartyGameMode.TR_GAMEMODE_NORMAL: gm = EGameMode.TR_GAMEMODE_NORMAL; @@ -233,64 +233,64 @@ namespace VocaluxeLib.PartyModes.TicTacToe break; } - if (Data.ScreenConfig.SongSource == ESongSource.TR_PLAYLIST) + if (_Data.ScreenConfig.SongSource == ESongSource.TR_PLAYLIST) { if (CBase.Playlist.GetNumPlaylists() > 0) { - if (CBase.Playlist.GetPlaylistSongCount(Data.ScreenConfig.PlaylistID) > 0) + if (CBase.Playlist.GetPlaylistSongCount(_Data.ScreenConfig.PlaylistID) > 0) { - ConfigOk = false; - for (int i = 0; i < CBase.Playlist.GetPlaylistSongCount(Data.ScreenConfig.PlaylistID); i++) + _ConfigOk = false; + for (int i = 0; i < CBase.Playlist.GetPlaylistSongCount(_Data.ScreenConfig.PlaylistID); i++) { - int id = CBase.Playlist.GetPlaylistSong(Data.ScreenConfig.PlaylistID, i).SongID; + int id = CBase.Playlist.GetPlaylistSong(_Data.ScreenConfig.PlaylistID, i).SongID; foreach (EGameMode mode in CBase.Songs.GetSongByID(id).AvailableGameModes) { if (mode == gm) { - ConfigOk = true; + _ConfigOk = true; break; } } - if (ConfigOk) + if (_ConfigOk) break; } } else - ConfigOk = false; + _ConfigOk = false; } else - ConfigOk = false; + _ConfigOk = false; } - if (Data.ScreenConfig.SongSource == ESongSource.TR_CATEGORY) + if (_Data.ScreenConfig.SongSource == ESongSource.TR_CATEGORY) { if (CBase.Songs.GetNumCategories() > 0) { - if (CBase.Songs.NumSongsInCategory(Data.ScreenConfig.CategoryID) > 0) + if (CBase.Songs.NumSongsInCategory(_Data.ScreenConfig.CategoryID) > 0) { - CBase.Songs.SetCategory(Data.ScreenConfig.CategoryID); - ConfigOk = false; - for (int i = 0; i < CBase.Songs.NumSongsInCategory(Data.ScreenConfig.CategoryID); i++) + CBase.Songs.SetCategory(_Data.ScreenConfig.CategoryID); + _ConfigOk = false; + for (int i = 0; i < CBase.Songs.NumSongsInCategory(_Data.ScreenConfig.CategoryID); i++) { foreach (EGameMode mode in CBase.Songs.GetVisibleSong(i).AvailableGameModes) { if (mode == gm) { - ConfigOk = true; + _ConfigOk = true; break; } } - if (ConfigOk) + if (_ConfigOk) break; } CBase.Songs.SetCategory(-1); } else - ConfigOk = false; + _ConfigOk = false; } else - ConfigOk = false; + _ConfigOk = false; } - if (Data.ScreenConfig.SongSource == ESongSource.TR_ALLSONGS) + if (_Data.ScreenConfig.SongSource == ESongSource.TR_ALLSONGS) { if (CBase.Songs.GetNumSongs() > 0) { @@ -300,29 +300,29 @@ namespace VocaluxeLib.PartyModes.TicTacToe { if (mode == gm) { - ConfigOk = true; + _ConfigOk = true; break; } } - if (ConfigOk) + if (_ConfigOk) break; } } else - ConfigOk = false; + _ConfigOk = false; } - SelectSlides[SelectSlideCategory].Visible = Data.ScreenConfig.SongSource == ESongSource.TR_CATEGORY; - SelectSlides[SelectSlidePlaylist].Visible = Data.ScreenConfig.SongSource == ESongSource.TR_PLAYLIST; + SelectSlides[_SelectSlideCategory].Visible = _Data.ScreenConfig.SongSource == ESongSource.TR_CATEGORY; + SelectSlides[_SelectSlidePlaylist].Visible = _Data.ScreenConfig.SongSource == ESongSource.TR_PLAYLIST; } - private void Back() + private void _Back() { - FadeTo(EScreens.ScreenParty); + _FadeTo(EScreens.ScreenParty); } - private void Next() + private void _Next() { - _PartyMode.DataFromScreen(ThemeName, Data); + _PartyMode.DataFromScreen(ThemeName, _Data); } } } \ No newline at end of file diff --git a/PartyModes/PartyModeTicTacToe/PartyScreenTicTacToeMain.cs b/PartyModes/PartyModeTicTacToe/PartyScreenTicTacToeMain.cs index eb8c2216..3e2fe436 100644 --- a/PartyModes/PartyModeTicTacToe/PartyScreenTicTacToeMain.cs +++ b/PartyModes/PartyModeTicTacToe/PartyScreenTicTacToeMain.cs @@ -6,9 +6,9 @@ using VocaluxeLib.Menu.SongMenu; namespace VocaluxeLib.PartyModes.TicTacToe { - public class Field + public class CField { - public Round Content; + public CRound Content; public CButton Button; } @@ -20,7 +20,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe None } - public class PartyScreenTicTacToeMain : CMenuParty + public class CPartyScreenTicTacToeMain : CMenuParty { // Version number for theme files. Increment it, if you've changed something on the theme files! protected override int _ScreenVersion @@ -28,91 +28,91 @@ namespace VocaluxeLib.PartyModes.TicTacToe get { return 1; } } - private const string TextPopupReallyExit = "TextPopupReallyExit"; - private const string TextTeamChoosing = "TextTeamChoosing"; - private const string TextFinishMessage = "TextFinishMessage"; - private const string TextNextPlayerT1 = "TextNextPlayerT1"; - private const string TextNextPlayerT2 = "TextNextPlayerT2"; - private const string TextNextPlayerNameT1 = "TextNextPlayerNameT1"; - private const string TextNextPlayerNameT2 = "TextNextPlayerNameT2"; + private const string _TextPopupReallyExit = "TextPopupReallyExit"; + private const string _TextTeamChoosing = "TextTeamChoosing"; + private const string _TextFinishMessage = "TextFinishMessage"; + private const string _TextNextPlayerT1 = "TextNextPlayerT1"; + private const string _TextNextPlayerT2 = "TextNextPlayerT2"; + private const string _TextNextPlayerNameT1 = "TextNextPlayerNameT1"; + private const string _TextNextPlayerNameT2 = "TextNextPlayerNameT2"; - private const string ButtonNextRound = "ButtonNextRound"; - private const string ButtonBack = "ButtonBack"; - private const string ButtonExit = "ButtonExit"; - private const string ButtonPopupYes = "ButtonPopupYes"; - private const string ButtonPopupNo = "ButtonPopupNo"; - private const string ButtonField = "ButtonField"; + private const string _ButtonNextRound = "ButtonNextRound"; + private const string _ButtonBack = "ButtonBack"; + private const string _ButtonExit = "ButtonExit"; + private const string _ButtonPopupYes = "ButtonPopupYes"; + private const string _ButtonPopupNo = "ButtonPopupNo"; + private const string _ButtonField = "ButtonField"; - private const string ButtonJokerRandomT1 = "ButtonJokerRandomT1"; - private const string ButtonJokerRandomT2 = "ButtonJokerRandomT2"; - private const string ButtonJokerRetryT1 = "ButtonJokerRetryT1"; - private const string ButtonJokerRetryT2 = "ButtonJokerRetryT2"; + private const string _ButtonJokerRandomT1 = "ButtonJokerRandomT1"; + private const string _ButtonJokerRandomT2 = "ButtonJokerRandomT2"; + private const string _ButtonJokerRetryT1 = "ButtonJokerRetryT1"; + private const string _ButtonJokerRetryT2 = "ButtonJokerRetryT2"; - private const string StaticPopupBG = "StaticPopupBG"; - private const string StaticAvatarT1 = "StaticAvatarT1"; - private const string StaticAvatarT2 = "StaticAvatarT2"; + private const string _StaticPopupBG = "StaticPopupBG"; + private const string _StaticAvatarT1 = "StaticAvatarT1"; + private const string _StaticAvatarT2 = "StaticAvatarT2"; - private bool ExitPopupVisible; + private bool _ExitPopupVisible; - private DataFromScreen Data; - private DataToScreenMain GameData; + private SDataFromScreen _Data; + private SDataToScreenMain _GameData; - private List Fields; - private float FieldFirstX = 25; - private float FieldFirstY = 25; - private int FieldSpace = 10; - private float FieldSize = 100; + private List _Fields; + private float _FieldFirstX = 25; + private float _FieldFirstY = 25; + private int _FieldSpace = 10; + private float _FieldSize = 100; - private int PreviewStream = -1; - private int SelectedField = -1; - private int OldSelectedField = -1; + private int _PreviewStream = -1; + private int _SelectedField = -1; + private int _OldSelectedField = -1; - private int[,] Possibilities; - private EStatus Status; + private int[,] _Possibilities; + private EStatus _Status; public override void Init() { base.Init(); - _ThemeTexts = new string[] {TextPopupReallyExit, TextTeamChoosing, TextFinishMessage, TextNextPlayerT1, TextNextPlayerT2, TextNextPlayerNameT1, TextNextPlayerNameT2}; + _ThemeTexts = new string[] {_TextPopupReallyExit, _TextTeamChoosing, _TextFinishMessage, _TextNextPlayerT1, _TextNextPlayerT2, _TextNextPlayerNameT1, _TextNextPlayerNameT2}; _ThemeButtons = new string[] { - ButtonNextRound, ButtonBack, ButtonExit, ButtonPopupYes, ButtonPopupNo, ButtonField, ButtonJokerRandomT1, ButtonJokerRandomT2, ButtonJokerRetryT1, - ButtonJokerRetryT2 + _ButtonNextRound, _ButtonBack, _ButtonExit, _ButtonPopupYes, _ButtonPopupNo, _ButtonField, _ButtonJokerRandomT1, _ButtonJokerRandomT2, _ButtonJokerRetryT1, + _ButtonJokerRetryT2 }; - _ThemeStatics = new string[] {StaticPopupBG, StaticAvatarT1, StaticAvatarT2}; + _ThemeStatics = new string[] {_StaticPopupBG, _StaticAvatarT1, _StaticAvatarT2}; - Data = new DataFromScreen(); - FromScreenMain config = new FromScreenMain(); - GameData = new DataToScreenMain(); + _Data = new SDataFromScreen(); + SFromScreenMain config = new SFromScreenMain(); + _GameData = new SDataToScreenMain(); config.SingRoundNr = 1; - config.Rounds = new List(); + config.Rounds = new List(); config.Songs = new List(); config.PlayerTeam1 = new List(); config.PlayerTeam2 = new List(); config.FadeToNameSelection = false; config.FadeToSinging = false; - Data.ScreenMain = config; + _Data.ScreenMain = config; - Fields = new List(); + _Fields = new List(); } - public override void LoadTheme(string XmlPath) + public override void LoadTheme(string xmlPath) { - base.LoadTheme(XmlPath); + base.LoadTheme(xmlPath); - CreateFields(); - Buttons[ButtonField].Visible = false; + _CreateFields(); + Buttons[_ButtonField].Visible = false; } - public override void DataToScreen(object ReceivedData) + public override void DataToScreen(object receivedData) { - DataToScreenMain config = new DataToScreenMain(); + SDataToScreenMain config = new SDataToScreenMain(); try { - config = (DataToScreenMain)ReceivedData; - GameData = config; + config = (SDataToScreenMain)receivedData; + _GameData = config; } catch (Exception e) { @@ -120,7 +120,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe } } - public override bool HandleInput(KeyEvent keyEvent) + public override bool HandleInput(SKeyEvent keyEvent) { base.HandleInput(keyEvent); @@ -131,69 +131,69 @@ namespace VocaluxeLib.PartyModes.TicTacToe { case Keys.Back: case Keys.Escape: - if (!ExitPopupVisible) + if (!_ExitPopupVisible) { - if (GameData.CurrentRoundNr == 1 && Status != EStatus.FieldSelected) - Back(); - else if (Status == EStatus.None) - EndParty(); + if (_GameData.CurrentRoundNr == 1 && _Status != EStatus.FieldSelected) + _Back(); + else if (_Status == EStatus.None) + _EndParty(); else - ShowPopup(true); + _ShowPopup(true); } else - ShowPopup(false); + _ShowPopup(false); break; case Keys.Enter: - if (!ExitPopupVisible) + if (!_ExitPopupVisible) { - if (Buttons[ButtonNextRound].Selected) - NextRound(); - if (Buttons[ButtonBack].Selected && GameData.CurrentRoundNr == 1 && Status != EStatus.FieldSelected) - Back(); - if (Buttons[ButtonExit].Selected && (GameData.CurrentRoundNr > 1 || Status == EStatus.FieldSelected) && Status != EStatus.None) - ShowPopup(true); - else if (Status == EStatus.None) - EndParty(); - for (int i = 0; i < GameData.NumFields; i++) + if (Buttons[_ButtonNextRound].Selected) + _NextRound(); + if (Buttons[_ButtonBack].Selected && _GameData.CurrentRoundNr == 1 && _Status != EStatus.FieldSelected) + _Back(); + if (Buttons[_ButtonExit].Selected && (_GameData.CurrentRoundNr > 1 || _Status == EStatus.FieldSelected) && _Status != EStatus.None) + _ShowPopup(true); + else if (_Status == EStatus.None) + _EndParty(); + for (int i = 0; i < _GameData.NumFields; i++) { - switch (Status) + switch (_Status) { case EStatus.FieldChoosing: - if (Fields[i].Button.Selected) + if (_Fields[i].Button.Selected) { - SelectedField = i; - FieldSelected(); + _SelectedField = i; + _FieldSelected(); } break; case EStatus.JokerRetry: - if (Fields[i].Button.Selected) + if (_Fields[i].Button.Selected) { - SelectedField = i; - FieldSelectedAgain(); + _SelectedField = i; + _FieldSelectedAgain(); } break; } } - if (Status == EStatus.FieldSelected) + if (_Status == EStatus.FieldSelected) { - if (Buttons[ButtonJokerRandomT1].Selected) - UseJoker(0, 0); - if (Buttons[ButtonJokerRandomT2].Selected) - UseJoker(1, 0); - if (Buttons[ButtonJokerRetryT1].Selected) - UseJoker(0, 1); - if (Buttons[ButtonJokerRetryT2].Selected) - UseJoker(1, 1); + if (Buttons[_ButtonJokerRandomT1].Selected) + _UseJoker(0, 0); + if (Buttons[_ButtonJokerRandomT2].Selected) + _UseJoker(1, 0); + if (Buttons[_ButtonJokerRetryT1].Selected) + _UseJoker(0, 1); + if (Buttons[_ButtonJokerRetryT2].Selected) + _UseJoker(1, 1); } } else { - if (Buttons[ButtonPopupYes].Selected) - EndParty(); - if (Buttons[ButtonPopupNo].Selected) - ShowPopup(false); + if (Buttons[_ButtonPopupYes].Selected) + _EndParty(); + if (Buttons[_ButtonPopupNo].Selected) + _ShowPopup(false); } break; } @@ -201,80 +201,80 @@ namespace VocaluxeLib.PartyModes.TicTacToe return true; } - public override bool HandleMouse(MouseEvent mouseEvent) + public override bool HandleMouse(SMouseEvent mouseEvent) { base.HandleMouse(mouseEvent); if (mouseEvent.LB && IsMouseOver(mouseEvent)) { - if (!ExitPopupVisible) + if (!_ExitPopupVisible) { - if (Buttons[ButtonNextRound].Selected) - NextRound(); - if (Buttons[ButtonBack].Selected) - Back(); - if (Buttons[ButtonExit].Selected) + if (Buttons[_ButtonNextRound].Selected) + _NextRound(); + if (Buttons[_ButtonBack].Selected) + _Back(); + if (Buttons[_ButtonExit].Selected) { - if (Status == EStatus.None) - EndParty(); + if (_Status == EStatus.None) + _EndParty(); else - ShowPopup(true); + _ShowPopup(true); } - for (int i = 0; i < GameData.NumFields; i++) + for (int i = 0; i < _GameData.NumFields; i++) { - switch (Status) + switch (_Status) { case EStatus.FieldChoosing: - if (Fields[i].Button.Selected) + if (_Fields[i].Button.Selected) { - SelectedField = i; - FieldSelected(); + _SelectedField = i; + _FieldSelected(); } break; case EStatus.JokerRetry: - if (Fields[i].Button.Selected) + if (_Fields[i].Button.Selected) { - SelectedField = i; - FieldSelectedAgain(); + _SelectedField = i; + _FieldSelectedAgain(); } break; } } - if (Status == EStatus.FieldSelected) + if (_Status == EStatus.FieldSelected) { - if (Buttons[ButtonJokerRandomT1].Selected) - UseJoker(0, 0); - if (Buttons[ButtonJokerRandomT2].Selected) - UseJoker(1, 0); - if (Buttons[ButtonJokerRetryT1].Selected) - UseJoker(0, 1); - if (Buttons[ButtonJokerRetryT2].Selected) - UseJoker(1, 1); + if (Buttons[_ButtonJokerRandomT1].Selected) + _UseJoker(0, 0); + if (Buttons[_ButtonJokerRandomT2].Selected) + _UseJoker(1, 0); + if (Buttons[_ButtonJokerRetryT1].Selected) + _UseJoker(0, 1); + if (Buttons[_ButtonJokerRetryT2].Selected) + _UseJoker(1, 1); } } else { - if (Buttons[ButtonPopupYes].Selected) - EndParty(); - if (Buttons[ButtonPopupNo].Selected) - ShowPopup(false); + if (Buttons[_ButtonPopupYes].Selected) + _EndParty(); + if (Buttons[_ButtonPopupNo].Selected) + _ShowPopup(false); } } if (mouseEvent.RB) { - if (!ExitPopupVisible) + if (!_ExitPopupVisible) { - if (GameData.CurrentRoundNr == 1 && Status != EStatus.FieldSelected) - Back(); - else if (Status == EStatus.None) - EndParty(); + if (_GameData.CurrentRoundNr == 1 && _Status != EStatus.FieldSelected) + _Back(); + else if (_Status == EStatus.None) + _EndParty(); else - ShowPopup(true); + _ShowPopup(true); } else - ShowPopup(false); + _ShowPopup(false); } if (mouseEvent.Wheel != 0) {} @@ -286,66 +286,66 @@ namespace VocaluxeLib.PartyModes.TicTacToe { base.OnShow(); - PreviewStream = -1; + _PreviewStream = -1; - if (GameData.CurrentRoundNr == 1) + if (_GameData.CurrentRoundNr == 1) { - BuildWinnerPossibilities(); - SelectedField = -1; - Buttons[ButtonBack].Visible = true; - Buttons[ButtonExit].Visible = false; - SetInteractionToButton(Buttons[ButtonBack]); + _BuildWinnerPossibilities(); + _SelectedField = -1; + Buttons[_ButtonBack].Visible = true; + Buttons[_ButtonExit].Visible = false; + SetInteractionToButton(Buttons[_ButtonBack]); } else { - Buttons[ButtonBack].Visible = false; - Buttons[ButtonExit].Visible = true; - SetInteractionToButton(Buttons[ButtonExit]); + Buttons[_ButtonBack].Visible = false; + Buttons[_ButtonExit].Visible = true; + SetInteractionToButton(Buttons[_ButtonExit]); } - Status = EStatus.FieldChoosing; + _Status = EStatus.FieldChoosing; - UpdateFields(); - UpdateFieldContents(); + _UpdateFields(); + _UpdateFieldContents(); - int Winner = GetWinner(); - if (GameData.CurrentRoundNr <= GameData.NumFields && Winner == 0) + int winner = _GetWinner(); + if (_GameData.CurrentRoundNr <= _GameData.NumFields && winner == 0) { - UpdateTeamChoosingMessage(); - Texts[TextNextPlayerT1].Visible = false; - Texts[TextNextPlayerT2].Visible = false; - Texts[TextNextPlayerNameT1].Visible = false; - Texts[TextNextPlayerNameT2].Visible = false; - Statics[StaticAvatarT1].Visible = false; - Statics[StaticAvatarT2].Visible = false; - Buttons[ButtonJokerRandomT1].Visible = false; - Buttons[ButtonJokerRandomT2].Visible = false; - Buttons[ButtonJokerRetryT1].Visible = false; - Buttons[ButtonJokerRetryT2].Visible = false; - Buttons[ButtonNextRound].Visible = false; - Texts[TextFinishMessage].Visible = false; + _UpdateTeamChoosingMessage(); + Texts[_TextNextPlayerT1].Visible = false; + Texts[_TextNextPlayerT2].Visible = false; + Texts[_TextNextPlayerNameT1].Visible = false; + Texts[_TextNextPlayerNameT2].Visible = false; + Statics[_StaticAvatarT1].Visible = false; + Statics[_StaticAvatarT2].Visible = false; + Buttons[_ButtonJokerRandomT1].Visible = false; + Buttons[_ButtonJokerRandomT2].Visible = false; + Buttons[_ButtonJokerRetryT1].Visible = false; + Buttons[_ButtonJokerRetryT2].Visible = false; + Buttons[_ButtonNextRound].Visible = false; + Texts[_TextFinishMessage].Visible = false; } else { - Status = EStatus.None; - Buttons[ButtonNextRound].Visible = false; - Texts[TextFinishMessage].Visible = true; - Texts[TextTeamChoosing].Visible = false; - if (Winner > 0) + _Status = EStatus.None; + Buttons[_ButtonNextRound].Visible = false; + Texts[_TextFinishMessage].Visible = true; + Texts[_TextTeamChoosing].Visible = false; + if (winner > 0) { - Texts[TextFinishMessage].Color = CBase.Theme.GetPlayerColor(Winner); - Texts[TextFinishMessage].Text = CBase.Language.Translate("TR_SCREENMAIN_WINNER", _PartyModeID) + " " + CBase.Language.Translate("TR_TEAM", _PartyModeID) + " " + - Winner; + Texts[_TextFinishMessage].Color = CBase.Theme.GetPlayerColor(winner); + Texts[_TextFinishMessage].Text = CBase.Language.Translate("TR_SCREENMAIN_WINNER", _PartyModeID) + " " + CBase.Language.Translate("TR_TEAM", _PartyModeID) + " " + + winner; } else { - Texts[TextFinishMessage].Color = new SColorF(1, 1, 1, 1); - Texts[TextFinishMessage].Text = CBase.Language.Translate("TR_SCREENMAIN_NOWINNER", _PartyModeID); + Texts[_TextFinishMessage].Color = new SColorF(1, 1, 1, 1); + Texts[_TextFinishMessage].Text = CBase.Language.Translate("TR_SCREENMAIN_NOWINNER", _PartyModeID); } - SetInteractionToButton(Buttons[ButtonExit]); + SetInteractionToButton(Buttons[_ButtonExit]); } - ShowPopup(false); + _ShowPopup(false); } public override bool UpdateGame() @@ -363,345 +363,345 @@ namespace VocaluxeLib.PartyModes.TicTacToe { base.OnClose(); CBase.BackgroundMusic.SetStatus(false); - CBase.Sound.FadeAndStop(PreviewStream, 0f, 0.5f); + CBase.Sound.FadeAndStop(_PreviewStream, 0f, 0.5f); } - private void CreateFields() + private void _CreateFields() { for (int i = 0; i < 25; i++) { - Field f = new Field(); - f.Button = GetNewButton(Buttons[ButtonField]); + CField f = new CField(); + f.Button = GetNewButton(Buttons[_ButtonField]); f.Button.Visible = false; - f.Content = new Round(); + f.Content = new CRound(); AddButton(f.Button); - Fields.Add(f); + _Fields.Add(f); } } - private void UpdateFields() + private void _UpdateFields() { - int NumOneRow = (int)Math.Sqrt(GameData.NumFields); - float FieldSizeY = (CBase.Settings.GetRenderH() - 150 - NumOneRow * FieldSpace) / NumOneRow; - float FieldSizeX = (CBase.Settings.GetRenderW() - 300 - NumOneRow * FieldSpace) / NumOneRow; - if (FieldSizeX < FieldSizeY) - FieldSize = FieldSizeX; + int numOneRow = (int)Math.Sqrt(_GameData.NumFields); + float fieldSizeY = (CBase.Settings.GetRenderH() - 150 - numOneRow * _FieldSpace) / numOneRow; + float fieldSizeX = (CBase.Settings.GetRenderW() - 300 - numOneRow * _FieldSpace) / numOneRow; + if (fieldSizeX < fieldSizeY) + _FieldSize = fieldSizeX; else - FieldSize = FieldSizeY; - FieldFirstX = CBase.Settings.GetRenderW() / 2 - (NumOneRow * FieldSize + (NumOneRow - 1) * FieldSpace) / 2; - FieldFirstY = 140 + (CBase.Settings.GetRenderH() - 140) / 2 - (NumOneRow * FieldSize + NumOneRow * FieldSpace) / 2; + _FieldSize = fieldSizeY; + _FieldFirstX = CBase.Settings.GetRenderW() / 2 - (numOneRow * _FieldSize + (numOneRow - 1) * _FieldSpace) / 2; + _FieldFirstY = 140 + (CBase.Settings.GetRenderH() - 140) / 2 - (numOneRow * _FieldSize + numOneRow * _FieldSpace) / 2; int row = 0; int column = 0; - float x = FieldFirstX; - float y = FieldFirstY; - for (int i = 0; i < Fields.Count; i++) + float x = _FieldFirstX; + float y = _FieldFirstY; + for (int i = 0; i < _Fields.Count; i++) { - if (i < GameData.NumFields) + if (i < _GameData.NumFields) { - Fields[i].Button.Rect.W = FieldSize; - Fields[i].Button.Rect.H = FieldSize; - Fields[i].Button.Rect.X = x; - Fields[i].Button.Rect.Y = y; - Fields[i].Button.Visible = true; - Fields[i].Button.Enabled = true; + _Fields[i].Button.Rect.W = _FieldSize; + _Fields[i].Button.Rect.H = _FieldSize; + _Fields[i].Button.Rect.X = x; + _Fields[i].Button.Rect.Y = y; + _Fields[i].Button.Visible = true; + _Fields[i].Button.Enabled = true; column++; - if ((i + 1) >= NumOneRow * (row + 1)) + if ((i + 1) >= numOneRow * (row + 1)) { column = 0; row++; - y = FieldFirstY + FieldSize * row + FieldSpace * row; - x = FieldFirstX; + y = _FieldFirstY + _FieldSize * row + _FieldSpace * row; + x = _FieldFirstX; } else - x = FieldFirstX + FieldSize * column + FieldSpace * column; + x = _FieldFirstX + _FieldSize * column + _FieldSpace * column; } else { - Fields[i].Button.Visible = false; - Fields[i].Button.Enabled = false; + _Fields[i].Button.Visible = false; + _Fields[i].Button.Enabled = false; } } } - private void UpdateFieldContents() + private void _UpdateFieldContents() { - for (int i = 0; i < GameData.Rounds.Count; i++) + for (int i = 0; i < _GameData.Rounds.Count; i++) { - Fields[i].Button.Enabled = true; - Fields[i].Button.Texture = Buttons[ButtonField].Texture; - Fields[i].Button.Color = Buttons[ButtonField].Color; - Fields[i].Button.SelColor = Buttons[ButtonField].SelColor; - Fields[i].Content = GameData.Rounds[i]; - if (Fields[i].Content.Finished) + _Fields[i].Button.Enabled = true; + _Fields[i].Button.Texture = Buttons[_ButtonField].Texture; + _Fields[i].Button.Color = Buttons[_ButtonField].Color; + _Fields[i].Button.SelColor = Buttons[_ButtonField].SelColor; + _Fields[i].Content = _GameData.Rounds[i]; + if (_Fields[i].Content.Finished) { - Fields[i].Button.Enabled = false; - Fields[i].Button.Texture = CBase.Songs.GetSongByID(Fields[i].Content.SongID).CoverTextureBig; - Fields[i].Button.Color = CBase.Theme.GetPlayerColor(Fields[i].Content.Winner); - Fields[i].Button.SelColor = CBase.Theme.GetPlayerColor(Fields[i].Content.Winner); + _Fields[i].Button.Enabled = false; + _Fields[i].Button.Texture = CBase.Songs.GetSongByID(_Fields[i].Content.SongID).CoverTextureBig; + _Fields[i].Button.Color = CBase.Theme.GetPlayerColor(_Fields[i].Content.Winner); + _Fields[i].Button.SelColor = CBase.Theme.GetPlayerColor(_Fields[i].Content.Winner); } - if (Status == EStatus.FieldSelected && SelectedField == i) + if (_Status == EStatus.FieldSelected && _SelectedField == i) { - Fields[i].Button.Texture = CBase.Songs.GetSongByID(Fields[i].Content.SongID).CoverTextureBig; - Fields[i].Button.Color = new SColorF(1, 1, 1, 1); - Fields[i].Button.SelColor = new SColorF(1, 1, 1, 1); - Fields[i].Button.Enabled = false; + _Fields[i].Button.Texture = CBase.Songs.GetSongByID(_Fields[i].Content.SongID).CoverTextureBig; + _Fields[i].Button.Color = new SColorF(1, 1, 1, 1); + _Fields[i].Button.SelColor = new SColorF(1, 1, 1, 1); + _Fields[i].Button.Enabled = false; } - if (Status == EStatus.JokerRetry && Fields[i].Content.Finished) + if (_Status == EStatus.JokerRetry && _Fields[i].Content.Finished) { - Fields[i].Button.SelColor = CBase.Theme.GetPlayerColor(GameData.Team + 1); - Fields[i].Button.Enabled = true; + _Fields[i].Button.SelColor = CBase.Theme.GetPlayerColor(_GameData.Team + 1); + _Fields[i].Button.Enabled = true; } - if (Status == EStatus.JokerRetry && !Fields[i].Content.Finished) - Fields[i].Button.Enabled = false; - if (Status == EStatus.FieldSelected) - Fields[i].Button.Enabled = false; + if (_Status == EStatus.JokerRetry && !_Fields[i].Content.Finished) + _Fields[i].Button.Enabled = false; + if (_Status == EStatus.FieldSelected) + _Fields[i].Button.Enabled = false; } } - private void FieldSelected() + private void _FieldSelected() { - int SongID = 0; - int SingerTeam1 = 0; - int SingerTeam2 = 0; - if (GameData.Songs.Count > 0) + int songID = 0; + int singerTeam1 = 0; + int singerTeam2 = 0; + if (_GameData.Songs.Count > 0) { - SongID = GameData.Songs[0]; - GameData.Songs.RemoveAt(0); + songID = _GameData.Songs[0]; + _GameData.Songs.RemoveAt(0); } - if (GameData.PlayerTeam1.Count > 0) + if (_GameData.PlayerTeam1.Count > 0) { - SingerTeam1 = GameData.PlayerTeam1[0]; - GameData.PlayerTeam1.RemoveAt(0); + singerTeam1 = _GameData.PlayerTeam1[0]; + _GameData.PlayerTeam1.RemoveAt(0); } - if (GameData.PlayerTeam2.Count > 0) + if (_GameData.PlayerTeam2.Count > 0) { - SingerTeam2 = GameData.PlayerTeam2[0]; - GameData.PlayerTeam2.RemoveAt(0); + singerTeam2 = _GameData.PlayerTeam2[0]; + _GameData.PlayerTeam2.RemoveAt(0); } - CSong Song = CBase.Songs.GetSongByID(SongID); + CSong song = CBase.Songs.GetSongByID(songID); CBase.BackgroundMusic.SetStatus(true); - PreviewStream = CBase.Sound.Load(Song.GetMP3(), false); - CBase.Sound.SetPosition(PreviewStream, Song.PreviewStart); - CBase.Sound.SetStreamVolume(PreviewStream, 0f); - CBase.Sound.Play(PreviewStream); - CBase.Sound.Fade(PreviewStream, CBase.Config.GetBackgroundMusicVolume(), 1f); - Status = EStatus.FieldSelected; - Fields[SelectedField].Content.SongID = SongID; - GameData.Rounds[SelectedField].SongID = SongID; - GameData.Rounds[SelectedField].SingerTeam1 = SingerTeam1; - GameData.Rounds[SelectedField].SingerTeam2 = SingerTeam2; - UpdateFieldContents(); + _PreviewStream = CBase.Sound.Load(song.GetMP3(), false); + CBase.Sound.SetPosition(_PreviewStream, song.PreviewStart); + CBase.Sound.SetStreamVolume(_PreviewStream, 0f); + CBase.Sound.Play(_PreviewStream); + CBase.Sound.Fade(_PreviewStream, CBase.Config.GetBackgroundMusicVolume(), 1f); + _Status = EStatus.FieldSelected; + _Fields[_SelectedField].Content.SongID = songID; + _GameData.Rounds[_SelectedField].SongID = songID; + _GameData.Rounds[_SelectedField].SingerTeam1 = singerTeam1; + _GameData.Rounds[_SelectedField].SingerTeam2 = singerTeam2; + _UpdateFieldContents(); - Texts[TextNextPlayerT1].Visible = true; - Texts[TextNextPlayerT2].Visible = true; - Texts[TextNextPlayerNameT1].Visible = true; - Texts[TextNextPlayerNameT2].Visible = true; + Texts[_TextNextPlayerT1].Visible = true; + Texts[_TextNextPlayerT2].Visible = true; + Texts[_TextNextPlayerNameT1].Visible = true; + Texts[_TextNextPlayerNameT2].Visible = true; SProfile[] profiles = CBase.Profiles.GetProfiles(); - Texts[TextNextPlayerNameT1].Text = profiles[GameData.ProfileIDsTeam1[GameData.Rounds[SelectedField].SingerTeam1]].PlayerName; - Texts[TextNextPlayerNameT2].Text = profiles[GameData.ProfileIDsTeam2[GameData.Rounds[SelectedField].SingerTeam2]].PlayerName; - Statics[StaticAvatarT1].Visible = true; - Statics[StaticAvatarT2].Visible = true; - Statics[StaticAvatarT1].Texture = profiles[GameData.ProfileIDsTeam1[GameData.Rounds[SelectedField].SingerTeam1]].Avatar.Texture; - Statics[StaticAvatarT2].Texture = profiles[GameData.ProfileIDsTeam2[GameData.Rounds[SelectedField].SingerTeam2]].Avatar.Texture; + Texts[_TextNextPlayerNameT1].Text = profiles[_GameData.ProfileIDsTeam1[_GameData.Rounds[_SelectedField].SingerTeam1]].PlayerName; + Texts[_TextNextPlayerNameT2].Text = profiles[_GameData.ProfileIDsTeam2[_GameData.Rounds[_SelectedField].SingerTeam2]].PlayerName; + Statics[_StaticAvatarT1].Visible = true; + Statics[_StaticAvatarT2].Visible = true; + Statics[_StaticAvatarT1].Texture = profiles[_GameData.ProfileIDsTeam1[_GameData.Rounds[_SelectedField].SingerTeam1]].Avatar.Texture; + Statics[_StaticAvatarT2].Texture = profiles[_GameData.ProfileIDsTeam2[_GameData.Rounds[_SelectedField].SingerTeam2]].Avatar.Texture; - UpdateJokerButtons(); + _UpdateJokerButtons(); - Buttons[ButtonNextRound].Visible = true; - Buttons[ButtonExit].Visible = true; - Buttons[ButtonBack].Visible = false; + Buttons[_ButtonNextRound].Visible = true; + Buttons[_ButtonExit].Visible = true; + Buttons[_ButtonBack].Visible = false; - SetInteractionToButton(Buttons[ButtonNextRound]); + SetInteractionToButton(Buttons[_ButtonNextRound]); } - private void FieldSelectedAgain() + private void _FieldSelectedAgain() { - int SongID = Fields[SelectedField].Content.SongID; - CSong Song = CBase.Songs.GetSongByID(SongID); + int songID = _Fields[_SelectedField].Content.SongID; + CSong song = CBase.Songs.GetSongByID(songID); CBase.BackgroundMusic.SetStatus(true); - PreviewStream = CBase.Sound.Load(Song.GetMP3(), false); - CBase.Sound.SetPosition(PreviewStream, Song.PreviewStart); - CBase.Sound.SetStreamVolume(PreviewStream, 0f); - CBase.Sound.Play(PreviewStream); - CBase.Sound.Fade(PreviewStream, CBase.Config.GetBackgroundMusicVolume(), 1f); - Status = EStatus.FieldSelected; - Fields[SelectedField].Content.SongID = SongID; - GameData.Rounds[SelectedField].SongID = SongID; - GameData.Rounds[SelectedField].SingerTeam1 = GameData.Rounds[OldSelectedField].SingerTeam1; - GameData.Rounds[SelectedField].SingerTeam2 = GameData.Rounds[OldSelectedField].SingerTeam2; - UpdateFieldContents(); + _PreviewStream = CBase.Sound.Load(song.GetMP3(), false); + CBase.Sound.SetPosition(_PreviewStream, song.PreviewStart); + CBase.Sound.SetStreamVolume(_PreviewStream, 0f); + CBase.Sound.Play(_PreviewStream); + CBase.Sound.Fade(_PreviewStream, CBase.Config.GetBackgroundMusicVolume(), 1f); + _Status = EStatus.FieldSelected; + _Fields[_SelectedField].Content.SongID = songID; + _GameData.Rounds[_SelectedField].SongID = songID; + _GameData.Rounds[_SelectedField].SingerTeam1 = _GameData.Rounds[_OldSelectedField].SingerTeam1; + _GameData.Rounds[_SelectedField].SingerTeam2 = _GameData.Rounds[_OldSelectedField].SingerTeam2; + _UpdateFieldContents(); - Texts[TextNextPlayerT1].Visible = true; - Texts[TextNextPlayerT2].Visible = true; - Texts[TextNextPlayerNameT1].Visible = true; - Texts[TextNextPlayerNameT2].Visible = true; + Texts[_TextNextPlayerT1].Visible = true; + Texts[_TextNextPlayerT2].Visible = true; + Texts[_TextNextPlayerNameT1].Visible = true; + Texts[_TextNextPlayerNameT2].Visible = true; SProfile[] profiles = CBase.Profiles.GetProfiles(); - Texts[TextNextPlayerNameT1].Text = profiles[GameData.ProfileIDsTeam1[GameData.Rounds[SelectedField].SingerTeam1]].PlayerName; - Texts[TextNextPlayerNameT2].Text = profiles[GameData.ProfileIDsTeam2[GameData.Rounds[SelectedField].SingerTeam2]].PlayerName; - Statics[StaticAvatarT1].Visible = true; - Statics[StaticAvatarT2].Visible = true; - Statics[StaticAvatarT1].Texture = profiles[GameData.ProfileIDsTeam1[GameData.Rounds[SelectedField].SingerTeam1]].Avatar.Texture; - Statics[StaticAvatarT2].Texture = profiles[GameData.ProfileIDsTeam2[GameData.Rounds[SelectedField].SingerTeam2]].Avatar.Texture; + Texts[_TextNextPlayerNameT1].Text = profiles[_GameData.ProfileIDsTeam1[_GameData.Rounds[_SelectedField].SingerTeam1]].PlayerName; + Texts[_TextNextPlayerNameT2].Text = profiles[_GameData.ProfileIDsTeam2[_GameData.Rounds[_SelectedField].SingerTeam2]].PlayerName; + Statics[_StaticAvatarT1].Visible = true; + Statics[_StaticAvatarT2].Visible = true; + Statics[_StaticAvatarT1].Texture = profiles[_GameData.ProfileIDsTeam1[_GameData.Rounds[_SelectedField].SingerTeam1]].Avatar.Texture; + Statics[_StaticAvatarT2].Texture = profiles[_GameData.ProfileIDsTeam2[_GameData.Rounds[_SelectedField].SingerTeam2]].Avatar.Texture; - UpdateJokerButtons(); + _UpdateJokerButtons(); - Buttons[ButtonNextRound].Visible = true; - Buttons[ButtonExit].Visible = true; - Buttons[ButtonBack].Visible = false; + Buttons[_ButtonNextRound].Visible = true; + Buttons[_ButtonExit].Visible = true; + Buttons[_ButtonBack].Visible = false; - SetInteractionToButton(Buttons[ButtonNextRound]); + SetInteractionToButton(Buttons[_ButtonNextRound]); } - private void UseJoker(int TeamNr, int JokerNum) + private void _UseJoker(int teamNr, int jokerNum) { - switch (JokerNum) + switch (jokerNum) { //Random-Joker case 0: - if (GameData.NumJokerRandom[TeamNr] > 0) + if (_GameData.NumJokerRandom[teamNr] > 0) { - GameData.NumJokerRandom[TeamNr]--; - if (!CBase.Sound.IsFinished(PreviewStream)) - CBase.Sound.FadeAndStop(PreviewStream, 0, 1); - FieldSelected(); + _GameData.NumJokerRandom[teamNr]--; + if (!CBase.Sound.IsFinished(_PreviewStream)) + CBase.Sound.FadeAndStop(_PreviewStream, 0, 1); + _FieldSelected(); } break; //Retry-Joker case 1: - if (GameData.NumJokerRetry[TeamNr] > 0 && GameData.CurrentRoundNr > 1) + if (_GameData.NumJokerRetry[teamNr] > 0 && _GameData.CurrentRoundNr > 1) { - GameData.NumJokerRetry[TeamNr]--; - GameData.Team = TeamNr; - if (!CBase.Sound.IsFinished(PreviewStream)) - CBase.Sound.FadeAndStop(PreviewStream, 0, 1); - Status = EStatus.JokerRetry; - OldSelectedField = SelectedField; - SelectedField = -1; - UpdateFieldContents(); + _GameData.NumJokerRetry[teamNr]--; + _GameData.Team = teamNr; + if (!CBase.Sound.IsFinished(_PreviewStream)) + CBase.Sound.FadeAndStop(_PreviewStream, 0, 1); + _Status = EStatus.JokerRetry; + _OldSelectedField = _SelectedField; + _SelectedField = -1; + _UpdateFieldContents(); } break; } - UpdateJokerButtons(); + _UpdateJokerButtons(); } - private void UpdateTeamChoosingMessage() + private void _UpdateTeamChoosingMessage() { - Texts[TextTeamChoosing].Color = CBase.Theme.GetPlayerColor(GameData.Team + 1); - Texts[TextTeamChoosing].Text = CBase.Language.Translate("TR_TEAM", _PartyModeID) + " " + (GameData.Team + 1) + "! " + + Texts[_TextTeamChoosing].Color = CBase.Theme.GetPlayerColor(_GameData.Team + 1); + Texts[_TextTeamChoosing].Text = CBase.Language.Translate("TR_TEAM", _PartyModeID) + " " + (_GameData.Team + 1) + "! " + CBase.Language.Translate("TR_SCREENMAIN_TEAM_CHOOSE", _PartyModeID); - if (Status == EStatus.JokerRetry || Status == EStatus.FieldChoosing) - Texts[TextTeamChoosing].Visible = true; + if (_Status == EStatus.JokerRetry || _Status == EStatus.FieldChoosing) + Texts[_TextTeamChoosing].Visible = true; else - Texts[TextTeamChoosing].Visible = false; + Texts[_TextTeamChoosing].Visible = false; } - private void UpdateJokerButtons() + private void _UpdateJokerButtons() { - Buttons[ButtonJokerRandomT1].Visible = true; - Buttons[ButtonJokerRandomT2].Visible = true; - Buttons[ButtonJokerRandomT1].Text.Text = GameData.NumJokerRandom[0].ToString(); - Buttons[ButtonJokerRandomT2].Text.Text = GameData.NumJokerRandom[1].ToString(); - Buttons[ButtonJokerRandomT1].Enabled = GameData.NumJokerRandom[0] > 0; - Buttons[ButtonJokerRandomT2].Enabled = GameData.NumJokerRandom[1] > 0; - Buttons[ButtonJokerRetryT1].Visible = true; - Buttons[ButtonJokerRetryT2].Visible = true; - Buttons[ButtonJokerRetryT1].Text.Text = GameData.NumJokerRetry[0].ToString(); - Buttons[ButtonJokerRetryT2].Text.Text = GameData.NumJokerRetry[1].ToString(); - Buttons[ButtonJokerRetryT1].Enabled = GameData.NumJokerRetry[0] > 0; - Buttons[ButtonJokerRetryT2].Enabled = GameData.NumJokerRetry[1] > 0; + Buttons[_ButtonJokerRandomT1].Visible = true; + Buttons[_ButtonJokerRandomT2].Visible = true; + Buttons[_ButtonJokerRandomT1].Text.Text = _GameData.NumJokerRandom[0].ToString(); + Buttons[_ButtonJokerRandomT2].Text.Text = _GameData.NumJokerRandom[1].ToString(); + Buttons[_ButtonJokerRandomT1].Enabled = _GameData.NumJokerRandom[0] > 0; + Buttons[_ButtonJokerRandomT2].Enabled = _GameData.NumJokerRandom[1] > 0; + Buttons[_ButtonJokerRetryT1].Visible = true; + Buttons[_ButtonJokerRetryT2].Visible = true; + Buttons[_ButtonJokerRetryT1].Text.Text = _GameData.NumJokerRetry[0].ToString(); + Buttons[_ButtonJokerRetryT2].Text.Text = _GameData.NumJokerRetry[1].ToString(); + Buttons[_ButtonJokerRetryT1].Enabled = _GameData.NumJokerRetry[0] > 0; + Buttons[_ButtonJokerRetryT2].Enabled = _GameData.NumJokerRetry[1] > 0; } - private void NextRound() + private void _NextRound() { - CBase.Sound.FadeAndStop(PreviewStream, 0f, 0.5f); - Data.ScreenMain.Rounds = GameData.Rounds; - Data.ScreenMain.FadeToNameSelection = false; - Data.ScreenMain.FadeToSinging = true; - Data.ScreenMain.Songs = GameData.Songs; - Data.ScreenMain.SingRoundNr = SelectedField; - Data.ScreenMain.PlayerTeam1 = GameData.PlayerTeam1; - Data.ScreenMain.PlayerTeam2 = GameData.PlayerTeam2; - _PartyMode.DataFromScreen(ThemeName, Data); + CBase.Sound.FadeAndStop(_PreviewStream, 0f, 0.5f); + _Data.ScreenMain.Rounds = _GameData.Rounds; + _Data.ScreenMain.FadeToNameSelection = false; + _Data.ScreenMain.FadeToSinging = true; + _Data.ScreenMain.Songs = _GameData.Songs; + _Data.ScreenMain.SingRoundNr = _SelectedField; + _Data.ScreenMain.PlayerTeam1 = _GameData.PlayerTeam1; + _Data.ScreenMain.PlayerTeam2 = _GameData.PlayerTeam2; + _PartyMode.DataFromScreen(ThemeName, _Data); } - private void EndParty() + private void _EndParty() { - CBase.Sound.FadeAndStop(PreviewStream, 0f, 0.5f); - FadeTo(EScreens.ScreenParty); + CBase.Sound.FadeAndStop(_PreviewStream, 0f, 0.5f); + _FadeTo(EScreens.ScreenParty); } - private void ShowPopup(bool Visible) + private void _ShowPopup(bool visible) { - ExitPopupVisible = Visible; + _ExitPopupVisible = visible; - Statics[StaticPopupBG].Visible = ExitPopupVisible; - Texts[TextPopupReallyExit].Visible = ExitPopupVisible; - Buttons[ButtonPopupYes].Visible = ExitPopupVisible; - Buttons[ButtonPopupNo].Visible = ExitPopupVisible; + Statics[_StaticPopupBG].Visible = _ExitPopupVisible; + Texts[_TextPopupReallyExit].Visible = _ExitPopupVisible; + Buttons[_ButtonPopupYes].Visible = _ExitPopupVisible; + Buttons[_ButtonPopupNo].Visible = _ExitPopupVisible; - if (ExitPopupVisible) - SetInteractionToButton(Buttons[ButtonPopupNo]); + if (_ExitPopupVisible) + SetInteractionToButton(Buttons[_ButtonPopupNo]); } - private void Back() + private void _Back() { - CBase.Sound.FadeAndStop(PreviewStream, 0f, 0.5f); - Data.ScreenMain.FadeToNameSelection = true; - Data.ScreenMain.FadeToSinging = false; - Data.ScreenMain.SingRoundNr = SelectedField; - _PartyMode.DataFromScreen(ThemeName, Data); + CBase.Sound.FadeAndStop(_PreviewStream, 0f, 0.5f); + _Data.ScreenMain.FadeToNameSelection = true; + _Data.ScreenMain.FadeToSinging = false; + _Data.ScreenMain.SingRoundNr = _SelectedField; + _PartyMode.DataFromScreen(ThemeName, _Data); } - private int BuildWinnerPossibilities() + private int _BuildWinnerPossibilities() { - int NumOneRow = (int)Math.Sqrt(GameData.NumFields); - Possibilities = new int[(NumOneRow * 2) + 2,NumOneRow]; - for (int i = 0; i < Possibilities.GetLength(0); i++) + int numOneRow = (int)Math.Sqrt(_GameData.NumFields); + _Possibilities = new int[(numOneRow * 2) + 2,numOneRow]; + for (int i = 0; i < _Possibilities.GetLength(0); i++) { - if (i < NumOneRow) + if (i < numOneRow) { - for (int c = 0; c < NumOneRow; c++) - Possibilities[i, c] = i * NumOneRow + c; + for (int c = 0; c < numOneRow; c++) + _Possibilities[i, c] = i * numOneRow + c; } - else if (i < NumOneRow * 2) + else if (i < numOneRow * 2) { - for (int c = 0; c < NumOneRow; c++) - Possibilities[i, c] = (i - NumOneRow) + (c * NumOneRow); + for (int c = 0; c < numOneRow; c++) + _Possibilities[i, c] = (i - numOneRow) + (c * numOneRow); } - else if (i == Possibilities.GetLength(0) - 2) + else if (i == _Possibilities.GetLength(0) - 2) { - for (int c = 0; c < NumOneRow; c++) - Possibilities[i, c] = (NumOneRow + 1) * c; + for (int c = 0; c < numOneRow; c++) + _Possibilities[i, c] = (numOneRow + 1) * c; } - else if (i == Possibilities.GetLength(0) - 1) + else if (i == _Possibilities.GetLength(0) - 1) { - for (int c = 0; c < NumOneRow; c++) - Possibilities[i, c] = (NumOneRow - 1) * c + (NumOneRow - 1); + for (int c = 0; c < numOneRow; c++) + _Possibilities[i, c] = (numOneRow - 1) * c + (numOneRow - 1); } } return 0; } - private int GetWinner() + private int _GetWinner() { - for (int i = 0; i < Possibilities.GetLength(0); i++) + for (int i = 0; i < _Possibilities.GetLength(0); i++) { - List Check = new List(); - for (int j = 0; j < Possibilities.GetLength(1); j++) + List check = new List(); + for (int j = 0; j < _Possibilities.GetLength(1); j++) { - if (Fields[Possibilities[i, j]].Content.Winner > 0) - Check.Add(Fields[Possibilities[i, j]].Content.Winner); + if (_Fields[_Possibilities[i, j]].Content.Winner > 0) + check.Add(_Fields[_Possibilities[i, j]].Content.Winner); } - if (Check.Count == Possibilities.GetLength(1)) + if (check.Count == _Possibilities.GetLength(1)) { //Check for winner - if (Check.Contains(1) && !Check.Contains(2)) + if (check.Contains(1) && !check.Contains(2)) return 1; - else if (Check.Contains(2) && !Check.Contains(1)) + else if (check.Contains(2) && !check.Contains(1)) return 2; } } diff --git a/PartyModes/PartyModeTicTacToe/PartyScreenTicTacToeNames.cs b/PartyModes/PartyModeTicTacToe/PartyScreenTicTacToeNames.cs index e4fe9478..05d5eb5b 100644 --- a/PartyModes/PartyModeTicTacToe/PartyScreenTicTacToeNames.cs +++ b/PartyModes/PartyModeTicTacToe/PartyScreenTicTacToeNames.cs @@ -5,7 +5,7 @@ using VocaluxeLib.Menu; namespace VocaluxeLib.PartyModes.TicTacToe { - public class PartyScreenTicTacToeNames : CMenuParty + public class CPartyScreenTicTacToeNames : CMenuParty { // Version number for theme files. Increment it, if you've changed something on the theme files! protected override int _ScreenVersion @@ -13,43 +13,43 @@ namespace VocaluxeLib.PartyModes.TicTacToe get { return 1; } } - private const string ButtonNext = "ButtonNext"; - private const string ButtonBack = "ButtonBack"; - private const string ButtonPlayerDestination = "ButtonPlayerDestination"; - private const string ButtonPlayerChoose = "ButtonPlayerChoose"; - private const string ButtonPlayerChooseScrollUp = "ButtonPlayerChooseScrollUp"; - private const string ButtonPlayerChooseScrollDown = "ButtonPlayerChooseScrollDown"; + private const string _ButtonNext = "ButtonNext"; + private const string _ButtonBack = "ButtonBack"; + private const string _ButtonPlayerDestination = "ButtonPlayerDestination"; + private const string _ButtonPlayerChoose = "ButtonPlayerChoose"; + private const string _ButtonPlayerChooseScrollUp = "ButtonPlayerChooseScrollUp"; + private const string _ButtonPlayerChooseScrollDown = "ButtonPlayerChooseScrollDown"; - private List PlayerChooseButtons; - private List PlayerDestinationButtons; + private List _PlayerChooseButtons; + private List _PlayerDestinationButtons; //PlayerDestinationButtons-Option - private const int PlayerDestinationButtonsNumH = 10; - private const int PlayerDestinationButtonsNumW = 2; - private const int PlayerDestinationButtonsFirstX = 58; - private const int PlayerDestinationButtonsFirstY = 380; - private const int PlayerDestinationButtonsSpaceH = 15; - private const int PlayerDestinationButtonsSpaceW = 25; + private const int _PlayerDestinationButtonsNumH = 10; + private const int _PlayerDestinationButtonsNumW = 2; + private const int _PlayerDestinationButtonsFirstX = 58; + private const int _PlayerDestinationButtonsFirstY = 380; + private const int _PlayerDestinationButtonsSpaceH = 15; + private const int _PlayerDestinationButtonsSpaceW = 25; //PlayerChooseButtons-Option - private List PlayerChooseButtonsVisibleProfiles; - private const int PlayerChooseButtonsNumH = 10; - private const int PlayerChooseButtonsNumW = 2; - private const int PlayerChooseButtonsFirstX = 58; - private const int PlayerChooseButtonsFirstY = 105; - private const int PlayerChooseButtonsSpaceH = 15; - private const int PlayerChooseButtonsSpaceW = 25; - private int PlayerChooseButtonsOffset; + private List _PlayerChooseButtonsVisibleProfiles; + private const int _PlayerChooseButtonsNumH = 10; + private const int _PlayerChooseButtonsNumW = 2; + private const int _PlayerChooseButtonsFirstX = 58; + private const int _PlayerChooseButtonsFirstY = 105; + private const int _PlayerChooseButtonsSpaceH = 15; + private const int _PlayerChooseButtonsSpaceW = 25; + private int _PlayerChooseButtonsOffset; - private CStatic chooseAvatarStatic; - private bool SelectingMouseActive; - private int OldMouseX; - private int OldMouseY; - private int SelectedPlayerNr = -1; - private bool ButtonsAdded; + private CStatic _ChooseAvatarStatic; + private bool _SelectingMouseActive; + private int _OldMouseX; + private int _OldMouseY; + private int _SelectedPlayerNr = -1; + private bool _ButtonsAdded; - private int NumPlayerTeam1 = 2; - private int NumPlayerTeam2 = 2; + private int _NumPlayerTeam1 = 2; + private int _NumPlayerTeam2 = 2; - private DataFromScreen Data; + private SDataFromScreen _Data; private class CPlayerChooseButton { @@ -61,47 +61,47 @@ namespace VocaluxeLib.PartyModes.TicTacToe { base.Init(); - chooseAvatarStatic = GetNewStatic(); - chooseAvatarStatic.Visible = false; + _ChooseAvatarStatic = GetNewStatic(); + _ChooseAvatarStatic.Visible = false; - PlayerChooseButtonsVisibleProfiles = new List(); + _PlayerChooseButtonsVisibleProfiles = new List(); - Data.ScreenNames.ProfileIDsTeam1 = new List(); - Data.ScreenNames.ProfileIDsTeam2 = new List(); + _Data.ScreenNames.ProfileIDsTeam1 = new List(); + _Data.ScreenNames.ProfileIDsTeam2 = new List(); List buttons = new List(); - _ThemeButtons = new string[] {ButtonBack, ButtonNext, ButtonPlayerDestination, ButtonPlayerChoose, ButtonPlayerChooseScrollUp, ButtonPlayerChooseScrollDown}; + _ThemeButtons = new string[] {_ButtonBack, _ButtonNext, _ButtonPlayerDestination, _ButtonPlayerChoose, _ButtonPlayerChooseScrollUp, _ButtonPlayerChooseScrollDown}; - Data = new DataFromScreen(); - FromScreenNames names = new FromScreenNames(); + _Data = new SDataFromScreen(); + SFromScreenNames names = new SFromScreenNames(); names.FadeToConfig = false; names.FadeToMain = false; names.ProfileIDsTeam1 = new List(); names.ProfileIDsTeam2 = new List(); - Data.ScreenNames = names; + _Data.ScreenNames = names; } - public override void DataToScreen(object ReceivedData) + public override void DataToScreen(object receivedData) { - DataToScreenNames config = new DataToScreenNames(); + SDataToScreenNames config = new SDataToScreenNames(); try { - config = (DataToScreenNames)ReceivedData; - Data.ScreenNames.ProfileIDsTeam1 = config.ProfileIDsTeam1; - Data.ScreenNames.ProfileIDsTeam2 = config.ProfileIDsTeam2; - if (Data.ScreenNames.ProfileIDsTeam1 == null) - Data.ScreenNames.ProfileIDsTeam1 = new List(); - if (Data.ScreenNames.ProfileIDsTeam2 == null) - Data.ScreenNames.ProfileIDsTeam2 = new List(); + config = (SDataToScreenNames)receivedData; + _Data.ScreenNames.ProfileIDsTeam1 = config.ProfileIDsTeam1; + _Data.ScreenNames.ProfileIDsTeam2 = config.ProfileIDsTeam2; + if (_Data.ScreenNames.ProfileIDsTeam1 == null) + _Data.ScreenNames.ProfileIDsTeam1 = new List(); + if (_Data.ScreenNames.ProfileIDsTeam2 == null) + _Data.ScreenNames.ProfileIDsTeam2 = new List(); - NumPlayerTeam1 = config.NumPlayerTeam1; - NumPlayerTeam2 = config.NumPlayerTeam2; + _NumPlayerTeam1 = config.NumPlayerTeam1; + _NumPlayerTeam2 = config.NumPlayerTeam2; - while (Data.ScreenNames.ProfileIDsTeam1.Count > NumPlayerTeam1) - Data.ScreenNames.ProfileIDsTeam1.RemoveAt(Data.ScreenNames.ProfileIDsTeam1.Count - 1); - while (Data.ScreenNames.ProfileIDsTeam2.Count > NumPlayerTeam2) - Data.ScreenNames.ProfileIDsTeam2.RemoveAt(Data.ScreenNames.ProfileIDsTeam2.Count - 1); + while (_Data.ScreenNames.ProfileIDsTeam1.Count > _NumPlayerTeam1) + _Data.ScreenNames.ProfileIDsTeam1.RemoveAt(_Data.ScreenNames.ProfileIDsTeam1.Count - 1); + while (_Data.ScreenNames.ProfileIDsTeam2.Count > _NumPlayerTeam2) + _Data.ScreenNames.ProfileIDsTeam2.RemoveAt(_Data.ScreenNames.ProfileIDsTeam2.Count - 1); } catch (Exception e) { @@ -109,7 +109,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe } } - public override bool HandleInput(KeyEvent keyEvent) + public override bool HandleInput(SKeyEvent keyEvent) { base.HandleInput(keyEvent); @@ -120,60 +120,60 @@ namespace VocaluxeLib.PartyModes.TicTacToe { case Keys.Back: case Keys.Escape: - Back(); + _Back(); break; case Keys.Enter: - if (Buttons[ButtonBack].Selected) - Back(); + if (Buttons[_ButtonBack].Selected) + _Back(); - if (Buttons[ButtonNext].Selected) - Next(); + if (Buttons[_ButtonNext].Selected) + _Next(); - if (Buttons[ButtonPlayerChooseScrollUp].Selected) - Scroll(-1); + if (Buttons[_ButtonPlayerChooseScrollUp].Selected) + _Scroll(-1); - if (Buttons[ButtonPlayerChooseScrollDown].Selected) - Scroll(1); + if (Buttons[_ButtonPlayerChooseScrollDown].Selected) + _Scroll(1); - if (!OnAdd()) - OnRemove(); + if (!_OnAdd()) + _OnRemove(); break; case Keys.Delete: - OnRemove(); + _OnRemove(); break; } } return true; } - public override bool HandleMouse(MouseEvent mouseEvent) + public override bool HandleMouse(SMouseEvent mouseEvent) { base.HandleMouse(mouseEvent); //Check if LeftButton is hold and Select-Mode inactive - if (mouseEvent.LBH && !SelectingMouseActive) + if (mouseEvent.LBH && !_SelectingMouseActive) { //Save mouse-coords - OldMouseX = mouseEvent.X; - OldMouseY = mouseEvent.Y; + _OldMouseX = mouseEvent.X; + _OldMouseY = mouseEvent.Y; //Check if mouse if over tile - for (int i = 0; i < PlayerChooseButtons.Count; i++) + for (int i = 0; i < _PlayerChooseButtons.Count; i++) { - if (PlayerChooseButtons[i].Button.Selected) + if (_PlayerChooseButtons[i].Button.Selected) { - SelectedPlayerNr = PlayerChooseButtons[i].ProfileID; - if (SelectedPlayerNr != -1) + _SelectedPlayerNr = _PlayerChooseButtons[i].ProfileID; + if (_SelectedPlayerNr != -1) { //Activate mouse-selecting - SelectingMouseActive = true; + _SelectingMouseActive = true; //Update of Drag/Drop-Texture - chooseAvatarStatic.Visible = true; - chooseAvatarStatic.Rect = PlayerChooseButtons[i].Button.Rect; - chooseAvatarStatic.Rect.Z = -100; - chooseAvatarStatic.Color = new SColorF(1, 1, 1, 1); - chooseAvatarStatic.Texture = CBase.Profiles.GetProfiles()[SelectedPlayerNr].Avatar.Texture; + _ChooseAvatarStatic.Visible = true; + _ChooseAvatarStatic.Rect = _PlayerChooseButtons[i].Button.Rect; + _ChooseAvatarStatic.Rect.Z = -100; + _ChooseAvatarStatic.Color = new SColorF(1, 1, 1, 1); + _ChooseAvatarStatic.Texture = CBase.Profiles.GetProfiles()[_SelectedPlayerNr].Avatar.Texture; } } } @@ -181,103 +181,103 @@ namespace VocaluxeLib.PartyModes.TicTacToe } //Check if LeftButton is hold and Select-Mode active - if (mouseEvent.LBH && SelectingMouseActive) + if (mouseEvent.LBH && _SelectingMouseActive) { //Update coords for Drag/Drop-Texture - chooseAvatarStatic.Rect.X += mouseEvent.X - OldMouseX; - chooseAvatarStatic.Rect.Y += mouseEvent.Y - OldMouseY; - OldMouseX = mouseEvent.X; - OldMouseY = mouseEvent.Y; + _ChooseAvatarStatic.Rect.X += mouseEvent.X - _OldMouseX; + _ChooseAvatarStatic.Rect.Y += mouseEvent.Y - _OldMouseY; + _OldMouseX = mouseEvent.X; + _OldMouseY = mouseEvent.Y; return true; } // LeftButton isn't hold anymore, but Selec-Mode is still active -> "Drop" of Avatar - else if (SelectingMouseActive) + else if (_SelectingMouseActive) { //Check if really a player was selected - if (SelectedPlayerNr != -1) + if (_SelectedPlayerNr != -1) { //Foreach Drop-Area - for (int i = 0; i < PlayerDestinationButtons.Count; i++) + for (int i = 0; i < _PlayerDestinationButtons.Count; i++) { //Check first, if area is "active" - if (PlayerDestinationButtons[i].Visible) + if (_PlayerDestinationButtons[i].Visible) { //Check if Mouse is in area - if (CHelper.IsInBounds(PlayerDestinationButtons[i].Rect, mouseEvent)) + if (CHelper.IsInBounds(_PlayerDestinationButtons[i].Rect, mouseEvent)) { int added = -1; //Add Player-ID to list. - if (i - PlayerDestinationButtonsNumH < 0) + if (i - _PlayerDestinationButtonsNumH < 0) { - if (Data.ScreenNames.ProfileIDsTeam1.Count < (i + 1)) + if (_Data.ScreenNames.ProfileIDsTeam1.Count < (i + 1)) { - Data.ScreenNames.ProfileIDsTeam1.Add(SelectedPlayerNr); - added = Data.ScreenNames.ProfileIDsTeam1.Count - 1; + _Data.ScreenNames.ProfileIDsTeam1.Add(_SelectedPlayerNr); + added = _Data.ScreenNames.ProfileIDsTeam1.Count - 1; } - else if (Data.ScreenNames.ProfileIDsTeam1.Count >= (i + 1)) + else if (_Data.ScreenNames.ProfileIDsTeam1.Count >= (i + 1)) { - Data.ScreenNames.ProfileIDsTeam1[i] = SelectedPlayerNr; + _Data.ScreenNames.ProfileIDsTeam1[i] = _SelectedPlayerNr; added = i; } } - else if (i - PlayerDestinationButtonsNumH >= 0) + else if (i - _PlayerDestinationButtonsNumH >= 0) { - if (Data.ScreenNames.ProfileIDsTeam2.Count < ((i - PlayerDestinationButtonsNumH) + 1)) + if (_Data.ScreenNames.ProfileIDsTeam2.Count < ((i - _PlayerDestinationButtonsNumH) + 1)) { - Data.ScreenNames.ProfileIDsTeam2.Add(SelectedPlayerNr); - added = Data.ScreenNames.ProfileIDsTeam2.Count - 1 + PlayerDestinationButtonsNumH; + _Data.ScreenNames.ProfileIDsTeam2.Add(_SelectedPlayerNr); + added = _Data.ScreenNames.ProfileIDsTeam2.Count - 1 + _PlayerDestinationButtonsNumH; } - else if (Data.ScreenNames.ProfileIDsTeam2.Count >= ((i - PlayerDestinationButtonsNumH) + 1)) + else if (_Data.ScreenNames.ProfileIDsTeam2.Count >= ((i - _PlayerDestinationButtonsNumH) + 1)) { - Data.ScreenNames.ProfileIDsTeam2[i - PlayerDestinationButtonsNumH] = SelectedPlayerNr; + _Data.ScreenNames.ProfileIDsTeam2[i - _PlayerDestinationButtonsNumH] = _SelectedPlayerNr; added = i; } } - UpdateButtonNext(); + _UpdateButtonNext(); //Update texture and name - PlayerDestinationButtons[added].Color = new SColorF(1, 1, 1, 0.6f); - PlayerDestinationButtons[added].SelColor = new SColorF(1, 1, 1, 1); - PlayerDestinationButtons[added].Texture = chooseAvatarStatic.Texture; - PlayerDestinationButtons[added].SelTexture = chooseAvatarStatic.Texture; - PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetProfiles()[SelectedPlayerNr].PlayerName; - PlayerDestinationButtons[added].Enabled = true; + _PlayerDestinationButtons[added].Color = new SColorF(1, 1, 1, 0.6f); + _PlayerDestinationButtons[added].SelColor = new SColorF(1, 1, 1, 1); + _PlayerDestinationButtons[added].Texture = _ChooseAvatarStatic.Texture; + _PlayerDestinationButtons[added].SelTexture = _ChooseAvatarStatic.Texture; + _PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetProfiles()[_SelectedPlayerNr].PlayerName; + _PlayerDestinationButtons[added].Enabled = true; //Update Tiles-List - UpdateButtonPlayerChoose(); + _UpdateButtonPlayerChoose(); } } } - SelectedPlayerNr = -1; + _SelectedPlayerNr = -1; } //Reset variables - SelectingMouseActive = false; - chooseAvatarStatic.Visible = false; + _SelectingMouseActive = false; + _ChooseAvatarStatic.Visible = false; return true; } if (mouseEvent.LB && IsMouseOver(mouseEvent)) { - if (Buttons[ButtonBack].Selected) - Back(); + if (Buttons[_ButtonBack].Selected) + _Back(); - if (Buttons[ButtonNext].Selected) - Next(); + if (Buttons[_ButtonNext].Selected) + _Next(); - if (Buttons[ButtonPlayerChooseScrollUp].Selected) - Scroll(-1); + if (Buttons[_ButtonPlayerChooseScrollUp].Selected) + _Scroll(-1); - if (Buttons[ButtonPlayerChooseScrollDown].Selected) - Scroll(1); + if (Buttons[_ButtonPlayerChooseScrollDown].Selected) + _Scroll(1); } if (mouseEvent.LD && IsMouseOver(mouseEvent)) { - if (!OnAdd()) - OnRemove(); + if (!_OnAdd()) + _OnRemove(); } if (mouseEvent.RB) - Back(); + _Back(); return true; } @@ -286,17 +286,17 @@ namespace VocaluxeLib.PartyModes.TicTacToe { base.OnShow(); - if (!ButtonsAdded) + if (!_ButtonsAdded) { - AddButtonPlayerDestination(); - AddButtonPlayerChoose(); - ButtonsAdded = true; + _AddButtonPlayerDestination(); + _AddButtonPlayerChoose(); + _ButtonsAdded = true; } - UpdateButtonPlayerDestination(); - UpdateButtonPlayerChoose(); + _UpdateButtonPlayerDestination(); + _UpdateButtonPlayerChoose(); - UpdateButtonNext(); + _UpdateButtonNext(); } public override bool UpdateGame() @@ -307,39 +307,39 @@ namespace VocaluxeLib.PartyModes.TicTacToe public override bool Draw() { base.Draw(); - if (chooseAvatarStatic.Visible) - chooseAvatarStatic.Draw(); + if (_ChooseAvatarStatic.Visible) + _ChooseAvatarStatic.Draw(); return true; } - private void Scroll(int Offset) + private void _Scroll(int offset) { - if (Offset < 0 && PlayerChooseButtonsOffset > 0) + if (offset < 0 && _PlayerChooseButtonsOffset > 0) { - PlayerChooseButtonsOffset += Offset; - UpdateButtonPlayerChoose(); + _PlayerChooseButtonsOffset += offset; + _UpdateButtonPlayerChoose(); } - else if (PlayerChooseButtonsVisibleProfiles.Count < PlayerChooseButtons.Count + (PlayerChooseButtonsOffset + Offset) * PlayerChooseButtonsNumH) + else if (_PlayerChooseButtonsVisibleProfiles.Count < _PlayerChooseButtons.Count + (_PlayerChooseButtonsOffset + offset) * _PlayerChooseButtonsNumH) { - PlayerChooseButtonsOffset += Offset; - UpdateButtonPlayerChoose(); + _PlayerChooseButtonsOffset += offset; + _UpdateButtonPlayerChoose(); } } - private void AddButtonPlayerDestination() + private void _AddButtonPlayerDestination() { - Buttons[ButtonPlayerDestination].Visible = false; - PlayerDestinationButtons = new List(); + Buttons[_ButtonPlayerDestination].Visible = false; + _PlayerDestinationButtons = new List(); int row = 0; int column = 0; for (int i = 1; i <= _PartyMode.GetMaxPlayer(); i++) { - CButton b = GetNewButton(Buttons[ButtonPlayerDestination]); - b.Rect.X = PlayerDestinationButtonsFirstX + column * (b.Rect.W + PlayerDestinationButtonsSpaceH); - b.Rect.Y = PlayerDestinationButtonsFirstY + row * (b.Rect.H + PlayerDestinationButtonsSpaceW); - PlayerDestinationButtons.Add(b); + CButton b = GetNewButton(Buttons[_ButtonPlayerDestination]); + b.Rect.X = _PlayerDestinationButtonsFirstX + column * (b.Rect.W + _PlayerDestinationButtonsSpaceH); + b.Rect.Y = _PlayerDestinationButtonsFirstY + row * (b.Rect.H + _PlayerDestinationButtonsSpaceW); + _PlayerDestinationButtons.Add(b); column++; - if (column >= PlayerDestinationButtonsNumH) + if (column >= _PlayerDestinationButtonsNumH) { row++; column = 0; @@ -350,23 +350,23 @@ namespace VocaluxeLib.PartyModes.TicTacToe } } - private void AddButtonPlayerChoose() + private void _AddButtonPlayerChoose() { - Buttons[ButtonPlayerChoose].Visible = false; - PlayerChooseButtons = new List(); + Buttons[_ButtonPlayerChoose].Visible = false; + _PlayerChooseButtons = new List(); int row = 0; int column = 0; - for (int i = 1; i <= PlayerChooseButtonsNumH * PlayerChooseButtonsNumW; i++) + for (int i = 1; i <= _PlayerChooseButtonsNumH * _PlayerChooseButtonsNumW; i++) { - CButton b = GetNewButton(Buttons[ButtonPlayerChoose]); - b.Rect.X = PlayerChooseButtonsFirstX + column * (b.Rect.W + PlayerChooseButtonsSpaceH); - b.Rect.Y = PlayerChooseButtonsFirstY + row * (b.Rect.H + PlayerChooseButtonsSpaceW); + CButton b = GetNewButton(Buttons[_ButtonPlayerChoose]); + b.Rect.X = _PlayerChooseButtonsFirstX + column * (b.Rect.W + _PlayerChooseButtonsSpaceH); + b.Rect.Y = _PlayerChooseButtonsFirstY + row * (b.Rect.H + _PlayerChooseButtonsSpaceW); CPlayerChooseButton pcb = new CPlayerChooseButton(); pcb.Button = b; pcb.ProfileID = -1; - PlayerChooseButtons.Add(pcb); + _PlayerChooseButtons.Add(pcb); column++; - if (column >= PlayerChooseButtonsNumH) + if (column >= _PlayerChooseButtonsNumH) { row++; column = 0; @@ -377,56 +377,56 @@ namespace VocaluxeLib.PartyModes.TicTacToe } } - private void UpdateButtonPlayerChoose() + private void _UpdateButtonPlayerChoose() { - UpdateVisibleProfiles(); - if ((PlayerChooseButtonsNumW * PlayerChooseButtonsNumH) * (PlayerChooseButtonsOffset + 1) - PlayerChooseButtonsVisibleProfiles.Count >= - (PlayerChooseButtonsNumW * PlayerChooseButtonsNumH) * PlayerChooseButtonsOffset) - UpdateButtonPlayerChoose(PlayerChooseButtonsOffset - 1); + _UpdateVisibleProfiles(); + if ((_PlayerChooseButtonsNumW * _PlayerChooseButtonsNumH) * (_PlayerChooseButtonsOffset + 1) - _PlayerChooseButtonsVisibleProfiles.Count >= + (_PlayerChooseButtonsNumW * _PlayerChooseButtonsNumH) * _PlayerChooseButtonsOffset) + _UpdateButtonPlayerChoose(_PlayerChooseButtonsOffset - 1); else - UpdateButtonPlayerChoose(PlayerChooseButtonsOffset); - Buttons[ButtonPlayerChooseScrollUp].Enabled = PlayerChooseButtonsOffset > 0; - Buttons[ButtonPlayerChooseScrollDown].Enabled = PlayerChooseButtonsVisibleProfiles.Count > - PlayerChooseButtons.Count + PlayerChooseButtonsOffset * PlayerChooseButtonsNumH; + _UpdateButtonPlayerChoose(_PlayerChooseButtonsOffset); + Buttons[_ButtonPlayerChooseScrollUp].Enabled = _PlayerChooseButtonsOffset > 0; + Buttons[_ButtonPlayerChooseScrollDown].Enabled = _PlayerChooseButtonsVisibleProfiles.Count > + _PlayerChooseButtons.Count + _PlayerChooseButtonsOffset * _PlayerChooseButtonsNumH; } - private void UpdateButtonPlayerChoose(int Offset) + private void _UpdateButtonPlayerChoose(int offset) { - int NumButtonPlayerChoose = PlayerChooseButtonsNumW * PlayerChooseButtonsNumH; - if (Offset < 0) - Offset = 0; + int numButtonPlayerChoose = _PlayerChooseButtonsNumW * _PlayerChooseButtonsNumH; + if (offset < 0) + offset = 0; - if (NumButtonPlayerChoose * (Offset + 1) - PlayerChooseButtonsVisibleProfiles.Count <= NumButtonPlayerChoose) + if (numButtonPlayerChoose * (offset + 1) - _PlayerChooseButtonsVisibleProfiles.Count <= numButtonPlayerChoose) { - for (int i = 0; i < NumButtonPlayerChoose; i++) + for (int i = 0; i < numButtonPlayerChoose; i++) { - if ((i + Offset * NumButtonPlayerChoose) < PlayerChooseButtonsVisibleProfiles.Count) + if ((i + offset * numButtonPlayerChoose) < _PlayerChooseButtonsVisibleProfiles.Count) { - PlayerChooseButtons[i].ProfileID = PlayerChooseButtonsVisibleProfiles[i + Offset * NumButtonPlayerChoose]; - PlayerChooseButtons[i].Button.Text.Text = CBase.Profiles.GetProfiles()[PlayerChooseButtonsVisibleProfiles[i + Offset * NumButtonPlayerChoose]].PlayerName; - PlayerChooseButtons[i].Button.Texture = CBase.Profiles.GetProfiles()[PlayerChooseButtonsVisibleProfiles[i + Offset * NumButtonPlayerChoose]].Avatar.Texture; - PlayerChooseButtons[i].Button.SelTexture = CBase.Profiles.GetProfiles()[PlayerChooseButtonsVisibleProfiles[i + Offset * NumButtonPlayerChoose]].Avatar.Texture; - PlayerChooseButtons[i].Button.Color = new SColorF(1, 1, 1, 0.6f); - PlayerChooseButtons[i].Button.SelColor = new SColorF(1, 1, 1, 1); - PlayerChooseButtons[i].Button.Enabled = true; + _PlayerChooseButtons[i].ProfileID = _PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose]; + _PlayerChooseButtons[i].Button.Text.Text = CBase.Profiles.GetProfiles()[_PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose]].PlayerName; + _PlayerChooseButtons[i].Button.Texture = CBase.Profiles.GetProfiles()[_PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose]].Avatar.Texture; + _PlayerChooseButtons[i].Button.SelTexture = CBase.Profiles.GetProfiles()[_PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose]].Avatar.Texture; + _PlayerChooseButtons[i].Button.Color = new SColorF(1, 1, 1, 0.6f); + _PlayerChooseButtons[i].Button.SelColor = new SColorF(1, 1, 1, 1); + _PlayerChooseButtons[i].Button.Enabled = true; } else { - PlayerChooseButtons[i].ProfileID = -1; - PlayerChooseButtons[i].Button.Text.Text = String.Empty; - PlayerChooseButtons[i].Button.Texture = Buttons[ButtonPlayerChoose].Texture; - PlayerChooseButtons[i].Button.SelTexture = Buttons[ButtonPlayerChoose].SelTexture; - PlayerChooseButtons[i].Button.Color = Buttons[ButtonPlayerChoose].Color; - PlayerChooseButtons[i].Button.SelColor = Buttons[ButtonPlayerChoose].SelColor; - PlayerChooseButtons[i].Button.Enabled = false; + _PlayerChooseButtons[i].ProfileID = -1; + _PlayerChooseButtons[i].Button.Text.Text = String.Empty; + _PlayerChooseButtons[i].Button.Texture = Buttons[_ButtonPlayerChoose].Texture; + _PlayerChooseButtons[i].Button.SelTexture = Buttons[_ButtonPlayerChoose].SelTexture; + _PlayerChooseButtons[i].Button.Color = Buttons[_ButtonPlayerChoose].Color; + _PlayerChooseButtons[i].Button.SelColor = Buttons[_ButtonPlayerChoose].SelColor; + _PlayerChooseButtons[i].Button.Enabled = false; } } } } - private void UpdateVisibleProfiles() + private void _UpdateVisibleProfiles() { - PlayerChooseButtonsVisibleProfiles.Clear(); + _PlayerChooseButtonsVisibleProfiles.Clear(); for (int i = 0; i < CBase.Profiles.GetProfiles().Length; i++) { bool visible = false; @@ -435,20 +435,20 @@ namespace VocaluxeLib.PartyModes.TicTacToe { visible = true; - for (int p = 0; p < Data.ScreenNames.ProfileIDsTeam1.Count; p++) + for (int p = 0; p < _Data.ScreenNames.ProfileIDsTeam1.Count; p++) { //Don't show profile if is selected - if (Data.ScreenNames.ProfileIDsTeam1[p] == i) + if (_Data.ScreenNames.ProfileIDsTeam1[p] == i) { visible = false; break; } } - for (int p = 0; p < Data.ScreenNames.ProfileIDsTeam2.Count; p++) + for (int p = 0; p < _Data.ScreenNames.ProfileIDsTeam2.Count; p++) { //Don't show profile if is selected - if (Data.ScreenNames.ProfileIDsTeam2[p] == i) + if (_Data.ScreenNames.ProfileIDsTeam2[p] == i) { visible = false; break; @@ -456,136 +456,136 @@ namespace VocaluxeLib.PartyModes.TicTacToe } } if (visible) - PlayerChooseButtonsVisibleProfiles.Add(i); + _PlayerChooseButtonsVisibleProfiles.Add(i); } } - private void UpdateButtonPlayerDestination() + private void _UpdateButtonPlayerDestination() { - for (int i = 0; i < PlayerDestinationButtons.Count / 2; i++) + for (int i = 0; i < _PlayerDestinationButtons.Count / 2; i++) { - if (NumPlayerTeam1 > i) + if (_NumPlayerTeam1 > i) { - PlayerDestinationButtons[i].Visible = true; - PlayerDestinationButtons[i].Enabled = true; + _PlayerDestinationButtons[i].Visible = true; + _PlayerDestinationButtons[i].Enabled = true; } else { - PlayerDestinationButtons[i].Visible = false; - PlayerDestinationButtons[i].Enabled = false; + _PlayerDestinationButtons[i].Visible = false; + _PlayerDestinationButtons[i].Enabled = false; } } - for (int i = 0; i < PlayerDestinationButtons.Count / 2; i++) + for (int i = 0; i < _PlayerDestinationButtons.Count / 2; i++) { - if (NumPlayerTeam2 > i) + if (_NumPlayerTeam2 > i) { - PlayerDestinationButtons[i + PlayerDestinationButtonsNumH].Visible = true; - PlayerDestinationButtons[i + PlayerDestinationButtonsNumH].Enabled = true; + _PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].Visible = true; + _PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].Enabled = true; } else { - PlayerDestinationButtons[i + PlayerDestinationButtonsNumH].Visible = false; - PlayerDestinationButtons[i + PlayerDestinationButtonsNumH].Enabled = false; + _PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].Visible = false; + _PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].Enabled = false; } } - for (int i = 0; i < NumPlayerTeam1; i++) + for (int i = 0; i < _NumPlayerTeam1; i++) { - if (i < Data.ScreenNames.ProfileIDsTeam1.Count) + if (i < _Data.ScreenNames.ProfileIDsTeam1.Count) { - if (Data.ScreenNames.ProfileIDsTeam1[i] != -1) + if (_Data.ScreenNames.ProfileIDsTeam1[i] != -1) { - PlayerDestinationButtons[i].Color = new SColorF(1, 1, 1, 0.6f); - PlayerDestinationButtons[i].SelColor = new SColorF(1, 1, 1, 1); - PlayerDestinationButtons[i].Texture = CBase.Profiles.GetProfiles()[Data.ScreenNames.ProfileIDsTeam1[i]].Avatar.Texture; - PlayerDestinationButtons[i].SelTexture = CBase.Profiles.GetProfiles()[Data.ScreenNames.ProfileIDsTeam1[i]].Avatar.Texture; - PlayerDestinationButtons[i].Text.Text = CBase.Profiles.GetProfiles()[Data.ScreenNames.ProfileIDsTeam1[i]].PlayerName; - PlayerDestinationButtons[i].Enabled = true; + _PlayerDestinationButtons[i].Color = new SColorF(1, 1, 1, 0.6f); + _PlayerDestinationButtons[i].SelColor = new SColorF(1, 1, 1, 1); + _PlayerDestinationButtons[i].Texture = CBase.Profiles.GetProfiles()[_Data.ScreenNames.ProfileIDsTeam1[i]].Avatar.Texture; + _PlayerDestinationButtons[i].SelTexture = CBase.Profiles.GetProfiles()[_Data.ScreenNames.ProfileIDsTeam1[i]].Avatar.Texture; + _PlayerDestinationButtons[i].Text.Text = CBase.Profiles.GetProfiles()[_Data.ScreenNames.ProfileIDsTeam1[i]].PlayerName; + _PlayerDestinationButtons[i].Enabled = true; } } else { - PlayerDestinationButtons[i].Color = Buttons[ButtonPlayerDestination].Color; - PlayerDestinationButtons[i].SelColor = Buttons[ButtonPlayerDestination].SelColor; - PlayerDestinationButtons[i].Texture = Buttons[ButtonPlayerDestination].Texture; - PlayerDestinationButtons[i].SelTexture = Buttons[ButtonPlayerDestination].SelTexture; - PlayerDestinationButtons[i].Text.Text = String.Empty; - PlayerDestinationButtons[i].Enabled = false; + _PlayerDestinationButtons[i].Color = Buttons[_ButtonPlayerDestination].Color; + _PlayerDestinationButtons[i].SelColor = Buttons[_ButtonPlayerDestination].SelColor; + _PlayerDestinationButtons[i].Texture = Buttons[_ButtonPlayerDestination].Texture; + _PlayerDestinationButtons[i].SelTexture = Buttons[_ButtonPlayerDestination].SelTexture; + _PlayerDestinationButtons[i].Text.Text = String.Empty; + _PlayerDestinationButtons[i].Enabled = false; } } - for (int i = 0; i < NumPlayerTeam2; i++) + for (int i = 0; i < _NumPlayerTeam2; i++) { - if (i < Data.ScreenNames.ProfileIDsTeam2.Count) + if (i < _Data.ScreenNames.ProfileIDsTeam2.Count) { - if (Data.ScreenNames.ProfileIDsTeam2[i] != -1) + if (_Data.ScreenNames.ProfileIDsTeam2[i] != -1) { - PlayerDestinationButtons[i + PlayerDestinationButtonsNumH].Color = new SColorF(1, 1, 1, 0.6f); - PlayerDestinationButtons[i + PlayerDestinationButtonsNumH].SelColor = new SColorF(1, 1, 1, 1); - PlayerDestinationButtons[i + PlayerDestinationButtonsNumH].Texture = CBase.Profiles.GetProfiles()[Data.ScreenNames.ProfileIDsTeam2[i]].Avatar.Texture; - PlayerDestinationButtons[i + PlayerDestinationButtonsNumH].SelTexture = CBase.Profiles.GetProfiles()[Data.ScreenNames.ProfileIDsTeam2[i]].Avatar.Texture; - PlayerDestinationButtons[i + PlayerDestinationButtonsNumH].Text.Text = CBase.Profiles.GetProfiles()[Data.ScreenNames.ProfileIDsTeam2[i]].PlayerName; - PlayerDestinationButtons[i + PlayerDestinationButtonsNumH].Enabled = true; + _PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].Color = new SColorF(1, 1, 1, 0.6f); + _PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].SelColor = new SColorF(1, 1, 1, 1); + _PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].Texture = CBase.Profiles.GetProfiles()[_Data.ScreenNames.ProfileIDsTeam2[i]].Avatar.Texture; + _PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].SelTexture = CBase.Profiles.GetProfiles()[_Data.ScreenNames.ProfileIDsTeam2[i]].Avatar.Texture; + _PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].Text.Text = CBase.Profiles.GetProfiles()[_Data.ScreenNames.ProfileIDsTeam2[i]].PlayerName; + _PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].Enabled = true; } } else { - PlayerDestinationButtons[i + PlayerDestinationButtonsNumH].Color = Buttons[ButtonPlayerDestination].Color; - PlayerDestinationButtons[i + PlayerDestinationButtonsNumH].SelColor = Buttons[ButtonPlayerDestination].SelColor; - PlayerDestinationButtons[i + PlayerDestinationButtonsNumH].Texture = Buttons[ButtonPlayerDestination].Texture; - PlayerDestinationButtons[i + PlayerDestinationButtonsNumH].SelTexture = Buttons[ButtonPlayerDestination].SelTexture; - PlayerDestinationButtons[i + PlayerDestinationButtonsNumH].Text.Text = String.Empty; - PlayerDestinationButtons[i + PlayerDestinationButtonsNumH].Enabled = false; + _PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].Color = Buttons[_ButtonPlayerDestination].Color; + _PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].SelColor = Buttons[_ButtonPlayerDestination].SelColor; + _PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].Texture = Buttons[_ButtonPlayerDestination].Texture; + _PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].SelTexture = Buttons[_ButtonPlayerDestination].SelTexture; + _PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].Text.Text = String.Empty; + _PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].Enabled = false; } } } - private void UpdateButtonNext() + private void _UpdateButtonNext() { - if (Data.ScreenNames.ProfileIDsTeam1.Count == NumPlayerTeam1 && Data.ScreenNames.ProfileIDsTeam2.Count == NumPlayerTeam2) + if (_Data.ScreenNames.ProfileIDsTeam1.Count == _NumPlayerTeam1 && _Data.ScreenNames.ProfileIDsTeam2.Count == _NumPlayerTeam2) { - Buttons[ButtonNext].Visible = true; - SetInteractionToButton(Buttons[ButtonNext]); + Buttons[_ButtonNext].Visible = true; + SetInteractionToButton(Buttons[_ButtonNext]); } else - Buttons[ButtonNext].Visible = false; + Buttons[_ButtonNext].Visible = false; } - private bool OnAdd() + private bool _OnAdd() { - for (int i = 0; i < PlayerChooseButtons.Count; i++) + for (int i = 0; i < _PlayerChooseButtons.Count; i++) { - if (PlayerChooseButtons[i].Button.Selected && PlayerChooseButtons[i].ProfileID != -1) + if (_PlayerChooseButtons[i].Button.Selected && _PlayerChooseButtons[i].ProfileID != -1) { - if (Data.ScreenNames.ProfileIDsTeam1.Count < NumPlayerTeam1) + if (_Data.ScreenNames.ProfileIDsTeam1.Count < _NumPlayerTeam1) { - Data.ScreenNames.ProfileIDsTeam1.Add(PlayerChooseButtons[i].ProfileID); - int added = Data.ScreenNames.ProfileIDsTeam1.Count - 1; - UpdateButtonNext(); + _Data.ScreenNames.ProfileIDsTeam1.Add(_PlayerChooseButtons[i].ProfileID); + int added = _Data.ScreenNames.ProfileIDsTeam1.Count - 1; + _UpdateButtonNext(); //Update texture and name - PlayerDestinationButtons[added].Color = new SColorF(1, 1, 1, 0.6f); - PlayerDestinationButtons[added].SelColor = new SColorF(1, 1, 1, 1); - PlayerDestinationButtons[added].Texture = CBase.Profiles.GetProfiles()[PlayerChooseButtons[i].ProfileID].Avatar.Texture; - PlayerDestinationButtons[added].SelTexture = CBase.Profiles.GetProfiles()[PlayerChooseButtons[i].ProfileID].Avatar.Texture; - PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetProfiles()[PlayerChooseButtons[i].ProfileID].PlayerName; - PlayerDestinationButtons[added].Enabled = true; + _PlayerDestinationButtons[added].Color = new SColorF(1, 1, 1, 0.6f); + _PlayerDestinationButtons[added].SelColor = new SColorF(1, 1, 1, 1); + _PlayerDestinationButtons[added].Texture = CBase.Profiles.GetProfiles()[_PlayerChooseButtons[i].ProfileID].Avatar.Texture; + _PlayerDestinationButtons[added].SelTexture = CBase.Profiles.GetProfiles()[_PlayerChooseButtons[i].ProfileID].Avatar.Texture; + _PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetProfiles()[_PlayerChooseButtons[i].ProfileID].PlayerName; + _PlayerDestinationButtons[added].Enabled = true; //Update Tiles-List - UpdateButtonPlayerChoose(); + _UpdateButtonPlayerChoose(); CheckInteraction(); return true; } - else if (Data.ScreenNames.ProfileIDsTeam2.Count < NumPlayerTeam2) + else if (_Data.ScreenNames.ProfileIDsTeam2.Count < _NumPlayerTeam2) { - Data.ScreenNames.ProfileIDsTeam2.Add(PlayerChooseButtons[i].ProfileID); - int added = (Data.ScreenNames.ProfileIDsTeam2.Count - 1) + PlayerDestinationButtonsNumH; - UpdateButtonNext(); + _Data.ScreenNames.ProfileIDsTeam2.Add(_PlayerChooseButtons[i].ProfileID); + int added = (_Data.ScreenNames.ProfileIDsTeam2.Count - 1) + _PlayerDestinationButtonsNumH; + _UpdateButtonNext(); //Update texture and name - PlayerDestinationButtons[added].Color = new SColorF(1, 1, 1, 0.6f); - PlayerDestinationButtons[added].SelColor = new SColorF(1, 1, 1, 1); - PlayerDestinationButtons[added].Texture = CBase.Profiles.GetProfiles()[PlayerChooseButtons[i].ProfileID].Avatar.Texture; - PlayerDestinationButtons[added].SelTexture = CBase.Profiles.GetProfiles()[PlayerChooseButtons[i].ProfileID].Avatar.Texture; - PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetProfiles()[PlayerChooseButtons[i].ProfileID].PlayerName; - PlayerDestinationButtons[added].Enabled = true; + _PlayerDestinationButtons[added].Color = new SColorF(1, 1, 1, 0.6f); + _PlayerDestinationButtons[added].SelColor = new SColorF(1, 1, 1, 1); + _PlayerDestinationButtons[added].Texture = CBase.Profiles.GetProfiles()[_PlayerChooseButtons[i].ProfileID].Avatar.Texture; + _PlayerDestinationButtons[added].SelTexture = CBase.Profiles.GetProfiles()[_PlayerChooseButtons[i].ProfileID].Avatar.Texture; + _PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetProfiles()[_PlayerChooseButtons[i].ProfileID].PlayerName; + _PlayerDestinationButtons[added].Enabled = true; //Update Tiles-List - UpdateButtonPlayerChoose(); + _UpdateButtonPlayerChoose(); CheckInteraction(); return true; } @@ -594,33 +594,33 @@ namespace VocaluxeLib.PartyModes.TicTacToe return false; } - private bool OnRemove() + private bool _OnRemove() { - for (int i = 0; i < PlayerDestinationButtonsNumH; i++) + for (int i = 0; i < _PlayerDestinationButtonsNumH; i++) { - if (PlayerDestinationButtons[i].Selected) + if (_PlayerDestinationButtons[i].Selected) { - if ((i + 1) <= Data.ScreenNames.ProfileIDsTeam1.Count) + if ((i + 1) <= _Data.ScreenNames.ProfileIDsTeam1.Count) { - Data.ScreenNames.ProfileIDsTeam1.RemoveAt(i); - UpdateButtonNext(); - UpdateButtonPlayerDestination(); - UpdateButtonPlayerChoose(); + _Data.ScreenNames.ProfileIDsTeam1.RemoveAt(i); + _UpdateButtonNext(); + _UpdateButtonPlayerDestination(); + _UpdateButtonPlayerChoose(); CheckInteraction(); return true; } } } - for (int i = PlayerDestinationButtonsNumH; i < PlayerDestinationButtonsNumH * 2; i++) + for (int i = _PlayerDestinationButtonsNumH; i < _PlayerDestinationButtonsNumH * 2; i++) { - if (PlayerDestinationButtons[i].Selected) + if (_PlayerDestinationButtons[i].Selected) { - if (((i - PlayerDestinationButtonsNumH) + 1) <= Data.ScreenNames.ProfileIDsTeam2.Count) + if (((i - _PlayerDestinationButtonsNumH) + 1) <= _Data.ScreenNames.ProfileIDsTeam2.Count) { - Data.ScreenNames.ProfileIDsTeam2.RemoveAt(i - PlayerDestinationButtonsNumH); - UpdateButtonNext(); - UpdateButtonPlayerDestination(); - UpdateButtonPlayerChoose(); + _Data.ScreenNames.ProfileIDsTeam2.RemoveAt(i - _PlayerDestinationButtonsNumH); + _UpdateButtonNext(); + _UpdateButtonPlayerDestination(); + _UpdateButtonPlayerChoose(); CheckInteraction(); return true; } @@ -629,18 +629,18 @@ namespace VocaluxeLib.PartyModes.TicTacToe return false; } - private void Back() + private void _Back() { - Data.ScreenNames.FadeToConfig = true; - Data.ScreenNames.FadeToMain = false; - _PartyMode.DataFromScreen(ThemeName, Data); + _Data.ScreenNames.FadeToConfig = true; + _Data.ScreenNames.FadeToMain = false; + _PartyMode.DataFromScreen(ThemeName, _Data); } - private void Next() + private void _Next() { - Data.ScreenNames.FadeToConfig = false; - Data.ScreenNames.FadeToMain = true; - _PartyMode.DataFromScreen(ThemeName, Data); + _Data.ScreenNames.FadeToConfig = false; + _Data.ScreenNames.FadeToMain = true; + _PartyMode.DataFromScreen(ThemeName, _Data); } } } \ No newline at end of file diff --git a/Re#Settings.DotSettings b/Re#Settings.DotSettings index b93d6f94..0ca89a5f 100644 --- a/Re#Settings.DotSettings +++ b/Re#Settings.DotSettings @@ -1,4 +1,8 @@  + Default + NotCompiledCode + True + True SOLUTION DO_NOT_SHOW DO_NOT_SHOW @@ -50,13 +54,63 @@ You should have received a copy of the GNU General Public License along with $SOLUTION$. If not, see <http://www.gnu.org/licenses/>. */ + AA + AC + AL + ALSA + API + ASIO + BG + BGR + BPM + CV + DB + DX + DY + FG + FPS + GL + HID + HPI + ID + IO + IR + JACK + LB + LBH + LD + LE + LED + MB + MBH + MME + MP + OS + OSS + PBO + PID + RB + RBH + RC + RGB + RGBA + USDX + WASAPI + WDMKS + XML + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> <Policy Inspect="True" Prefix="_" Suffix="" Style="AaBb" /> <Policy Inspect="True" Prefix="_" Suffix="" Style="AaBb" /> <Policy Inspect="True" Prefix="_" Suffix="" Style="AaBb" /> <Policy Inspect="True" Prefix="_" Suffix="" Style="AaBb" /> <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="T" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> <Policy><Descriptor Staticness="Static, Instance" AccessRightKinds="Private, Protected, ProtectedInternal, Internal, Public" Description="Enums"><ElementKinds><Kind Name="ENUM" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="E" Suffix="" Style="AaBb" /></Policy> <Policy><Descriptor Staticness="Static, Instance" AccessRightKinds="Private, Protected, ProtectedInternal, Internal, Public" Description="Classes"><ElementKinds><Kind Name="CLASS" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="C" Suffix="" Style="AaBb" /></Policy> + <Policy><Descriptor Staticness="Static, Instance" AccessRightKinds="Private, Protected" Description="Fields (not public)"><ElementKinds><Kind Name="FIELD" /><Kind Name="READONLY_FIELD" /><Kind Name="METHOD" /><Kind Name="PROPERTY" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="_" Suffix="" Style="AaBb" /></Policy> <Policy><Descriptor Staticness="Static, Instance" AccessRightKinds="Private, Protected, ProtectedInternal, Internal, Public" Description="Structs"><ElementKinds><Kind Name="STRUCT" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="S" Suffix="" Style="AaBb" /></Policy> \ No newline at end of file diff --git a/Vocaluxe/Base/CBackgroundMusic.cs b/Vocaluxe/Base/CBackgroundMusic.cs index 3f4f502f..ece1cd16 100644 --- a/Vocaluxe/Base/CBackgroundMusic.cs +++ b/Vocaluxe/Base/CBackgroundMusic.cs @@ -12,12 +12,12 @@ namespace Vocaluxe.Base { private static int _CurrentMusicStream = -1; private static int _PreviousMusicIndex; - private static PlaylistElement _CurrentPlaylistElement = new PlaylistElement(); + private static CPlaylistElement _CurrentPlaylistElement = new CPlaylistElement(); - private static readonly List _AllFileNames = new List(); - private static readonly List _NotPlayedFileNames = new List(); - private static readonly List _BGMusicFileNames = new List(); - private static readonly List _PreviousFileNames = new List(); + private static readonly List _AllFileNames = new List(); + private static readonly List _NotPlayedFileNames = new List(); + private static readonly List _BGMusicFileNames = new List(); + private static readonly List _PreviousFileNames = new List(); private static int _Video = -1; private static STexture _CurrentVideoTexture = new STexture(-1); @@ -114,10 +114,10 @@ namespace Vocaluxe.Base List templist = new List(); foreach (string ending in CSettings.MusicFileTypes) - templist.AddRange(CHelper.ListFiles(CSettings.sFolderBackgroundMusic, ending, true, true)); + templist.AddRange(CHelper.ListFiles(CSettings.FolderBackgroundMusic, ending, true, true)); foreach (string path in templist) - _BGMusicFileNames.Add(new PlaylistElement(path)); + _BGMusicFileNames.Add(new CPlaylistElement(path)); if (CConfig.BackgroundMusicSource != EBackgroundMusicSource.TR_CONFIG_ONLY_OWN_MUSIC) AddBackgroundMusic(); @@ -147,7 +147,7 @@ namespace Vocaluxe.Base else Next(); - if (!IsBackgroundFile(_CurrentPlaylistElement)) + if (!_IsBackgroundFile(_CurrentPlaylistElement)) _CanSing = true; else _CanSing = false; @@ -169,7 +169,7 @@ namespace Vocaluxe.Base CSound.FadeAndStop(_CurrentMusicStream, 0f, CSettings.BackgroundMusicFadeTime); _CurrentMusicStream = -1; - _CurrentPlaylistElement = new PlaylistElement(); + _CurrentPlaylistElement = new CPlaylistElement(); _Playing = false; } @@ -254,7 +254,7 @@ namespace Vocaluxe.Base CSound.SetPosition(_CurrentMusicStream, _CurrentPlaylistElement.Start); if (_VideoEnabled) - LoadVideo(); + _LoadVideo(); CSound.SetStreamVolume(_CurrentMusicStream, 0f); Play(); } @@ -294,7 +294,7 @@ namespace Vocaluxe.Base _CurrentMusicStream = CSound.Load(_CurrentPlaylistElement.MusicFilePath); CSound.SetStreamVolumeMax(_CurrentMusicStream, CConfig.BackgroundMusicVolume); if (_VideoEnabled) - LoadVideo(); + _LoadVideo(); CSound.SetStreamVolume(_CurrentMusicStream, 0f); Play(); } @@ -327,8 +327,8 @@ namespace Vocaluxe.Base { foreach (CSong song in CSongs.AllSongs) { - _AllFileNames.Add(new PlaylistElement(song)); - _NotPlayedFileNames.Add(new PlaylistElement(song)); + _AllFileNames.Add(new CPlaylistElement(song)); + _NotPlayedFileNames.Add(new CPlaylistElement(song)); } } _OwnMusicAdded = true; @@ -345,7 +345,7 @@ namespace Vocaluxe.Base _NotPlayedFileNames.AddRange(_BGMusicFileNames); } - if (Playing && !IsBackgroundFile(_CurrentPlaylistElement) || _AllFileNames.Count == 0) + if (Playing && !_IsBackgroundFile(_CurrentPlaylistElement) || _AllFileNames.Count == 0) Next(); _OwnMusicAdded = false; @@ -370,18 +370,18 @@ namespace Vocaluxe.Base AddOwnMusic(); _BackgroundMusicAdded = false; - if (Playing && IsBackgroundFile(_CurrentPlaylistElement) || _AllFileNames.Count == 0) + if (Playing && _IsBackgroundFile(_CurrentPlaylistElement) || _AllFileNames.Count == 0) Next(); } } - public static void CheckAndApplyConfig(EOffOn NewOnOff, EBackgroundMusicSource NewSource, float NewVolume) + public static void CheckAndApplyConfig(EOffOn newOnOff, EBackgroundMusicSource newSource, float newVolume) { - if (CConfig.BackgroundMusicSource != NewSource || (NewOnOff == EOffOn.TR_CONFIG_ON && !_OwnMusicAdded && !_BackgroundMusicAdded)) + if (CConfig.BackgroundMusicSource != newSource || (newOnOff == EOffOn.TR_CONFIG_ON && !_OwnMusicAdded && !_BackgroundMusicAdded)) { - CConfig.BackgroundMusicSource = NewSource; + CConfig.BackgroundMusicSource = newSource; - switch (NewSource) + switch (newSource) { case EBackgroundMusicSource.TR_CONFIG_NO_OWN_MUSIC: if (!_BackgroundMusicAdded) @@ -406,18 +406,18 @@ namespace Vocaluxe.Base } } - if (CConfig.BackgroundMusic != NewOnOff) + if (CConfig.BackgroundMusic != newOnOff) { - CConfig.BackgroundMusic = NewOnOff; - if (NewOnOff == EOffOn.TR_CONFIG_ON) + CConfig.BackgroundMusic = newOnOff; + if (newOnOff == EOffOn.TR_CONFIG_ON) Play(); else Pause(); } - if (CConfig.BackgroundMusicVolume != NewVolume) + if (CConfig.BackgroundMusicVolume != newVolume) { - CConfig.BackgroundMusicVolume = (int)NewVolume; + CConfig.BackgroundMusicVolume = (int)newVolume; ApplyVolume(); } @@ -445,7 +445,7 @@ namespace Vocaluxe.Base } } else - LoadVideo(); + _LoadVideo(); } public static STexture GetVideoTexture() @@ -455,10 +455,10 @@ namespace Vocaluxe.Base float vtime = 0f; CVideo.VdGetFrame(_Video, ref _CurrentVideoTexture, CSound.GetPosition(_CurrentMusicStream), ref vtime); if (_FadeTimer.ElapsedMilliseconds <= 3000L) - _CurrentVideoTexture.color.A = _FadeTimer.ElapsedMilliseconds / 3000f; + _CurrentVideoTexture.Color.A = _FadeTimer.ElapsedMilliseconds / 3000f; else { - _CurrentVideoTexture.color.A = 1f; + _CurrentVideoTexture.Color.A = 1f; _FadeTimer.Stop(); } return _CurrentVideoTexture; @@ -466,9 +466,9 @@ namespace Vocaluxe.Base return new STexture(-1); } - private static bool IsBackgroundFile(PlaylistElement element) + private static bool _IsBackgroundFile(CPlaylistElement element) { - foreach (PlaylistElement elements in _BGMusicFileNames) + foreach (CPlaylistElement elements in _BGMusicFileNames) { if (elements.MusicFilePath == element.MusicFilePath) return true; @@ -476,7 +476,7 @@ namespace Vocaluxe.Base return false; } - private static void LoadVideo() + private static void _LoadVideo() { if (_Video == -1) { @@ -493,7 +493,7 @@ namespace Vocaluxe.Base } } -class PlaylistElement +class CPlaylistElement { private readonly CSong _Song; @@ -606,7 +606,7 @@ class PlaylistElement } } - public PlaylistElement(CSong song) + public CPlaylistElement(CSong song) { MusicFilePath = string.Empty; _SongID = song.ID; @@ -614,13 +614,13 @@ class PlaylistElement _Song = song; } - public PlaylistElement(string FilePath) + public CPlaylistElement(string filePath) { - MusicFilePath = FilePath; + MusicFilePath = filePath; _SongID = -1; } - public PlaylistElement() + public CPlaylistElement() { MusicFilePath = string.Empty; _SongID = -1; diff --git a/Vocaluxe/Base/CConfig.cs b/Vocaluxe/Base/CConfig.cs index ad686f43..9ee47abf 100644 --- a/Vocaluxe/Base/CConfig.cs +++ b/Vocaluxe/Base/CConfig.cs @@ -13,7 +13,7 @@ namespace Vocaluxe.Base { static class CConfig { - private static readonly XmlWriterSettings _settings = new XmlWriterSettings(); + private static readonly XmlWriterSettings _Settings = new XmlWriterSettings(); // Debug public static EDebugLevel DebugLevel = EDebugLevel.TR_CONFIG_OFF; @@ -31,7 +31,7 @@ namespace Vocaluxe.Base public static int ScreenW = 1024; public static int ScreenH = 576; - public static EAntiAliasingModes AAMode = EAntiAliasingModes.x0; + public static EAntiAliasingModes AAMode = EAntiAliasingModes.X0; public static EColorDeep Colors = EColorDeep.Bit32; public static EOffOn VSync = EOffOn.TR_CONFIG_ON; @@ -55,7 +55,7 @@ namespace Vocaluxe.Base // Sound public static EPlaybackLib PlayBackLib = EPlaybackLib.Gstreamer; public static ERecordLib RecordLib = ERecordLib.PortAudio; - public static EBufferSize AudioBufferSize = EBufferSize.b2048; + public static EBufferSize AudioBufferSize = EBufferSize.B2048; public static int AudioLatency = 0; public static int BackgroundMusicVolume = 30; public static EOffOn BackgroundMusic = EOffOn.TR_CONFIG_ON; @@ -97,20 +97,20 @@ namespace Vocaluxe.Base private static readonly List _Values = new List(); //Variables to save old values for commandline-parameters - private static readonly List SongFolderOld = new List(); + private static readonly List _SongFolderOld = new List(); public static void Init() { - _settings.Indent = true; - _settings.Encoding = Encoding.UTF8; - _settings.ConformanceLevel = ConformanceLevel.Document; + _Settings.Indent = true; + _Settings.Encoding = Encoding.UTF8; + _Settings.ConformanceLevel = ConformanceLevel.Document; - SongFolder.Add(Path.Combine(Directory.GetCurrentDirectory(), CSettings.sFolderSongs)); + SongFolder.Add(Path.Combine(Directory.GetCurrentDirectory(), CSettings.FolderSongs)); MicConfig = new SMicConfig[CSettings.MaxNumPlayer]; // Init config file - if (!File.Exists(CSettings.sFileConfig)) + if (!File.Exists(CSettings.FileConfig)) SaveConfig(); LoadConfig(); @@ -118,7 +118,7 @@ namespace Vocaluxe.Base public static bool LoadConfig() { - CXMLReader xmlReader = CXMLReader.OpenFile(CSettings.sFileConfig); + CXMLReader xmlReader = CXMLReader.OpenFile(CSettings.FileConfig); if (xmlReader == null) return false; @@ -204,10 +204,10 @@ namespace Vocaluxe.Base if (NumPlayer < 1 || NumPlayer > CSettings.MaxNumPlayer) NumPlayer = 2; - bool _LangExists = CLanguage.SetLanguage(Language); + bool langExists = CLanguage.SetLanguage(Language); //TODO: What should we do, if English not exists? - if (_LangExists == false) + if (langExists == false) Language = "English"; //Read players from config @@ -254,7 +254,7 @@ namespace Vocaluxe.Base XmlWriter writer = null; try { - writer = XmlWriter.Create(CSettings.sFileConfig, _settings); + writer = XmlWriter.Create(CSettings.FileConfig, _Settings); writer.WriteStartDocument(); writer.WriteStartElement("root"); @@ -402,12 +402,12 @@ namespace Vocaluxe.Base // SongFolder // Check, if program was started with songfolder-parameters - if (SongFolderOld.Count > 0) + if (_SongFolderOld.Count > 0) { //Write "old" song-folders to config. writer.WriteComment("SongFolder: SongFolder1, SongFolder2, SongFolder3, ..."); - for (int i = 0; i < SongFolderOld.Count; i++) - writer.WriteElementString("SongFolder" + (i + 1).ToString(), SongFolderOld[i]); + for (int i = 0; i < _SongFolderOld.Count; i++) + writer.WriteElementString("SongFolder" + (i + 1).ToString(), _SongFolderOld[i]); } else { @@ -540,15 +540,15 @@ namespace Vocaluxe.Base /// public static bool IsMicConfig() { - SRecordDevice[] Devices = CSound.RecordGetDevices(); - if (Devices == null) + SRecordDevice[] devices = CSound.RecordGetDevices(); + if (devices == null) return false; - for (int dev = 0; dev < Devices.Length; dev++) + for (int dev = 0; dev < devices.Length; dev++) { - for (int inp = 0; inp < Devices[dev].Inputs.Count; inp++) + for (int inp = 0; inp < devices[dev].Inputs.Count; inp++) { - if (Devices[dev].Inputs[inp].PlayerChannel1 != 0 || Devices[dev].Inputs[inp].PlayerChannel2 != 0) + if (devices[dev].Inputs[inp].PlayerChannel1 != 0 || devices[dev].Inputs[inp].PlayerChannel2 != 0) return true; } } @@ -562,17 +562,17 @@ namespace Vocaluxe.Base /// public static bool IsMicConfig(int player) { - SRecordDevice[] Devices = CSound.RecordGetDevices(); - if (Devices == null) + SRecordDevice[] devices = CSound.RecordGetDevices(); + if (devices == null) return false; - if (Devices != null) + if (devices != null) { - for (int dev = 0; dev < Devices.Length; dev++) + for (int dev = 0; dev < devices.Length; dev++) { - for (int inp = 0; inp < Devices[dev].Inputs.Count; inp++) + for (int inp = 0; inp < devices[dev].Inputs.Count; inp++) { - if (Devices[dev].Inputs[inp].PlayerChannel1 == player || Devices[dev].Inputs[inp].PlayerChannel2 == player) + if (devices[dev].Inputs[inp].PlayerChannel1 == player || devices[dev].Inputs[inp].PlayerChannel2 == player) return true; } } @@ -588,30 +588,30 @@ namespace Vocaluxe.Base { //Look for (usb-)mic //SRecordDevice[] Devices = new SRecordDevice[CSound.RecordGetDevices().Length]; - SRecordDevice[] Devices = CSound.RecordGetDevices(); - if (Devices == null) + SRecordDevice[] devices = CSound.RecordGetDevices(); + if (devices == null) return false; - for (int dev = 0; dev < Devices.Length; dev++) + for (int dev = 0; dev < devices.Length; dev++) { //Has Device some signal-names in name -> This could be a (usb-)mic - if (Regex.IsMatch(Devices[dev].Name, @"Usb|Wireless", RegexOptions.IgnoreCase)) + if (Regex.IsMatch(devices[dev].Name, @"ReplacedStr:::0:::", RegexOptions.IgnoreCase)) { //Check if there are inputs. - if (Devices[dev].Inputs.Count >= 1) + if (devices[dev].Inputs.Count >= 1) { //Check if there is one or more channels - if (Devices[dev].Inputs[0].Channels >= 2) + if (devices[dev].Inputs[0].Channels >= 2) { //Set this device to player 1 - MicConfig[0].DeviceName = Devices[dev].Name; - MicConfig[0].DeviceDriver = Devices[dev].Driver; - MicConfig[0].InputName = Devices[dev].Inputs[0].Name; + MicConfig[0].DeviceName = devices[dev].Name; + MicConfig[0].DeviceDriver = devices[dev].Driver; + MicConfig[0].InputName = devices[dev].Inputs[0].Name; MicConfig[0].Channel = 1; //Set this device to player 2 - MicConfig[1].DeviceName = Devices[dev].Name; - MicConfig[1].DeviceDriver = Devices[dev].Driver; - MicConfig[1].InputName = Devices[dev].Inputs[0].Name; + MicConfig[1].DeviceName = devices[dev].Name; + MicConfig[1].DeviceDriver = devices[dev].Driver; + MicConfig[1].InputName = devices[dev].Inputs[0].Name; MicConfig[1].Channel = 2; return true; @@ -619,30 +619,30 @@ namespace Vocaluxe.Base } } } - //If no usb-mics found -> Look for Devices with "mic" or "mik" - for (int dev = 0; dev < Devices.Length; dev++) + //If no usb-mics found -> Look for Devices with "ReplacedStr:::1:::" or "ReplacedStr:::2:::" + for (int dev = 0; dev < devices.Length; dev++) { //Has Device some signal-names in name -> This could be a mic - if (Regex.IsMatch(Devices[dev].Name, @"Mic|Mik", RegexOptions.IgnoreCase)) + if (Regex.IsMatch(devices[dev].Name, @"ReplacedStr:::3:::", RegexOptions.IgnoreCase)) { //Check if there are inputs. - if (Devices[dev].Inputs.Count >= 1) + if (devices[dev].Inputs.Count >= 1) { //Check if there is one or more channels - if (Devices[dev].Inputs[0].Channels >= 1) + if (devices[dev].Inputs[0].Channels >= 1) { //Set this device to player 1 - MicConfig[0].DeviceName = Devices[dev].Name; - MicConfig[0].DeviceDriver = Devices[dev].Driver; - MicConfig[0].InputName = Devices[dev].Inputs[0].Name; + MicConfig[0].DeviceName = devices[dev].Name; + MicConfig[0].DeviceDriver = devices[dev].Driver; + MicConfig[0].InputName = devices[dev].Inputs[0].Name; MicConfig[0].Channel = 1; - if (Devices[dev].Inputs[0].Channels >= 2) + if (devices[dev].Inputs[0].Channels >= 2) { //Set this device to player 2 - MicConfig[1].DeviceName = Devices[dev].Name; - MicConfig[1].DeviceDriver = Devices[dev].Driver; - MicConfig[1].InputName = Devices[dev].Inputs[0].Name; + MicConfig[1].DeviceName = devices[dev].Name; + MicConfig[1].DeviceDriver = devices[dev].Driver; + MicConfig[1].InputName = devices[dev].Inputs[0].Name; MicConfig[1].Channel = 2; return true; @@ -661,30 +661,30 @@ namespace Vocaluxe.Base /// Parameters public static void LoadCommandLineParams(string[] args) { - Regex SpliterParam = new Regex(@"-{1,2}|\/", RegexOptions.IgnoreCase); + Regex spliterParam = new Regex(@"ReplacedStr:::0:::", RegexOptions.IgnoreCase); //Complete argument string string arguments = string.Empty; foreach (string arg in args) arguments += arg + " "; - args = SpliterParam.Split(arguments); + args = spliterParam.Split(arguments); foreach (string text in args) { - Regex SpliterVal = new Regex(@"\s", RegexOptions.IgnoreCase); + Regex spliterVal = new Regex(@"ReplacedStr:::2:::", RegexOptions.IgnoreCase); //Array for parts of an arg string[] parts; //split arg with Spilter-Regex and save in parts - parts = SpliterVal.Split(text, 2); + parts = spliterVal.Split(text, 2); switch (parts.Length) { //Only found a parameter case 1: - if (!Regex.IsMatch(parts[0], @"\s") && parts[0].Length > 0) + if (!Regex.IsMatch(parts[0], @"ReplacedStr:::3:::") && parts[0].Length > 0) { //Add parameter _Params.Add(parts[0]); @@ -697,7 +697,7 @@ namespace Vocaluxe.Base //Found parameter and value case 2: - if (!Regex.IsMatch(parts[0], @"\s") && parts[0].Length > 0) + if (!Regex.IsMatch(parts[0], @"ReplacedStr:::5:::") && parts[0].Length > 0) { //Add parameter _Params.Add(parts[0]); @@ -729,24 +729,24 @@ namespace Vocaluxe.Base { case "configfile": //Check if value is valid - if (CheckFile(value)) - CSettings.sFileConfig = value; + if (_CheckFile(value)) + CSettings.FileConfig = value; break; case "scorefile": //Check if value is valid - if (CheckFile(value)) - CSettings.sFileHighscoreDB = value; + if (_CheckFile(value)) + CSettings.FileHighscoreDB = value; break; case "playlistfolder": CSettings.CreateFolder(value); - CSettings.sFolderPlaylists = value; + CSettings.FolderPlaylists = value; break; case "profilefolder": CSettings.CreateFolder(value); - CSettings.sFolderProfiles = value; + CSettings.FolderProfiles = value; break; } } @@ -772,10 +772,10 @@ namespace Vocaluxe.Base case "songfolder": case "songpath": //Check if SongFolders from config.xml are saved - if (SongFolderOld.Count == 0) + if (_SongFolderOld.Count == 0) { - SongFolderOld.Clear(); - SongFolderOld.AddRange(SongFolder); + _SongFolderOld.Clear(); + _SongFolderOld.AddRange(SongFolder); SongFolder.Clear(); } //Add parameter-value to SongFolder @@ -785,7 +785,7 @@ namespace Vocaluxe.Base } } - private static bool CheckFile(string value) + private static bool _CheckFile(string value) { char[] chars = Path.GetInvalidPathChars(); for (int i = 0; i < chars.Length; i++) diff --git a/Vocaluxe/Base/CCover.cs b/Vocaluxe/Base/CCover.cs index 9dc14b3b..962815ae 100644 --- a/Vocaluxe/Base/CCover.cs +++ b/Vocaluxe/Base/CCover.cs @@ -23,7 +23,7 @@ namespace Vocaluxe.Base abstract class CCover { - private static readonly XmlWriterSettings _settings = new XmlWriterSettings(); + private static readonly XmlWriterSettings _Settings = new XmlWriterSettings(); private static readonly List _Cover = new List(); private static readonly List _CoverThemes = new List(); private static STexture _NoCover = new STexture(-1); @@ -37,12 +37,12 @@ namespace Vocaluxe.Base public static void Init() { - _settings.Indent = true; - _settings.Encoding = Encoding.UTF8; - _settings.ConformanceLevel = ConformanceLevel.Document; + _Settings.Indent = true; + _Settings.Encoding = Encoding.UTF8; + _Settings.ConformanceLevel = ConformanceLevel.Document; - LoadCoverThemes(); - LoadCover(CConfig.CoverTheme); + _LoadCoverThemes(); + _LoadCover(CConfig.CoverTheme); } /// @@ -52,11 +52,11 @@ namespace Vocaluxe.Base { get { - List CoverThemes = new List(); + List coverThemes = new List(); for (int i = 0; i < _CoverThemes.Count; i++) - CoverThemes.Add(_CoverThemes[i].Name); + coverThemes.Add(_CoverThemes[i].Name); - return CoverThemes.ToArray(); + return coverThemes.ToArray(); } } @@ -77,14 +77,14 @@ namespace Vocaluxe.Base /// /// Returns a STexture for a given cover name. Returns "NoCover" if the cover does not exist. /// - public static STexture Cover(string Name) + public static STexture Cover(string name) { STexture cov = _NoCover; lock (_MutexCover) { foreach (SCover cover in _Cover) { - if (cover.Name == Name) + if (cover.Name == name) { cov = cover.Texture; break; @@ -97,14 +97,14 @@ namespace Vocaluxe.Base /// /// Returns true if a cover with the given name exists. /// - public static bool CoverExists(string Name) + public static bool CoverExists(string name) { STexture cov = _NoCover; lock (_MutexCover) { foreach (SCover cover in _Cover) { - if (cover.Name == Name) + if (cover.Name == name) return true; } } @@ -122,13 +122,13 @@ namespace Vocaluxe.Base CDraw.RemoveTexture(ref texture); } _Cover.Clear(); - LoadCover(CConfig.CoverTheme); + _LoadCover(CConfig.CoverTheme); } /// /// Returns a SCoverTheme by cover-theme-name /// - private static SCoverTheme CoverTheme(string coverThemeName) + private static SCoverTheme _CoverTheme(string coverThemeName) { SCoverTheme coverTheme = new SCoverTheme(); for (int i = 0; i < _CoverThemes.Count; i++) @@ -145,11 +145,11 @@ namespace Vocaluxe.Base /// /// Loads all cover-themes to list. /// - private static void LoadCoverThemes() + private static void _LoadCoverThemes() { _CoverThemes.Clear(); - string path = CSettings.sFolderCover; + string path = CSettings.FolderCover; List files = CHelper.ListFiles(path, "*.xml", false); foreach (string file in files) @@ -176,15 +176,15 @@ namespace Vocaluxe.Base /// /// Loads all cover which are defined in the cover config file. /// - private static void LoadCover(string coverThemeName) + private static void _LoadCover(string coverThemeName) { SCoverTheme coverTheme = new SCoverTheme(); - coverTheme = CoverTheme(coverThemeName); + coverTheme = _CoverTheme(coverThemeName); if (coverTheme.Name.Length > 0) { - CXMLReader xmlReader = CXMLReader.OpenFile(Path.Combine(CSettings.sFolderCover, coverTheme.File)); + CXMLReader xmlReader = CXMLReader.OpenFile(Path.Combine(CSettings.FolderCover, coverTheme.File)); if (xmlReader != null) { @@ -201,8 +201,8 @@ namespace Vocaluxe.Base xmlReader.GetValue("//root/Cover/" + cover[i] + "/Path", ref value, String.Empty); sk.Name = name; sk.Value = Path.Combine(coverTheme.Folder, value); - if (File.Exists(Path.Combine(CSettings.sFolderCover, Path.Combine(coverTheme.Folder, value)))) - sk.Texture = CDraw.AddTexture(Path.Combine(CSettings.sFolderCover, Path.Combine(coverTheme.Folder, value))); + if (File.Exists(Path.Combine(CSettings.FolderCover, Path.Combine(coverTheme.Folder, value)))) + sk.Texture = CDraw.AddTexture(Path.Combine(CSettings.FolderCover, Path.Combine(coverTheme.Folder, value))); else sk.Texture = _NoCover; @@ -216,10 +216,10 @@ namespace Vocaluxe.Base List files = new List(); - files.AddRange(CHelper.ListFiles(Path.Combine(CSettings.sFolderCover, coverTheme.Folder), "*.png", true, true)); - files.AddRange(CHelper.ListFiles(Path.Combine(CSettings.sFolderCover, coverTheme.Folder), "*.jpg", true, true)); - files.AddRange(CHelper.ListFiles(Path.Combine(CSettings.sFolderCover, coverTheme.Folder), "*.jpeg", true, true)); - files.AddRange(CHelper.ListFiles(Path.Combine(CSettings.sFolderCover, coverTheme.Folder), "*.bmp", true, true)); + files.AddRange(CHelper.ListFiles(Path.Combine(CSettings.FolderCover, coverTheme.Folder), "*.png", true, true)); + files.AddRange(CHelper.ListFiles(Path.Combine(CSettings.FolderCover, coverTheme.Folder), "*.jpg", true, true)); + files.AddRange(CHelper.ListFiles(Path.Combine(CSettings.FolderCover, coverTheme.Folder), "*.jpeg", true, true)); + files.AddRange(CHelper.ListFiles(Path.Combine(CSettings.FolderCover, coverTheme.Folder), "*.bmp", true, true)); foreach (string file in files) @@ -235,7 +235,7 @@ namespace Vocaluxe.Base sk.Name = name; sk.Value = Path.Combine(coverTheme.Folder, Path.GetFileName(file)); - sk.Texture = CDraw.AddTexture(Path.Combine(CSettings.sFolderCover, sk.Value)); + sk.Texture = CDraw.AddTexture(Path.Combine(CSettings.FolderCover, sk.Value)); _Cover.Add(sk); } diff --git a/Vocaluxe/Base/CDataBase.cs b/Vocaluxe/Base/CDataBase.cs index 6bfce197..9df5747c 100644 --- a/Vocaluxe/Base/CDataBase.cs +++ b/Vocaluxe/Base/CDataBase.cs @@ -25,10 +25,10 @@ namespace Vocaluxe.Base { private struct SData { - public int id; - public long ticks; - public string str1; - public string str2; + public int Id; + public long Ticks; + public string Str1; + public string Str2; } private static string _HighscoreFilePath; @@ -40,33 +40,33 @@ namespace Vocaluxe.Base public static void Init() { - _HighscoreFilePath = Path.Combine(Environment.CurrentDirectory, CSettings.sFileHighscoreDB); - _CoverFilePath = Path.Combine(Environment.CurrentDirectory, CSettings.sFileCoverDB); - _CreditsRessourcesFilePath = Path.Combine(Environment.CurrentDirectory, CSettings.sFileCreditsRessourcesDB); + _HighscoreFilePath = Path.Combine(Environment.CurrentDirectory, CSettings.FileHighscoreDB); + _CoverFilePath = Path.Combine(Environment.CurrentDirectory, CSettings.FileCoverDB); + _CreditsRessourcesFilePath = Path.Combine(Environment.CurrentDirectory, CSettings.FileCreditsRessourcesDB); - InitHighscoreDB(); - InitCoverDB(); - InitCreditsRessourcesDB(); + _InitHighscoreDB(); + _InitCoverDB(); + _InitCreditsRessourcesDB(); GC.Collect(); } #region Highscores - public static int AddScore(string PlayerName, int Score, int LineNr, long Date, int Medley, int Duet, int ShortSong, int Diff, - string Artist, string Title, int NumPlayed, string FilePath) + public static int AddScore(string playerName, int score, int lineNr, long date, int medley, int duet, int shortSong, int diff, + string artist, string title, int numPlayed, string filePath) { SPlayer player = new SPlayer(); - player.Name = PlayerName; - player.Points = Score; - player.LineNr = LineNr; - player.DateTicks = Date; - player.Medley = Medley == 1; - player.Duet = Duet == 1; - player.ShortSong = ShortSong == 1; - player.Difficulty = (EGameDifficulty)Diff; + player.Name = playerName; + player.Points = score; + player.LineNr = lineNr; + player.DateTicks = date; + player.Medley = medley == 1; + player.Duet = duet == 1; + player.ShortSong = shortSong == 1; + player.Difficulty = (EGameDifficulty)diff; using (SQLiteConnection connection = new SQLiteConnection()) { - connection.ConnectionString = "Data Source=" + FilePath; + connection.ConnectionString = "Data Source=" + filePath; try { @@ -79,8 +79,8 @@ namespace Vocaluxe.Base using (SQLiteCommand command = new SQLiteCommand(connection)) { - int DataBaseSongID = GetDataBaseSongID(Artist, Title, NumPlayed, command); - int result = AddScore(player, command, DataBaseSongID); + int dataBaseSongID = _GetDataBaseSongID(artist, title, numPlayed, command); + int result = _AddScore(player, command, dataBaseSongID); return result; } } @@ -103,42 +103,42 @@ namespace Vocaluxe.Base using (SQLiteCommand command = new SQLiteCommand(connection)) { - int DataBaseSongID = GetDataBaseSongID(player, command); - int result = AddScore(player, command, DataBaseSongID); + int dataBaseSongID = _GetDataBaseSongID(player, command); + int result = _AddScore(player, command, dataBaseSongID); return result; } } } - private static int AddScore(SPlayer player, SQLiteCommand command, int DataBaseSongID) + private static int _AddScore(SPlayer player, SQLiteCommand command, int dataBaseSongID) { int lastInsertID = -1; - if (DataBaseSongID >= 0) + if (dataBaseSongID >= 0) { - int Medley = 0; + int medley = 0; if (player.Medley) - Medley = 1; + medley = 1; - int Duet = 0; + int duet = 0; if (player.Duet) - Duet = 1; + duet = 1; - int ShortSong = 0; + int shortSong = 0; if (player.ShortSong) - ShortSong = 1; + shortSong = 1; command.CommandText = "SELECT id FROM Scores WHERE SongID = @SongID AND PlayerName = @PlayerName AND Score = @Score AND " + "LineNr = @LineNr AND Date = @Date AND Medley = @Medley AND Duet = @Duet AND ShortSong = @ShortSong AND Difficulty = @Difficulty"; - command.Parameters.Add("@SongID", DbType.Int32, 0).Value = DataBaseSongID; + command.Parameters.Add("@SongID", DbType.Int32, 0).Value = dataBaseSongID; command.Parameters.Add("@PlayerName", DbType.String, 0).Value = player.Name; command.Parameters.Add("@Score", DbType.Int32, 0).Value = (int)Math.Round(player.Points); command.Parameters.Add("@LineNr", DbType.Int32, 0).Value = player.LineNr; command.Parameters.Add("@Date", DbType.Int64, 0).Value = player.DateTicks; - command.Parameters.Add("@Medley", DbType.Int32, 0).Value = Medley; - command.Parameters.Add("@Duet", DbType.Int32, 0).Value = Duet; - command.Parameters.Add("@ShortSong", DbType.Int32, 0).Value = ShortSong; + command.Parameters.Add("@Medley", DbType.Int32, 0).Value = medley; + command.Parameters.Add("@Duet", DbType.Int32, 0).Value = duet; + command.Parameters.Add("@ShortSong", DbType.Int32, 0).Value = shortSong; command.Parameters.Add("@Difficulty", DbType.Int32, 0).Value = (int)player.Difficulty; SQLiteDataReader reader = null; @@ -162,14 +162,14 @@ namespace Vocaluxe.Base command.CommandText = "INSERT INTO Scores (SongID, PlayerName, Score, LineNr, Date, Medley, Duet, ShortSong, Difficulty) " + "VALUES (@SongID, @PlayerName, @Score, @LineNr, @Date, @Medley, @Duet, @ShortSong, @Difficulty)"; - command.Parameters.Add("@SongID", DbType.Int32, 0).Value = DataBaseSongID; + command.Parameters.Add("@SongID", DbType.Int32, 0).Value = dataBaseSongID; command.Parameters.Add("@PlayerName", DbType.String, 0).Value = player.Name; command.Parameters.Add("@Score", DbType.Int32, 0).Value = (int)Math.Round(player.Points); command.Parameters.Add("@LineNr", DbType.Int32, 0).Value = player.LineNr; command.Parameters.Add("@Date", DbType.Int64, 0).Value = player.DateTicks; - command.Parameters.Add("@Medley", DbType.Int32, 0).Value = Medley; - command.Parameters.Add("@Duet", DbType.Int32, 0).Value = Duet; - command.Parameters.Add("@ShortSong", DbType.Int32, 0).Value = ShortSong; + command.Parameters.Add("@Medley", DbType.Int32, 0).Value = medley; + command.Parameters.Add("@Duet", DbType.Int32, 0).Value = duet; + command.Parameters.Add("@ShortSong", DbType.Int32, 0).Value = shortSong; command.Parameters.Add("@Difficulty", DbType.Int32, 0).Value = (int)player.Difficulty; command.ExecuteNonQuery(); @@ -189,13 +189,13 @@ namespace Vocaluxe.Base return lastInsertID; } - public static void LoadScore(ref List Scores, SPlayer player) + public static void LoadScore(ref List scores, SPlayer player) { using (SQLiteConnection connection = new SQLiteConnection()) { connection.ConnectionString = "Data Source=" + _HighscoreFilePath; - Scores = new List(); + scores = new List(); try { @@ -208,28 +208,28 @@ namespace Vocaluxe.Base using (SQLiteCommand command = new SQLiteCommand(connection)) { - int Medley = 0; + int medley = 0; if (player.Medley) - Medley = 1; + medley = 1; - int Duet = 0; + int duet = 0; if (player.Duet) - Duet = 1; + duet = 1; - int ShortSong = 0; + int shortSong = 0; if (player.ShortSong) - ShortSong = 1; + shortSong = 1; - int DataBaseSongID = GetDataBaseSongID(player, command); - if (DataBaseSongID >= 0) + int dataBaseSongID = _GetDataBaseSongID(player, command); + if (dataBaseSongID >= 0) { command.CommandText = "SELECT PlayerName, Score, Date, Difficulty, LineNr, id FROM Scores " + "WHERE [SongID] = @SongID AND [Medley] = @Medley AND [Duet] = @Duet AND [ShortSong] = @ShortSong " + "ORDER BY [Score] DESC"; - command.Parameters.Add("@SongID", DbType.Int32, 0).Value = DataBaseSongID; - command.Parameters.Add("@Medley", DbType.Int32, 0).Value = Medley; - command.Parameters.Add("@Duet", DbType.Int32, 0).Value = Duet; - command.Parameters.Add("@ShortSong", DbType.Int32, 0).Value = ShortSong; + command.Parameters.Add("@SongID", DbType.Int32, 0).Value = dataBaseSongID; + command.Parameters.Add("@Medley", DbType.Int32, 0).Value = medley; + command.Parameters.Add("@Duet", DbType.Int32, 0).Value = duet; + command.Parameters.Add("@ShortSong", DbType.Int32, 0).Value = shortSong; SQLiteDataReader reader = command.ExecuteReader(); if (reader != null && reader.HasRows) @@ -244,7 +244,7 @@ namespace Vocaluxe.Base score.LineNr = reader.GetInt32(4); score.ID = reader.GetInt32(5); - Scores.Add(score); + scores.Add(score); } reader.Dispose(); } @@ -253,21 +253,21 @@ namespace Vocaluxe.Base } } - private static int GetDataBaseSongID(SPlayer player, SQLiteCommand command) + private static int _GetDataBaseSongID(SPlayer player, SQLiteCommand command) { CSong song = CSongs.GetSong(player.SongID); if (song == null) return -1; - return GetDataBaseSongID(song.Artist, song.Title, 0, command); + return _GetDataBaseSongID(song.Artist, song.Title, 0, command); } - private static int GetDataBaseSongID(string Artist, string Title, string FilePath, int DefNumPlayed) + private static int _GetDataBaseSongID(string artist, string title, string filePath, int defNumPlayed) { using (SQLiteConnection connection = new SQLiteConnection()) { - connection.ConnectionString = "Data Source=" + FilePath; + connection.ConnectionString = "Data Source=" + filePath; try { @@ -279,15 +279,15 @@ namespace Vocaluxe.Base } using (SQLiteCommand command = new SQLiteCommand(connection)) - return GetDataBaseSongID(Artist, Title, DefNumPlayed, command); + return _GetDataBaseSongID(artist, title, defNumPlayed, command); } } - private static int GetDataBaseSongID(string Artist, string Title, int DefNumPlayed, SQLiteCommand command) + private static int _GetDataBaseSongID(string artist, string title, int defNumPlayed, SQLiteCommand command) { command.CommandText = "SELECT id FROM Songs WHERE [Title] = @title AND [Artist] = @artist"; - command.Parameters.Add("@title", DbType.String, 0).Value = Title; - command.Parameters.Add("@artist", DbType.String, 0).Value = Artist; + command.Parameters.Add("@title", DbType.String, 0).Value = title; + command.Parameters.Add("@artist", DbType.String, 0).Value = artist; SQLiteDataReader reader = command.ExecuteReader(); @@ -305,14 +305,14 @@ namespace Vocaluxe.Base command.CommandText = "INSERT INTO Songs (Title, Artist, NumPlayed) " + "VALUES (@title, @artist, @numplayed)"; - command.Parameters.Add("@title", DbType.String, 0).Value = Title; - command.Parameters.Add("@artist", DbType.String, 0).Value = Artist; - command.Parameters.Add("@numplayed", DbType.Int32, 0).Value = DefNumPlayed; + command.Parameters.Add("@title", DbType.String, 0).Value = title; + command.Parameters.Add("@artist", DbType.String, 0).Value = artist; + command.Parameters.Add("@numplayed", DbType.Int32, 0).Value = defNumPlayed; command.ExecuteNonQuery(); command.CommandText = "SELECT id FROM Songs WHERE [Title] = @title AND [Artist] = @artist"; - command.Parameters.Add("@title", DbType.String, 0).Value = Title; - command.Parameters.Add("@artist", DbType.String, 0).Value = Artist; + command.Parameters.Add("@title", DbType.String, 0).Value = title; + command.Parameters.Add("@artist", DbType.String, 0).Value = artist; reader = command.ExecuteReader(); @@ -331,15 +331,15 @@ namespace Vocaluxe.Base return -1; } - private static bool GetDataBaseSongInfos(int SongID, out string Artist, out string Title, out int NumPlayed, string FilePath) + private static bool _GetDataBaseSongInfos(int songID, out string artist, out string title, out int numPlayed, string filePath) { - Artist = String.Empty; - Title = String.Empty; - NumPlayed = 0; + artist = String.Empty; + title = String.Empty; + numPlayed = 0; using (SQLiteConnection connection = new SQLiteConnection()) { - connection.ConnectionString = "Data Source=" + FilePath; + connection.ConnectionString = "Data Source=" + filePath; try { @@ -353,7 +353,7 @@ namespace Vocaluxe.Base using (SQLiteCommand command = new SQLiteCommand(connection)) { command.CommandText = "SELECT Artist, Title, NumPlayed FROM Songs WHERE [id] = @id"; - command.Parameters.Add("@id", DbType.String, 0).Value = SongID; + command.Parameters.Add("@id", DbType.String, 0).Value = songID; SQLiteDataReader reader = null; try @@ -368,9 +368,9 @@ namespace Vocaluxe.Base if (reader != null && reader.HasRows) { reader.Read(); - Artist = reader.GetString(0); - Title = reader.GetString(1); - NumPlayed = reader.GetInt32(2); + artist = reader.GetString(0); + title = reader.GetString(1); + numPlayed = reader.GetInt32(2); reader.Dispose(); return true; } @@ -382,35 +382,35 @@ namespace Vocaluxe.Base return false; } - private static void InitHighscoreDB() + private static void _InitHighscoreDB() { - string OldDBFilePath = Path.Combine(Environment.CurrentDirectory, CSettings.sFileOldHighscoreDB); - if (File.Exists(OldDBFilePath)) + string oldDBFilePath = Path.Combine(Environment.CurrentDirectory, CSettings.FileOldHighscoreDB); + if (File.Exists(oldDBFilePath)) { if (File.Exists(_HighscoreFilePath)) { - CreateOrConvert(OldDBFilePath); - CreateOrConvert(_HighscoreFilePath); - ImportData(OldDBFilePath, _HighscoreFilePath); + _CreateOrConvert(oldDBFilePath); + _CreateOrConvert(_HighscoreFilePath); + _ImportData(oldDBFilePath, _HighscoreFilePath); - File.Delete(OldDBFilePath); + File.Delete(oldDBFilePath); } else { - File.Copy(OldDBFilePath, _HighscoreFilePath); - CreateOrConvert(_HighscoreFilePath); - File.Delete(OldDBFilePath); + File.Copy(oldDBFilePath, _HighscoreFilePath); + _CreateOrConvert(_HighscoreFilePath); + File.Delete(oldDBFilePath); } } else - CreateOrConvert(_HighscoreFilePath); + _CreateOrConvert(_HighscoreFilePath); } - private static void CreateHighscoreDB(string FilePath) + private static void _CreateHighscoreDB(string filePath) { using (SQLiteConnection connection = new SQLiteConnection()) { - connection.ConnectionString = "Data Source=" + FilePath; + connection.ConnectionString = "Data Source=" + filePath; try { @@ -427,7 +427,7 @@ namespace Vocaluxe.Base command.ExecuteNonQuery(); command.CommandText = "INSERT INTO Version (id, Value) VALUES(NULL, @Value)"; - command.Parameters.Add("@Value", DbType.Int32).Value = CSettings.iDatabaseHighscoreVersion; + command.Parameters.Add("@Value", DbType.Int32).Value = CSettings.DatabaseHighscoreVersion; command.ExecuteNonQuery(); command.CommandText = "CREATE TABLE IF NOT EXISTS Songs ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, " + @@ -442,11 +442,11 @@ namespace Vocaluxe.Base } } - private static void CreateHighscoreDBV1(string FilePath) + private static void _CreateHighscoreDBV1(string filePath) { using (SQLiteConnection connection = new SQLiteConnection()) { - connection.ConnectionString = "Data Source=" + FilePath; + connection.ConnectionString = "Data Source=" + filePath; try { @@ -480,13 +480,13 @@ namespace Vocaluxe.Base /// /// Creates a new Vocaluxe Database if no file exists. Converts an existing old Ultrastar Deluxe highscore database into vocaluxe format. /// - /// Database file path + /// Database file path /// - private static bool CreateOrConvert(string FilePath) + private static bool _CreateOrConvert(string filePath) { using (SQLiteConnection connection = new SQLiteConnection()) { - connection.ConnectionString = "Data Source=" + FilePath; + connection.ConnectionString = "Data Source=" + filePath; try { @@ -531,19 +531,19 @@ namespace Vocaluxe.Base if (version == 1) { //Check for USDX 1.1 DB - CreateHighscoreDBV1(FilePath); - ConvertFrom110(FilePath); - UpdateDatabase(1, connection); + _CreateHighscoreDBV1(filePath); + _ConvertFrom110(filePath); + _UpdateDatabase(1, connection); } else if (version == 0 && scoresTableExists) { //Check for USDX 1.01 or CMD Mod DB - CreateHighscoreDBV1(FilePath); - ConvertFrom101(FilePath); - UpdateDatabase(1, connection); + _CreateHighscoreDBV1(filePath); + _ConvertFrom101(filePath); + _UpdateDatabase(1, connection); } else - CreateHighscoreDB(FilePath); + _CreateHighscoreDB(filePath); } else if (reader.FieldCount == 0) { @@ -551,28 +551,28 @@ namespace Vocaluxe.Base if (version == 1) { //Check for USDX 1.1 DB - CreateHighscoreDBV1(FilePath); - ConvertFrom110(FilePath); - UpdateDatabase(1, connection); + _CreateHighscoreDBV1(filePath); + _ConvertFrom110(filePath); + _UpdateDatabase(1, connection); } else if (version == 0 && scoresTableExists) { //Check for USDX 1.01 or CMD Mod DB - CreateHighscoreDBV1(FilePath); - ConvertFrom101(FilePath); - UpdateDatabase(1, connection); + _CreateHighscoreDBV1(filePath); + _ConvertFrom101(filePath); + _UpdateDatabase(1, connection); } else - CreateHighscoreDB(FilePath); + _CreateHighscoreDB(filePath); } else { reader.Read(); - int CurrentVersion = reader.GetInt32(0); - if (CurrentVersion < CSettings.iDatabaseHighscoreVersion) + int currentVersion = reader.GetInt32(0); + if (currentVersion < CSettings.DatabaseHighscoreVersion) { // update database - UpdateDatabase(CurrentVersion, connection); + _UpdateDatabase(currentVersion, connection); } } @@ -587,13 +587,13 @@ namespace Vocaluxe.Base /// /// Converts a USDX 1.1 database into the Vocaluxe format /// - /// Database file path + /// Database file path /// True if succeeded - private static bool ConvertFrom110(string FilePath) + private static bool _ConvertFrom110(string filePath) { using (SQLiteConnection connection = new SQLiteConnection()) { - connection.ConnectionString = "Data Source=" + FilePath; + connection.ConnectionString = "Data Source=" + filePath; try { @@ -633,8 +633,8 @@ namespace Vocaluxe.Base while (reader.Read()) { SData data = new SData(); - data.id = reader.GetInt32(0); - data.str1 = reader.GetString(1); + data.Id = reader.GetInt32(0); + data.Str1 = reader.GetString(1); Int64 ticks = 0; try @@ -643,7 +643,7 @@ namespace Vocaluxe.Base } catch {} - data.ticks = UnixTimeToTicks((int)ticks); + data.Ticks = _UnixTimeToTicks((int)ticks); scores.Add(data); } @@ -659,9 +659,9 @@ namespace Vocaluxe.Base while (reader.Read()) { SData data = new SData(); - data.id = reader.GetInt32(0); - data.str1 = reader.GetString(1); - data.str2 = reader.GetString(2); + data.Id = reader.GetInt32(0); + data.Str1 = reader.GetString(1); + data.Str2 = reader.GetString(2); songs.Add(data); } } @@ -669,14 +669,14 @@ namespace Vocaluxe.Base if (reader != null) reader.Dispose(); - SQLiteTransaction _Transaction = connection.BeginTransaction(); + SQLiteTransaction transaction = connection.BeginTransaction(); // update Title and Artist strings foreach (SData data in songs) { command.CommandText = "UPDATE Songs SET [Artist] = @artist, [Title] = @title WHERE [ID] = @id"; - command.Parameters.Add("@title", DbType.String, 0).Value = data.str2; - command.Parameters.Add("@artist", DbType.String, 0).Value = data.str1; - command.Parameters.Add("@id", DbType.Int32, 0).Value = data.id; + command.Parameters.Add("@title", DbType.String, 0).Value = data.Str2; + command.Parameters.Add("@artist", DbType.String, 0).Value = data.Str1; + command.Parameters.Add("@id", DbType.Int32, 0).Value = data.Id; command.ExecuteNonQuery(); } @@ -684,12 +684,12 @@ namespace Vocaluxe.Base foreach (SData data in scores) { command.CommandText = "UPDATE Scores SET [PlayerName] = @player, [Date] = @date WHERE [id] = @id"; - command.Parameters.Add("@player", DbType.String, 0).Value = data.str1; - command.Parameters.Add("@date", DbType.Int64, 0).Value = data.ticks; - command.Parameters.Add("@id", DbType.Int32, 0).Value = data.id; + command.Parameters.Add("@player", DbType.String, 0).Value = data.Str1; + command.Parameters.Add("@date", DbType.Int64, 0).Value = data.Ticks; + command.Parameters.Add("@id", DbType.Int32, 0).Value = data.Id; command.ExecuteNonQuery(); } - _Transaction.Commit(); + transaction.Commit(); //Delete old tables after conversion command.CommandText = "DROP TABLE US_Scores;"; @@ -713,13 +713,13 @@ namespace Vocaluxe.Base /// /// Converts a USDX 1.01 or CMD 1.01 database to Vocaluxe format /// - /// Database file path + /// Database file path /// True if succeeded - private static bool ConvertFrom101(string FilePath) + private static bool _ConvertFrom101(string filePath) { using (SQLiteConnection connection = new SQLiteConnection()) { - connection.ConnectionString = "Data Source=" + FilePath; + connection.ConnectionString = "Data Source=" + filePath; try { @@ -772,93 +772,93 @@ namespace Vocaluxe.Base List scores = new List(); List songs = new List(); - Sqlite3.sqlite3 OldDB; - int res = Sqlite3.sqlite3_open(FilePath, out OldDB); + Sqlite3.sqlite3 oldDB; + int res = Sqlite3.sqlite3_open(filePath, out oldDB); if (res != Sqlite3.SQLITE_OK) - CLog.LogError("Error opening Database: " + FilePath + " (" + Sqlite3.sqlite3_errmsg(OldDB) + ")"); + CLog.LogError("Error opening Database: " + filePath + " (" + Sqlite3.sqlite3_errmsg(oldDB) + ")"); else { - Sqlite3.Vdbe Stmt = new Sqlite3.Vdbe(); - res = Sqlite3.sqlite3_prepare_v2(OldDB, "SELECT id, Artist, Title FROM Songs", -1, ref Stmt, 0); + Sqlite3.Vdbe stmt = new Sqlite3.Vdbe(); + res = Sqlite3.sqlite3_prepare_v2(oldDB, "SELECT id, Artist, Title FROM Songs", -1, ref stmt, 0); if (res != Sqlite3.SQLITE_OK) - CLog.LogError("Error query Database: " + FilePath + " (" + Sqlite3.sqlite3_errmsg(OldDB) + ")"); + CLog.LogError("Error query Database: " + filePath + " (" + Sqlite3.sqlite3_errmsg(oldDB) + ")"); else { //Sqlite3.sqlite3_step(Stmt); - Encoding UTF8 = Encoding.UTF8; - Encoding CP1252 = Encoding.GetEncoding(1252); + Encoding utf8 = Encoding.UTF8; + Encoding cp1252 = Encoding.GetEncoding(1252); - while (Sqlite3.sqlite3_step(Stmt) == Sqlite3.SQLITE_ROW) + while (Sqlite3.sqlite3_step(stmt) == Sqlite3.SQLITE_ROW) { SData data = new SData(); - data.id = Sqlite3.sqlite3_column_int(Stmt, 0); + data.Id = Sqlite3.sqlite3_column_int(stmt, 0); - byte[] bytes = Sqlite3.sqlite3_column_rawbytes(Stmt, 1); + byte[] bytes = Sqlite3.sqlite3_column_rawbytes(stmt, 1); if (bytes != null) - data.str1 = UTF8.GetString(Encoding.Convert(CP1252, UTF8, bytes)); + data.Str1 = utf8.GetString(Encoding.Convert(cp1252, utf8, bytes)); else - data.str1 = "Someone"; + data.Str1 = "Someone"; - bytes = Sqlite3.sqlite3_column_rawbytes(Stmt, 2); + bytes = Sqlite3.sqlite3_column_rawbytes(stmt, 2); if (bytes != null) - data.str2 = UTF8.GetString(Encoding.Convert(CP1252, UTF8, bytes)); + data.Str2 = utf8.GetString(Encoding.Convert(cp1252, utf8, bytes)); else - data.str2 = "Someone"; + data.Str2 = "Someone"; songs.Add(data); } - Sqlite3.sqlite3_finalize(Stmt); + Sqlite3.sqlite3_finalize(stmt); } - Stmt = new Sqlite3.Vdbe(); + stmt = new Sqlite3.Vdbe(); if (!dateExists) - res = Sqlite3.sqlite3_prepare_v2(OldDB, "SELECT id, PlayerName FROM Scores", -1, ref Stmt, 0); + res = Sqlite3.sqlite3_prepare_v2(oldDB, "SELECT id, PlayerName FROM Scores", -1, ref stmt, 0); else - res = Sqlite3.sqlite3_prepare_v2(OldDB, "SELECT id, PlayerName, Date FROM Scores", -1, ref Stmt, 0); + res = Sqlite3.sqlite3_prepare_v2(oldDB, "SELECT id, PlayerName, Date FROM Scores", -1, ref stmt, 0); if (res != Sqlite3.SQLITE_OK) - CLog.LogError("Error query Database: " + FilePath + " (" + Sqlite3.sqlite3_errmsg(OldDB) + ")"); + CLog.LogError("Error query Database: " + filePath + " (" + Sqlite3.sqlite3_errmsg(oldDB) + ")"); else { //Sqlite3.sqlite3_step(Stmt); - Encoding UTF8 = Encoding.UTF8; - Encoding CP1252 = Encoding.GetEncoding(1252); + Encoding utf8 = Encoding.UTF8; + Encoding cp1252 = Encoding.GetEncoding(1252); - while (Sqlite3.sqlite3_step(Stmt) == Sqlite3.SQLITE_ROW) + while (Sqlite3.sqlite3_step(stmt) == Sqlite3.SQLITE_ROW) { SData data = new SData(); - data.id = Sqlite3.sqlite3_column_int(Stmt, 0); + data.Id = Sqlite3.sqlite3_column_int(stmt, 0); - byte[] bytes = Sqlite3.sqlite3_column_rawbytes(Stmt, 1); + byte[] bytes = Sqlite3.sqlite3_column_rawbytes(stmt, 1); if (bytes != null) - data.str1 = UTF8.GetString(Encoding.Convert(CP1252, UTF8, bytes)); + data.Str1 = utf8.GetString(Encoding.Convert(cp1252, utf8, bytes)); else - data.str1 = "Someone"; + data.Str1 = "Someone"; if (dateExists) - data.ticks = UnixTimeToTicks(Sqlite3.sqlite3_column_int(Stmt, 2)); + data.Ticks = _UnixTimeToTicks(Sqlite3.sqlite3_column_int(stmt, 2)); scores.Add(data); } - Sqlite3.sqlite3_finalize(Stmt); + Sqlite3.sqlite3_finalize(stmt); } } - Sqlite3.sqlite3_close(OldDB); + Sqlite3.sqlite3_close(oldDB); - SQLiteTransaction _Transaction = connection.BeginTransaction(); + SQLiteTransaction transaction = connection.BeginTransaction(); // update Title and Artist strings foreach (SData data in songs) { command.CommandText = "UPDATE Songs SET [Artist] = @artist, [Title] = @title WHERE [ID] = @id"; - command.Parameters.Add("@title", DbType.String, 0).Value = data.str2; - command.Parameters.Add("@artist", DbType.String, 0).Value = data.str1; - command.Parameters.Add("@id", DbType.Int32, 0).Value = data.id; + command.Parameters.Add("@title", DbType.String, 0).Value = data.Str2; + command.Parameters.Add("@artist", DbType.String, 0).Value = data.Str1; + command.Parameters.Add("@id", DbType.Int32, 0).Value = data.Id; command.ExecuteNonQuery(); } @@ -870,13 +870,13 @@ namespace Vocaluxe.Base else { command.CommandText = "UPDATE Scores SET [PlayerName] = @player, [Date] = @date WHERE [id] = @id"; - command.Parameters.Add("@date", DbType.Int64, 0).Value = data.ticks; + command.Parameters.Add("@date", DbType.Int64, 0).Value = data.Ticks; } - command.Parameters.Add("@player", DbType.String, 0).Value = data.str1; - command.Parameters.Add("@id", DbType.Int32, 0).Value = data.id; + command.Parameters.Add("@player", DbType.String, 0).Value = data.Str1; + command.Parameters.Add("@id", DbType.Int32, 0).Value = data.Id; command.ExecuteNonQuery(); } - _Transaction.Commit(); + transaction.Commit(); //Delete old tables after conversion command.CommandText = "DROP TABLE US_Scores;"; @@ -890,15 +890,15 @@ namespace Vocaluxe.Base return true; } - private static bool UpdateDatabase(int CurrentVersion, SQLiteConnection connection) + private static bool _UpdateDatabase(int currentVersion, SQLiteConnection connection) { bool updated = true; - if (CurrentVersion < 2) - updated &= ConvertV1toV2(connection); + if (currentVersion < 2) + updated &= _ConvertV1toV2(connection); return updated; } - private static bool ConvertV1toV2(SQLiteConnection connection) + private static bool _ConvertV1toV2(SQLiteConnection connection) { using (SQLiteCommand command = new SQLiteCommand(connection)) { @@ -915,12 +915,12 @@ namespace Vocaluxe.Base return true; } - private static bool ImportData(string SourceDBPath, string DestinationDBPath) + private static bool _ImportData(string sourceDBPath, string destinationDBPath) { #region open db using (SQLiteConnection connSource = new SQLiteConnection()) { - connSource.ConnectionString = "Data Source=" + SourceDBPath; + connSource.ConnectionString = "Data Source=" + sourceDBPath; try { @@ -928,47 +928,47 @@ namespace Vocaluxe.Base } catch (Exception e) { - CLog.LogError("Error on import high score data. Can't open source database \"" + SourceDBPath + "\" (" + e.Message + ")"); + CLog.LogError("Error on import high score data. Can't open source database \"" + sourceDBPath + "\" (" + e.Message + ")"); return false; } #endregion open db using (SQLiteCommand cmdSource = new SQLiteCommand(connSource)) { - SQLiteDataReader rSource; + SQLiteDataReader source; #region import table scores cmdSource.CommandText = "SELECT SongID, PlayerName, Score, LineNr, Date, Medley, Duet, ShortSong, Difficulty FROM Scores"; - rSource = cmdSource.ExecuteReader(); - if (rSource == null) + source = cmdSource.ExecuteReader(); + if (source == null) return false; - if (rSource.FieldCount == 0) + if (source.FieldCount == 0) { - rSource.Close(); + source.Close(); return true; } - while (rSource.Read()) + while (source.Read()) { - int songid = rSource.GetInt32(0); - string player = rSource.GetString(1); - int score = rSource.GetInt32(2); - int linenr = rSource.GetInt32(3); - long date = rSource.GetInt64(4); - int medley = rSource.GetInt32(5); - int duet = rSource.GetInt32(6); - int shortsong = rSource.GetInt32(7); - int diff = rSource.GetInt32(8); + int songid = source.GetInt32(0); + string player = source.GetString(1); + int score = source.GetInt32(2); + int linenr = source.GetInt32(3); + long date = source.GetInt64(4); + int medley = source.GetInt32(5); + int duet = source.GetInt32(6); + int shortsong = source.GetInt32(7); + int diff = source.GetInt32(8); string artist, title; int numplayed; - if (GetDataBaseSongInfos(songid, out artist, out title, out numplayed, SourceDBPath)) + if (_GetDataBaseSongInfos(songid, out artist, out title, out numplayed, sourceDBPath)) AddScore(player, score, linenr, date, medley, duet, shortsong, diff, artist, title, numplayed, _HighscoreFilePath); } #endregion import table scores - rSource.Close(); + source.Close(); } } @@ -977,11 +977,11 @@ namespace Vocaluxe.Base #endregion Highscores #region Cover - public static bool GetCover(string CoverPath, ref STexture tex, int MaxSize) + public static bool GetCover(string coverPath, ref STexture tex, int maxSize) { - if (!File.Exists(CoverPath)) + if (!File.Exists(coverPath)) { - CLog.LogError("Can't find File: " + CoverPath); + CLog.LogError("Can't find File: " + coverPath); return false; } @@ -995,7 +995,7 @@ namespace Vocaluxe.Base using (SQLiteCommand command = new SQLiteCommand(_ConnectionCover)) { command.CommandText = "SELECT id, width, height FROM Cover WHERE [Path] = @path"; - command.Parameters.Add("@path", DbType.String, 0).Value = CoverPath; + command.Parameters.Add("@path", DbType.String, 0).Value = coverPath; SQLiteDataReader reader = command.ExecuteReader(); @@ -1014,7 +1014,7 @@ namespace Vocaluxe.Base if (reader.HasRows) { reader.Read(); - byte[] data = GetBytes(reader); + byte[] data = _GetBytes(reader); reader.Dispose(); tex = CDraw.QuequeTexture(w, h, ref data); return true; @@ -1031,16 +1031,16 @@ namespace Vocaluxe.Base Bitmap origin; try { - origin = new Bitmap(CoverPath); + origin = new Bitmap(coverPath); } catch (Exception) { - CLog.LogError("Error loading Texture: " + CoverPath); + CLog.LogError("Error loading Texture: " + coverPath); return false; } - int w = MaxSize; - int h = MaxSize; + int w = maxSize; + int h = maxSize; byte[] data; try @@ -1056,9 +1056,9 @@ namespace Vocaluxe.Base g.DrawImage(origin, new Rectangle(0, 0, w, h)); data = new byte[w * h * 4]; - BitmapData bmp_data = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb); - Marshal.Copy(bmp_data.Scan0, data, 0, w * h * 4); - bmp.UnlockBits(bmp_data); + BitmapData bmpData = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb); + Marshal.Copy(bmpData.Scan0, data, 0, w * h * 4); + bmp.UnlockBits(bmpData); } } finally @@ -1071,11 +1071,11 @@ namespace Vocaluxe.Base command.CommandText = "INSERT INTO Cover (Path, width, height) VALUES (@path, @w, @h)"; command.Parameters.Add("@w", DbType.Int32).Value = w; command.Parameters.Add("@h", DbType.Int32).Value = h; - command.Parameters.Add("@path", DbType.String, 0).Value = CoverPath; + command.Parameters.Add("@path", DbType.String, 0).Value = coverPath; command.ExecuteNonQuery(); command.CommandText = "SELECT id FROM Cover WHERE [Path] = @path"; - command.Parameters.Add("@path", DbType.String, 0).Value = CoverPath; + command.Parameters.Add("@path", DbType.String, 0).Value = coverPath; reader = command.ExecuteReader(); if (reader != null) @@ -1117,7 +1117,7 @@ namespace Vocaluxe.Base } } - private static bool InitCoverDB() + private static bool _InitCoverDB() { using (SQLiteConnection connection = new SQLiteConnection()) { @@ -1147,18 +1147,18 @@ namespace Vocaluxe.Base if (reader == null) { // create new database/tables - CreateCoverDB(); + _CreateCoverDB(); } else if (reader.FieldCount == 0) { // create new database/tables - CreateCoverDB(); + _CreateCoverDB(); } else { reader.Read(); - if (reader.GetInt32(0) < CSettings.iDatabaseHighscoreVersion) + if (reader.GetInt32(0) < CSettings.DatabaseHighscoreVersion) { // update database } @@ -1170,7 +1170,7 @@ namespace Vocaluxe.Base return true; } - private static void CreateCoverDB() + private static void _CreateCoverDB() { using (SQLiteConnection connection = new SQLiteConnection()) { @@ -1191,7 +1191,7 @@ namespace Vocaluxe.Base command.ExecuteNonQuery(); command.CommandText = "INSERT INTO Version (id, Value) VALUES(NULL, @Value)"; - command.Parameters.Add("@Value", DbType.Int32).Value = CSettings.iDatabaseCoverVersion; + command.Parameters.Add("@Value", DbType.Int32).Value = CSettings.DatabaseCoverVersion; command.ExecuteNonQuery(); command.CommandText = "CREATE TABLE IF NOT EXISTS Cover ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, " + @@ -1207,7 +1207,7 @@ namespace Vocaluxe.Base #endregion Cover #region CreditsRessources - public static bool GetCreditsRessource(string FileName, ref STexture tex) + public static bool GetCreditsRessource(string fileName, ref STexture tex) { bool result = false; @@ -1225,7 +1225,7 @@ namespace Vocaluxe.Base using (SQLiteCommand command = new SQLiteCommand(connection)) { command.CommandText = "SELECT id, width, height FROM Images WHERE [Path] = @path"; - command.Parameters.Add("@path", DbType.String, 0).Value = FileName; + command.Parameters.Add("@path", DbType.String, 0).Value = fileName; SQLiteDataReader reader = command.ExecuteReader(); @@ -1245,7 +1245,7 @@ namespace Vocaluxe.Base { result = true; reader.Read(); - byte[] data = GetBytes(reader); + byte[] data = _GetBytes(reader); tex = CDraw.AddTexture(w, h, ref data); } } @@ -1259,11 +1259,11 @@ namespace Vocaluxe.Base } //If you want to add an image to db, call this method! - private static bool AddImageToCreditsDB(String ImagePath) + private static bool _AddImageToCreditsDB(String imagePath) { bool result = false; - if (File.Exists(ImagePath)) + if (File.Exists(imagePath)) { using (SQLiteConnection connection = new SQLiteConnection()) { @@ -1281,11 +1281,11 @@ namespace Vocaluxe.Base Bitmap origin; try { - origin = new Bitmap(ImagePath); + origin = new Bitmap(imagePath); } catch (Exception) { - CLog.LogError("Error loading Texture: " + ImagePath); + CLog.LogError("Error loading Texture: " + imagePath); return false; } int w = origin.Width; @@ -1296,18 +1296,18 @@ namespace Vocaluxe.Base { data = new byte[w * h * 4]; - BitmapData bmp_data = origin.LockBits(new Rectangle(0, 0, w, h), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb); - Marshal.Copy(bmp_data.Scan0, data, 0, w * h * 4); - origin.UnlockBits(bmp_data); + BitmapData bmpData = origin.LockBits(new Rectangle(0, 0, w, h), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb); + Marshal.Copy(bmpData.Scan0, data, 0, w * h * 4); + origin.UnlockBits(bmpData); command.CommandText = "INSERT INTO Images (Path, width, height) VALUES (@path, @w, @h)"; - command.Parameters.Add("@path", DbType.String, 0).Value = Path.GetFileName(ImagePath); + command.Parameters.Add("@path", DbType.String, 0).Value = Path.GetFileName(imagePath); command.Parameters.Add("@w", DbType.Int32, 0).Value = w; command.Parameters.Add("@h", DbType.Int32, 0).Value = h; command.ExecuteNonQuery(); command.CommandText = "SELECT id FROM Images WHERE [Path] = @path"; - command.Parameters.Add("@path", DbType.String, 0).Value = Path.GetFileName(ImagePath); + command.Parameters.Add("@path", DbType.String, 0).Value = Path.GetFileName(imagePath); SQLiteDataReader reader = command.ExecuteReader(); if (reader != null) @@ -1333,7 +1333,7 @@ namespace Vocaluxe.Base return result; } - private static bool InitCreditsRessourcesDB() + private static bool _InitCreditsRessourcesDB() { using (SQLiteConnection connection = new SQLiteConnection()) { @@ -1374,7 +1374,7 @@ namespace Vocaluxe.Base { reader.Read(); - if (reader.GetInt32(0) < CSettings.iDatabaseHighscoreVersion) + if (reader.GetInt32(0) < CSettings.DatabaseHighscoreVersion) { // update database } @@ -1387,7 +1387,7 @@ namespace Vocaluxe.Base return true; } - private static void CreateCreditsRessourcesDB() + private static void _CreateCreditsRessourcesDB() { using (SQLiteConnection connection = new SQLiteConnection()) { @@ -1408,7 +1408,7 @@ namespace Vocaluxe.Base command.ExecuteNonQuery(); command.CommandText = "INSERT INTO Version (id, Value) VALUES(NULL, @Value)"; - command.Parameters.Add("@Value", DbType.Int32).Value = CSettings.iDatabaseCreditsRessourcesVersion; + command.Parameters.Add("@Value", DbType.Int32).Value = CSettings.DatabaseCreditsRessourcesVersion; command.ExecuteNonQuery(); command.CommandText = "CREATE TABLE IF NOT EXISTS Images ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, " + @@ -1423,10 +1423,10 @@ namespace Vocaluxe.Base } #endregion CreditsRessources - private static byte[] GetBytes(SQLiteDataReader reader) + private static byte[] _GetBytes(SQLiteDataReader reader) { - const int CHUNK_SIZE = 2 * 1024; - byte[] buffer = new byte[CHUNK_SIZE]; + const int chunkSize = 2 * 1024; + byte[] buffer = new byte[chunkSize]; long bytesRead; long fieldOffset = 0; using (MemoryStream stream = new MemoryStream()) @@ -1442,10 +1442,10 @@ namespace Vocaluxe.Base } } - private static long UnixTimeToTicks(int UnixTime) + private static long _UnixTimeToTicks(int unixTime) { DateTime t70 = new DateTime(1970, 1, 1, 0, 0, 0, 0); - t70 = t70.AddSeconds(UnixTime); + t70 = t70.AddSeconds(unixTime); return t70.Ticks; } } diff --git a/Vocaluxe/Base/CDraw.cs b/Vocaluxe/Base/CDraw.cs index 46dac4cd..feb52eae 100644 --- a/Vocaluxe/Base/CDraw.cs +++ b/Vocaluxe/Base/CDraw.cs @@ -45,7 +45,7 @@ namespace Vocaluxe.Base MessageBox.Show(e.Message + " - Error in initializing of Direct3D. Please check if " + "your DirectX redistributables and graphic card drivers are up to date. You can " + "download the DirectX runtimes at http://www.microsoft.com/download/en/details.aspx?id=8109", - CSettings.sProgramName, MessageBoxButtons.OK, MessageBoxIcon.Error); + CSettings.ProgramName, MessageBoxButtons.OK, MessageBoxIcon.Error); CLog.LogError(e.Message + " - Error in initializing of Direct3D. Please check if " + "your DirectX redistributables and graphic card drivers are up to date. You can " + "download the DirectX runtimes at http://www.microsoft.com/download/en/details.aspx?id=8109"); @@ -89,9 +89,9 @@ namespace Vocaluxe.Base return _Draw.GetTextBounds(text); } - public static RectangleF GetTextBounds(CText text, float Height) + public static RectangleF GetTextBounds(CText text, float height) { - return _Draw.GetTextBounds(text, Height); + return _Draw.GetTextBounds(text, height); } public static void DrawLine(int a, int r, int g, int b, int w, int x1, int y1, int x2, int y2) @@ -99,15 +99,15 @@ namespace Vocaluxe.Base _Draw.DrawLine(a, r, g, b, w, x1, y1, x2, y2); } - public static void DrawRect(SColorF Color, SRectF Rect, float Thickness) + public static void DrawRect(SColorF color, SRectF rect, float thickness) { - if (Thickness <= 0f) + if (thickness <= 0f) return; - _Draw.DrawColor(Color, new SRectF(Rect.X - Thickness / 2, Rect.Y - Thickness / 2, Rect.W + Thickness, Thickness, Rect.Z)); - _Draw.DrawColor(Color, new SRectF(Rect.X - Thickness / 2, Rect.Y + Rect.H - Thickness / 2, Rect.W + Thickness, Thickness, Rect.Z)); - _Draw.DrawColor(Color, new SRectF(Rect.X - Thickness / 2, Rect.Y - Thickness / 2, Thickness, Rect.H + Thickness, Rect.Z)); - _Draw.DrawColor(Color, new SRectF(Rect.X + Rect.W - Thickness / 2, Rect.Y - Thickness / 2, Thickness, Rect.H + Thickness, Rect.Z)); + _Draw.DrawColor(color, new SRectF(rect.X - thickness / 2, rect.Y - thickness / 2, rect.W + thickness, thickness, rect.Z)); + _Draw.DrawColor(color, new SRectF(rect.X - thickness / 2, rect.Y + rect.H - thickness / 2, rect.W + thickness, thickness, rect.Z)); + _Draw.DrawColor(color, new SRectF(rect.X - thickness / 2, rect.Y - thickness / 2, thickness, rect.H + thickness, rect.Z)); + _Draw.DrawColor(color, new SRectF(rect.X + rect.W - thickness / 2, rect.Y - thickness / 2, thickness, rect.H + thickness, rect.Z)); } public static void DrawColor(SColorF color, SRectF rect) @@ -130,9 +130,9 @@ namespace Vocaluxe.Base return _Draw.CopyScreen(); } - public static void CopyScreen(ref STexture Texture) + public static void CopyScreen(ref STexture texture) { - _Draw.CopyScreen(ref Texture); + _Draw.CopyScreen(ref texture); } public static void MakeScreenShot() @@ -141,33 +141,33 @@ namespace Vocaluxe.Base } // Draw Basic Text (must be deleted later) - public static void DrawText(string Text, int x, int y, int h) + public static void DrawText(string text, int x, int y, int h) { - _Draw.DrawText(Text, x, y, h); + _Draw.DrawText(text, x, y, h); } - public static STexture AddTexture(Bitmap Bitmap) + public static STexture AddTexture(Bitmap bitmap) { - return _Draw.AddTexture(Bitmap); + return _Draw.AddTexture(bitmap); } - public static STexture AddTexture(string TexturePath) + public static STexture AddTexture(string texturePath) { - return _Draw.AddTexture(TexturePath); + return _Draw.AddTexture(texturePath); } - public static STexture AddTexture(string TexturePath, int MaxSize) + public static STexture AddTexture(string texturePath, int maxSize) { - if (MaxSize == 0) - return _Draw.AddTexture(TexturePath); + if (maxSize == 0) + return _Draw.AddTexture(texturePath); - if (!File.Exists(TexturePath)) + if (!File.Exists(texturePath)) return new STexture(-1); - using (Bitmap origin = new Bitmap(TexturePath)) + using (Bitmap origin = new Bitmap(texturePath)) { - int w = MaxSize; - int h = MaxSize; + int w = maxSize; + int h = maxSize; if (origin.Width >= origin.Height && origin.Width > w) h = (int)Math.Round((float)w / origin.Width * origin.Height); @@ -182,87 +182,87 @@ namespace Vocaluxe.Base } } - public static STexture AddTexture(int W, int H, IntPtr Data) + public static STexture AddTexture(int w, int h, IntPtr data) { - return _Draw.AddTexture(W, H, Data); + return _Draw.AddTexture(w, h, data); } - public static STexture AddTexture(int W, int H, ref byte[] Data) + public static STexture AddTexture(int w, int h, ref byte[] data) { - return _Draw.AddTexture(W, H, ref Data); + return _Draw.AddTexture(w, h, ref data); } - public static STexture QuequeTexture(int W, int H, ref byte[] Data) + public static STexture QuequeTexture(int w, int h, ref byte[] data) { - return _Draw.QuequeTexture(W, H, ref Data); + return _Draw.QuequeTexture(w, h, ref data); } - public static bool UpdateTexture(ref STexture Texture, ref byte[] Data) + public static bool UpdateTexture(ref STexture texture, ref byte[] data) { - return _Draw.UpdateTexture(ref Texture, ref Data); + return _Draw.UpdateTexture(ref texture, ref data); } - public static bool UpdateTexture(ref STexture Texture, IntPtr Data) + public static bool UpdateTexture(ref STexture texture, IntPtr data) { - return _Draw.UpdateTexture(ref Texture, Data); + return _Draw.UpdateTexture(ref texture, data); } - public static void RemoveTexture(ref STexture Texture) + public static void RemoveTexture(ref STexture texture) { - _Draw.RemoveTexture(ref Texture); + _Draw.RemoveTexture(ref texture); } - public static void DrawTexture(STexture Texture) + public static void DrawTexture(STexture texture) { - _Draw.DrawTexture(Texture); + _Draw.DrawTexture(texture); } - public static void DrawTexture(STexture Texture, SRectF rect) + public static void DrawTexture(STexture texture, SRectF rect) { - _Draw.DrawTexture(Texture, rect); + _Draw.DrawTexture(texture, rect); } - public static void DrawTexture(STexture Texture, SRectF rect, SColorF color) + public static void DrawTexture(STexture texture, SRectF rect, SColorF color) { - _Draw.DrawTexture(Texture, rect, color); + _Draw.DrawTexture(texture, rect, color); } - public static void DrawTexture(STexture Texture, SRectF rect, SColorF color, SRectF bounds) + public static void DrawTexture(STexture texture, SRectF rect, SColorF color, SRectF bounds) { - _Draw.DrawTexture(Texture, rect, color, bounds); + _Draw.DrawTexture(texture, rect, color, bounds); } - public static void DrawTexture(STexture Texture, SRectF rect, SColorF color, bool mirrored) + public static void DrawTexture(STexture texture, SRectF rect, SColorF color, bool mirrored) { - _Draw.DrawTexture(Texture, rect, color, mirrored); + _Draw.DrawTexture(texture, rect, color, mirrored); } - public static void DrawTexture(STexture Texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored) + public static void DrawTexture(STexture texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored) { - _Draw.DrawTexture(Texture, rect, color, bounds, mirrored); + _Draw.DrawTexture(texture, rect, color, bounds, mirrored); } - public static void DrawTexture(STexture Texture, SRectF rect, SColorF color, float begin, float end) + public static void DrawTexture(STexture texture, SRectF rect, SColorF color, float begin, float end) { - _Draw.DrawTexture(Texture, rect, color, begin, end); + _Draw.DrawTexture(texture, rect, color, begin, end); } - public static void DrawTexture(CStatic StaticBounds, STexture Texture, EAspect Aspect) + public static void DrawTexture(CStatic staticBounds, STexture texture, EAspect aspect) { - RectangleF bounds = new RectangleF(StaticBounds.Rect.X, StaticBounds.Rect.Y, StaticBounds.Rect.W, StaticBounds.Rect.H); - RectangleF rect = new RectangleF(0f, 0f, Texture.width, Texture.height); + RectangleF bounds = new RectangleF(staticBounds.Rect.X, staticBounds.Rect.Y, staticBounds.Rect.W, staticBounds.Rect.H); + RectangleF rect = new RectangleF(0f, 0f, texture.Width, texture.Height); if (rect.Height <= 0f) return; - CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, Aspect); - DrawTexture(Texture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, StaticBounds.Rect.Z), - Texture.color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f), false); + CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, aspect); + DrawTexture(texture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, staticBounds.Rect.Z), + texture.Color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f), false); } - public static void DrawTextureReflection(STexture Texture, SRectF rect, SColorF color, SRectF bounds, float space, float height) + public static void DrawTextureReflection(STexture texture, SRectF rect, SColorF color, SRectF bounds, float space, float height) { - _Draw.DrawTextureReflection(Texture, rect, color, bounds, space, height); + _Draw.DrawTextureReflection(texture, rect, color, bounds, space, height); } public static int TextureCount() diff --git a/Vocaluxe/Base/CFont.cs b/Vocaluxe/Base/CFont.cs index b0403dda..3cc030d6 100644 --- a/Vocaluxe/Base/CFont.cs +++ b/Vocaluxe/Base/CFont.cs @@ -13,25 +13,25 @@ namespace Vocaluxe.Base { class CGlyph { - private readonly float _SIZEh = 50f; - public float SIZEh + private readonly float _Sizeh = 50f; + public float Sizeh { - get { return _SIZEh; } + get { return _Sizeh; } } public STexture Texture; public char Chr; - public int width; + public int Width; - public CGlyph(char chr, float MaxHigh) + public CGlyph(char chr, float maxHigh) { - _SIZEh = MaxHigh; + _Sizeh = maxHigh; float outline = CFonts.Outline; TextFormatFlags flags = TextFormatFlags.NoPadding | TextFormatFlags.NoPrefix; - float factor = GetFactor(chr, flags); - CFonts.Height = SIZEh * factor; + float factor = _GetFactor(chr, flags); + CFonts.Height = Sizeh * factor; Font fo; Size sizeB; SizeF size; @@ -51,12 +51,12 @@ namespace Vocaluxe.Base g.SmoothingMode = SmoothingMode.AntiAlias; g.InterpolationMode = InterpolationMode.HighQualityBicubic; g.TextRenderingHint = TextRenderingHint.ClearTypeGridFit; - CFonts.Height = SIZEh; + 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); + 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()) { @@ -64,7 +64,7 @@ namespace Vocaluxe.Base chr.ToString(), fo.FontFamily, (int)fo.Style, - SIZEh, + Sizeh, point, new StringFormat()); @@ -74,7 +74,7 @@ namespace Vocaluxe.Base (int)CFonts.OutlineColor.R * 255, (int)CFonts.OutlineColor.G * 255, (int)CFonts.OutlineColor.B * 255), - SIZEh * outline)) + Sizeh * outline)) { pen.LineJoin = LineJoin.Round; g.DrawPath(pen, path); @@ -92,7 +92,7 @@ namespace Vocaluxe.Base Texture = CDraw.AddTexture(bmp); //bmp.Save("test.png", ImageFormat.Png); Chr = chr; - width = (int)((1f + outline / 2f) * sizeB.Width * Texture.width / factor / bmp.Width); + Width = (int)((1f + outline / 2f) * sizeB.Width * Texture.Width / factor / bmp.Width); g.Dispose(); } fo.Dispose(); @@ -103,7 +103,7 @@ namespace Vocaluxe.Base CDraw.RemoveTexture(ref Texture); } - private float GetFactor(char chr, TextFormatFlags flags) + private float _GetFactor(char chr, TextFormatFlags flags) { if (CFonts.Style == EStyle.Normal) return 1f; @@ -111,14 +111,14 @@ namespace Vocaluxe.Base EStyle style = CFonts.Style; CFonts.Style = EStyle.Normal; - CFonts.Height = SIZEh; - float h_style, h_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); - h_normal = sizeB.Height; + hNormal = sizeB.Height; } CFonts.Style = style; using (Graphics g = Graphics.FromHwnd(IntPtr.Zero)) @@ -126,59 +126,59 @@ namespace Vocaluxe.Base 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); - h_style = sizeB.Height; + hStyle = sizeB.Height; } - return h_normal / h_style; + return hNormal / hStyle; } } class CFont : IDisposable { private readonly Dictionary _Glyphs; - private PrivateFontCollection fonts; - private FontFamily family; - private readonly float SIZEh; + private PrivateFontCollection _Fonts; + private FontFamily _Family; + private readonly float _Sizeh; public string FilePath; - public CFont(string File) + public CFont(string file) { - FilePath = File; + FilePath = file; _Glyphs = new Dictionary(); switch (CConfig.TextureQuality) { case ETextureQuality.TR_CONFIG_TEXTURE_LOWEST: - SIZEh = 25f; + _Sizeh = 25f; break; case ETextureQuality.TR_CONFIG_TEXTURE_LOW: - SIZEh = 50f; + _Sizeh = 50f; break; case ETextureQuality.TR_CONFIG_TEXTURE_MEDIUM: - SIZEh = 100f; + _Sizeh = 100f; break; case ETextureQuality.TR_CONFIG_TEXTURE_HIGH: - SIZEh = 200f; + _Sizeh = 200f; break; case ETextureQuality.TR_CONFIG_TEXTURE_HIGHEST: - SIZEh = 400f; + _Sizeh = 400f; break; default: - SIZEh = 100f; + _Sizeh = 100f; break; } } public Font GetFont() { - if (fonts == null) + if (_Fonts == null) { - fonts = new PrivateFontCollection(); + _Fonts = new PrivateFontCollection(); try { - fonts.AddFontFile(FilePath); - family = fonts.Families[0]; + _Fonts.AddFontFile(FilePath); + _Family = _Fonts.Families[0]; } catch (Exception e) { @@ -186,7 +186,7 @@ namespace Vocaluxe.Base } } - return new Font(family, CFonts.Height, CFonts.GetFontStyle(), GraphicsUnit.Pixel); + 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) @@ -220,9 +220,9 @@ namespace Vocaluxe.Base 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; + 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); } @@ -231,8 +231,8 @@ namespace Vocaluxe.Base AddGlyph(chr); CGlyph glyph = _Glyphs[chr]; - float factor = CFonts.Height / glyph.Texture.height; - return glyph.width * factor; + float factor = CFonts.Height / glyph.Texture.Height; + return glyph.Width * factor; } public float GetHeight(char chr) @@ -252,7 +252,7 @@ namespace Vocaluxe.Base return; float h = CFonts.Height; - _Glyphs.Add(chr, new CGlyph(chr, SIZEh)); + _Glyphs.Add(chr, new CGlyph(chr, _Sizeh)); CFonts.Height = h; } @@ -265,10 +265,10 @@ namespace Vocaluxe.Base public void Dispose() { - if (fonts != null) + if (_Fonts != null) { - fonts.Dispose(); - fonts = null; + _Fonts.Dispose(); + _Fonts = null; UnloadAllGlyphs(); } GC.SuppressFinalize(this); @@ -300,7 +300,7 @@ namespace Vocaluxe.Base static class CFonts { - private static readonly XmlWriterSettings _settings = new XmlWriterSettings(); + private static readonly XmlWriterSettings _Settings = new XmlWriterSettings(); private static List _Fonts; private static int _CurrentFont; @@ -357,9 +357,9 @@ namespace Vocaluxe.Base public static void Init() { - _settings.Indent = true; - _settings.Encoding = Encoding.UTF8; - _settings.ConformanceLevel = ConformanceLevel.Document; + _Settings.Indent = true; + _Settings.Encoding = Encoding.UTF8; + _Settings.ConformanceLevel = ConformanceLevel.Document; _CurrentFont = 0; PartyModeID = -1; @@ -371,7 +371,7 @@ namespace Vocaluxe.Base _Fonts = new List(); _CurrentFont = 0; - LoadFontList(); + _LoadFontList(); } public static Font GetFont() @@ -397,77 +397,77 @@ namespace Vocaluxe.Base } #region DrawText - public static void DrawText(string Text, int x, int y, int h) + public static void DrawText(string text, int x, int y, int h) { - DrawText(Text, h, x, y, 0f, new SColorF(0f, 0f, 0f, 1f)); + DrawText(text, h, x, y, 0f, new SColorF(0f, 0f, 0f, 1f)); } - public static void DrawText(string Text, float x, float y, float z) + public static void DrawText(string text, float x, float y, float z) { - DrawText(Text, Height, x, y, z, new SColorF(0f, 0f, 0f, 1f)); + DrawText(text, Height, x, y, z, new SColorF(0f, 0f, 0f, 1f)); } - public static void DrawText(string Text, float h, float x, float y, float z, SColorF color) + public static void DrawText(string text, float h, float x, float y, float z, SColorF color) { if (h <= 0f) return; - if (Text.Length == 0) + if (text.Length == 0) return; Height = h; - CFont Font = _GetCurrentFont(); + CFont font = _GetCurrentFont(); float dx = x; - foreach (char chr in Text) + foreach (char chr in text) { - Font.DrawGlyph(chr, dx, y, Height, z, color); - dx += Font.GetWidth(chr); + font.DrawGlyph(chr, dx, y, Height, z, color); + dx += font.GetWidth(chr); } } - public static void DrawTextReflection(string Text, float h, float x, float y, float z, SColorF color, float rspace, float rheight) + public static void DrawTextReflection(string text, float h, float x, float y, float z, SColorF color, float rspace, float rheight) { if (h <= 0f) return; - if (Text.Length == 0) + if (text.Length == 0) return; Height = h; - CFont Font = _GetCurrentFont(); + CFont font = _GetCurrentFont(); float dx = x; - foreach (char chr in Text) + foreach (char chr in text) { - Font.DrawGlyphReflection(chr, dx, y, Height, z, color, rspace, rheight); - dx += Font.GetWidth(chr); + font.DrawGlyphReflection(chr, dx, y, Height, z, color, rspace, rheight); + dx += font.GetWidth(chr); } } - public static void DrawText(string Text, float h, float x, float y, float z, SColorF color, float begin, float end) + public static void DrawText(string text, float h, float x, float y, float z, SColorF color, float begin, float end) { if (h <= 0f) return; - if (Text.Length == 0) + if (text.Length == 0) return; Height = h; float dx = x; - float w = GetTextWidth(Text); + float w = GetTextWidth(text); if (w <= 0f) return; float x1 = x + w * begin; float x2 = x + w * end; - CFont Font = _GetCurrentFont(); + CFont font = _GetCurrentFont(); - foreach (char chr in Text) + foreach (char chr in text) { - float w2 = Font.GetWidth(chr); + float w2 = font.GetWidth(chr); float b = (x1 - dx) / w2; if (b < 1f) @@ -479,7 +479,7 @@ namespace Vocaluxe.Base { if (e > 1f) e = 1f; - Font.DrawGlyph(chr, dx, y, Height, z, color, b, e); + font.DrawGlyph(chr, dx, y, Height, z, color, b, e); } } dx += w2; @@ -504,32 +504,32 @@ namespace Vocaluxe.Base } } - public static void SetFont(string FontName) + public static void SetFont(string fontName) { - int Index = -1; + int index = -1; if (PartyModeID != -1) { - Index = GetFontIndexParty(PartyModeID, FontName); + index = _GetFontIndexParty(PartyModeID, fontName); - if (Index >= 0 && Index < _Fonts.Count) + if (index >= 0 && index < _Fonts.Count) { - _CurrentFont = Index; + _CurrentFont = index; return; } } - Index = GetFontIndex(CConfig.Theme, FontName); + index = _GetFontIndex(CConfig.Theme, fontName); - if (Index >= 0 && Index < _Fonts.Count) + if (index >= 0 && index < _Fonts.Count) { - _CurrentFont = Index; + _CurrentFont = index; return; } for (int i = 0; i < _Fonts.Count; i++) { - if (!_Fonts[i].IsThemeFont && _Fonts[i].Name == FontName) + if (!_Fonts[i].IsThemeFont && _Fonts[i].Name == fontName) { _CurrentFont = i; return; @@ -552,9 +552,9 @@ namespace Vocaluxe.Base public static float GetTextWidth(string text) { float dx = 0; - CFont Font = _GetCurrentFont(); + CFont font = _GetCurrentFont(); foreach (char chr in text) - dx += Font.GetWidth(chr); + dx += font.GetWidth(chr); return dx; } @@ -562,17 +562,17 @@ namespace Vocaluxe.Base { //return TextRenderer.MeasureText(text, GetFont()).Height; float h = 0f; - CFont Font = _GetCurrentFont(); + CFont font = _GetCurrentFont(); foreach (char chr in text) { - float hh = Font.GetHeight(chr); + float hh = font.GetHeight(chr); if (hh > h) h = hh; } return h; } - private static void _LoadFontFiles(CXMLReader xmlReader, string FontFolder, string ThemeName = "", int PartyModeId = -1) + private static void _LoadFontFiles(CXMLReader xmlReader, string fontFolder, string themeName = "", int partyModeId = -1) { string value = string.Empty; int i = 1; @@ -580,9 +580,9 @@ namespace Vocaluxe.Base { SFont sf = new SFont(); sf.Folder = value; - sf.IsThemeFont = ThemeName.Length > 0; - sf.ThemeName = ThemeName; - sf.PartyModeID = PartyModeId; + sf.IsThemeFont = themeName.Length > 0; + sf.ThemeName = themeName; + sf.PartyModeID = partyModeId; bool ok = true; @@ -592,25 +592,25 @@ namespace Vocaluxe.Base ok &= xmlReader.GetValue("//root/Fonts/Font" + i.ToString() + "/FileNormal", ref value, value); sf.FileNormal = value; - value = Path.Combine(FontFolder, Path.Combine(sf.Folder, value)); + value = Path.Combine(fontFolder, Path.Combine(sf.Folder, value)); CFont f = new CFont(value); sf.Normal = f; ok &= xmlReader.GetValue("//root/Fonts/Font" + i.ToString() + "/FileItalic", ref value, value); sf.FileItalic = value; - value = Path.Combine(FontFolder, Path.Combine(sf.Folder, value)); + value = Path.Combine(fontFolder, Path.Combine(sf.Folder, value)); f = new CFont(value); sf.Italic = f; ok &= xmlReader.GetValue("//root/Fonts/Font" + i.ToString() + "/FileBold", ref value, value); sf.FileBold = value; - value = Path.Combine(FontFolder, Path.Combine(sf.Folder, value)); + value = Path.Combine(fontFolder, Path.Combine(sf.Folder, value)); f = new CFont(value); sf.Bold = f; ok &= xmlReader.GetValue("//root/Fonts/Font" + i.ToString() + "/FileBoldItalic", ref value, value); sf.FileBoldItalic = value; - value = Path.Combine(FontFolder, Path.Combine(sf.Folder, value)); + value = Path.Combine(fontFolder, Path.Combine(sf.Folder, value)); f = new CFont(value); sf.BoldItalic = f; @@ -628,10 +628,10 @@ namespace Vocaluxe.Base else { string fontTypes; - if (PartyModeId >= 0) + if (partyModeId >= 0) fontTypes = "theme fonts for party mode"; - else if (ThemeName.Length > 0) - fontTypes = "theme fonts for theme \"" + ThemeName + "\""; + else if (themeName.Length > 0) + fontTypes = "theme fonts for theme \"" + themeName + "\""; else fontTypes = "basic fonts"; CLog.LogError("Error loading " + fontTypes + ": Error in Font" + i.ToString()); @@ -644,143 +644,143 @@ namespace Vocaluxe.Base /// Load default fonts /// /// - private static bool LoadFontList() + private static bool _LoadFontList() { - CXMLReader xmlReader = CXMLReader.OpenFile(Path.Combine(CSettings.sFolderFonts, CSettings.sFileFonts)); + CXMLReader xmlReader = CXMLReader.OpenFile(Path.Combine(CSettings.FolderFonts, CSettings.FileFonts)); if (xmlReader == null) return false; _Fonts.Clear(); - _LoadFontFiles(xmlReader, Path.Combine(Directory.GetCurrentDirectory(), CSettings.sFolderFonts)); + _LoadFontFiles(xmlReader, Path.Combine(Directory.GetCurrentDirectory(), CSettings.FolderFonts)); return true; } /// /// Loads theme fonts from skin file /// - public static void LoadThemeFonts(string ThemeName, string FontFolder, CXMLReader xmlReader) + public static void LoadThemeFonts(string themeName, string fontFolder, CXMLReader xmlReader) { - _LoadFontFiles(xmlReader, FontFolder, ThemeName); + _LoadFontFiles(xmlReader, fontFolder, themeName); CLog.StartBenchmark(1, "BuildGlyphs"); - BuildGlyphs(); + _BuildGlyphs(); CLog.StopBenchmark(1, "BuildGlyphs"); } /// /// Loads party mode fonts from skin file /// - public static void LoadPartyModeFonts(int PartyModeID, string FontFolder, CXMLReader xmlReader) + public static void LoadPartyModeFonts(int partyModeID, string fontFolder, CXMLReader xmlReader) { - _LoadFontFiles(xmlReader, FontFolder, "", PartyModeID); + _LoadFontFiles(xmlReader, fontFolder, "", partyModeID); CLog.StartBenchmark(1, "BuildGlyphs"); - BuildGlyphs(); + _BuildGlyphs(); CLog.StopBenchmark(1, "BuildGlyphs"); } - public static void SaveThemeFonts(string ThemeName, XmlWriter writer) + public static void SaveThemeFonts(string themeName, XmlWriter writer) { if (_Fonts.Count == 0) return; - int Index = 0; - int FontNr = 1; - bool SetStart = false; - while (Index < _Fonts.Count) + int index = 0; + int fontNr = 1; + bool setStart = false; + while (index < _Fonts.Count) { - if (_Fonts[Index].IsThemeFont && _Fonts[Index].ThemeName == ThemeName) + if (_Fonts[index].IsThemeFont && _Fonts[index].ThemeName == themeName) { - if (!SetStart) + if (!setStart) { writer.WriteStartElement("Fonts"); - SetStart = true; + setStart = true; } - writer.WriteStartElement("Font" + FontNr.ToString()); + writer.WriteStartElement("Font" + fontNr.ToString()); - writer.WriteElementString("Name", _Fonts[Index].Name); - writer.WriteElementString("Folder", _Fonts[Index].Folder); + writer.WriteElementString("Name", _Fonts[index].Name); + writer.WriteElementString("Folder", _Fonts[index].Folder); - writer.WriteElementString("Outline", _Fonts[Index].Outline.ToString("#0.00")); - writer.WriteElementString("OutlineColorR", _Fonts[Index].OutlineColor.R.ToString("#0.00")); - writer.WriteElementString("OutlineColorG", _Fonts[Index].OutlineColor.G.ToString("#0.00")); - writer.WriteElementString("OutlineColorB", _Fonts[Index].OutlineColor.B.ToString("#0.00")); - writer.WriteElementString("OutlineColorA", _Fonts[Index].OutlineColor.A.ToString("#0.00")); + writer.WriteElementString("Outline", _Fonts[index].Outline.ToString("#0.00")); + writer.WriteElementString("OutlineColorR", _Fonts[index].OutlineColor.R.ToString("#0.00")); + writer.WriteElementString("OutlineColorG", _Fonts[index].OutlineColor.G.ToString("#0.00")); + writer.WriteElementString("OutlineColorB", _Fonts[index].OutlineColor.B.ToString("#0.00")); + writer.WriteElementString("OutlineColorA", _Fonts[index].OutlineColor.A.ToString("#0.00")); - writer.WriteElementString("FileNormal", _Fonts[Index].FileNormal); - writer.WriteElementString("FileBold", _Fonts[Index].FileBold); - writer.WriteElementString("FileItalic", _Fonts[Index].FileItalic); - writer.WriteElementString("FileBoldItalic", _Fonts[Index].FileBoldItalic); + writer.WriteElementString("FileNormal", _Fonts[index].FileNormal); + writer.WriteElementString("FileBold", _Fonts[index].FileBold); + writer.WriteElementString("FileItalic", _Fonts[index].FileItalic); + writer.WriteElementString("FileBoldItalic", _Fonts[index].FileBoldItalic); writer.WriteEndElement(); - FontNr++; + fontNr++; } - Index++; + index++; } - if (SetStart) + if (setStart) writer.WriteEndElement(); } - public static void UnloadThemeFonts(string ThemeName) + public static void UnloadThemeFonts(string themeName) { if (_Fonts.Count == 0) return; - int Index = 0; - while (Index < _Fonts.Count) + int index = 0; + while (index < _Fonts.Count) { - if (_Fonts[Index].IsThemeFont && _Fonts[Index].ThemeName == ThemeName) + if (_Fonts[index].IsThemeFont && _Fonts[index].ThemeName == themeName) { - _Fonts[Index].Normal.UnloadAllGlyphs(); - _Fonts[Index].Italic.UnloadAllGlyphs(); - _Fonts[Index].Bold.UnloadAllGlyphs(); - _Fonts[Index].BoldItalic.UnloadAllGlyphs(); - _Fonts.RemoveAt(Index); + _Fonts[index].Normal.UnloadAllGlyphs(); + _Fonts[index].Italic.UnloadAllGlyphs(); + _Fonts[index].Bold.UnloadAllGlyphs(); + _Fonts[index].BoldItalic.UnloadAllGlyphs(); + _Fonts.RemoveAt(index); } else - Index++; + index++; } } - private static int GetFontIndex(string ThemeName, string FontName) + private static int _GetFontIndex(string themeName, string fontName) { - if (ThemeName.Length == 0 || FontName.Length == 0) + if (themeName.Length == 0 || fontName.Length == 0) return -1; for (int i = 0; i < _Fonts.Count; i++) { - if (_Fonts[i].IsThemeFont && _Fonts[i].Name == FontName && _Fonts[i].ThemeName == ThemeName) + if (_Fonts[i].IsThemeFont && _Fonts[i].Name == fontName && _Fonts[i].ThemeName == themeName) return i; } return -1; } - private static int GetFontIndexParty(int PartyModeID, string FontName) + private static int _GetFontIndexParty(int partyModeID, string fontName) { - if (PartyModeID == -1 || FontName.Length == 0) + if (partyModeID == -1 || fontName.Length == 0) 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].Name == fontName && _Fonts[i].PartyModeID == partyModeID) return i; } return -1; } - private static void BuildGlyphs() + private static void _BuildGlyphs() { - string Text = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPGRSTUVWGXZ1234567890"; + string text = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPGRSTUVWGXZ1234567890"; for (int i = 0; i < _Fonts.Count; i++) { CurrentFont = i; - foreach (char chr in Text) + foreach (char chr in text) { Style = EStyle.Normal; _Fonts[_CurrentFont].Normal.AddGlyph(chr); diff --git a/Vocaluxe/Base/CGame.cs b/Vocaluxe/Base/CGame.cs index fd6b6917..c741659d 100644 --- a/Vocaluxe/Base/CGame.cs +++ b/Vocaluxe/Base/CGame.cs @@ -26,15 +26,15 @@ namespace Vocaluxe.Base get { return _Rand; } } - public static float GetBeatFromTime(float Time, float BPM, float Gap) + public static float GetBeatFromTime(float time, float bpm, float gap) { - return BPM / 60 * (Time - Gap); + return bpm / 60 * (time - gap); } - public static float GetTimeFromBeats(float Beats, float BPM) + public static float GetTimeFromBeats(float beats, float bpm) { - if (BPM > 0f) - return Beats / BPM * 60f; + if (bpm > 0f) + return beats / bpm * 60f; return 0f; } @@ -85,24 +85,24 @@ namespace Vocaluxe.Base get { return _GameMode.GetCurrentGameMode(); } } - public static bool AddVisibleSong(int VisibleIndex, EGameMode GameMode) + public static bool AddVisibleSong(int visibleIndex, EGameMode gameMode) { - return _GameMode.AddVisibleSong(VisibleIndex, GameMode); + return _GameMode.AddVisibleSong(visibleIndex, gameMode); } - public static bool AddSong(int AbsoluteIndex, EGameMode GameMode) + public static bool AddSong(int absoluteIndex, EGameMode gameMode) { - return _GameMode.AddSong(AbsoluteIndex, GameMode); + return _GameMode.AddSong(absoluteIndex, gameMode); } - public static bool RemoveVisibleSong(int VisibleIndex) + public static bool RemoveVisibleSong(int visibleIndex) { - return _GameMode.RemoveVisibleSong(VisibleIndex); + return _GameMode.RemoveVisibleSong(visibleIndex); } - public static bool RemoveSong(int AbsoluteIndex) + public static bool RemoveSong(int absoluteIndex) { - return _GameMode.RemoveSong(AbsoluteIndex); + return _GameMode.RemoveSong(absoluteIndex); } public static void ClearSongs() @@ -140,14 +140,14 @@ namespace Vocaluxe.Base return _GameMode.GetSong(); } - public static CSong GetSong(int Num) + public static CSong GetSong(int num) { - return _GameMode.GetSong(Num); + return _GameMode.GetSong(num); } - public static EGameMode GetGameMode(int Num) + public static EGameMode GetGameMode(int num) { - return _GameMode.GetGameMode(Num); + return _GameMode.GetGameMode(num); } public static int GetNumSongs() @@ -200,23 +200,23 @@ namespace Vocaluxe.Base _CurrentBeatD = -100; } - public static void UpdatePoints(float Time) + public static void UpdatePoints(float time) { - bool DEBUG_HIT = false; + bool debugHit = false; CSong song = _GameMode.GetSong(); if (song == null) return; - float b = GetBeatFromTime(Time, song.BPM, song.Gap); + float b = GetBeatFromTime(time, song.BPM, song.Gap); if (b <= _Beat) return; _Beat = b; _CurrentBeat = (int)Math.Floor(_Beat); - _MidBeatD = -0.5f + GetBeatFromTime(Time, song.BPM, song.Gap + CConfig.MicDelay / 1000f); + _MidBeatD = -0.5f + GetBeatFromTime(time, song.BPM, song.Gap + CConfig.MicDelay / 1000f); _CurrentBeatD = (int)Math.Floor(_MidBeatD); for (int p = 0; p < _NumPlayer; p++) @@ -234,115 +234,115 @@ namespace Vocaluxe.Base _Player[p].SongFinished = true; CLine[] lines = song.Notes.GetLines(_Player[p].LineNr).Line; - int Line = -1; + int line = -1; for (int j = 0; j < lines.Length; j++) { if (beat >= lines[j].StartBeat && beat <= lines[j].EndBeat) { - Line = j; + line = j; break; } } - if (Line >= 0) + if (line >= 0) { - if (Line != _Player[p].CurrentLine) + if (line != _Player[p].CurrentLine) _Player[p].CurrentNote = -1; - _Player[p].CurrentLine = Line; + _Player[p].CurrentLine = line; - while (_Player[p].SingLine.Count <= Line) + while (_Player[p].SingLine.Count <= line) _Player[p].SingLine.Add(new CLine()); - CNote[] notes = lines[Line].Notes; - int Note = -1; + 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; + note = j; break; } } - if (Note >= 0) + if (note >= 0) { - _Player[p].CurrentNote = Note; + _Player[p].CurrentNote = note; - if (Line == lines.Length - 1) + if (line == lines.Length - 1) { - if (Note == lines[Line].NoteCount - 1) + if (note == lines[line].NoteCount - 1) { - if (notes[Note].EndBeat == beat) + if (notes[note].EndBeat == beat) _Player[p].SongFinished = true; } } - if (notes[Note].PointsForBeat > 0 && (CSound.RecordToneValid(p) || DEBUG_HIT)) + if (notes[note].PointsForBeat > 0 && (CSound.RecordToneValid(p) || debugHit)) { - int Tone = notes[Note].Tone; - int TonePlayer = CSound.RecordGetTone(p); + int tone = notes[note].Tone; + int tonePlayer = CSound.RecordGetTone(p); - while (TonePlayer - Tone > 6) - TonePlayer -= 12; + while (tonePlayer - tone > 6) + tonePlayer -= 12; - while (TonePlayer - Tone < -6) - TonePlayer += 12; + while (tonePlayer - tone < -6) + tonePlayer += 12; - if (DEBUG_HIT) - TonePlayer = Tone; + if (debugHit) + tonePlayer = tone; - _Player[p].NoteDiff = Math.Abs(Tone - TonePlayer); - bool Hit = _Player[p].NoteDiff <= (2 - (int)_Player[p].Difficulty); - if (Hit) + _Player[p].NoteDiff = Math.Abs(tone - tonePlayer); + bool hit = _Player[p].NoteDiff <= (2 - (int)_Player[p].Difficulty); + if (hit) { // valid //CSound.RecordSetTone(p, Tone); - double points = (CSettings.MaxScore - CSettings.LinebonusScore) * (double)notes[Note].PointsForBeat / + double points = (CSettings.MaxScore - CSettings.LinebonusScore) * (double)notes[note].PointsForBeat / song.Notes.GetLines(_Player[p].LineNr).Points; - if (notes[Note].NoteType == ENoteType.Golden) + if (notes[note].NoteType == ENoteType.Golden) _Player[p].PointsGoldenNotes += points; _Player[p].Points += points; // update player notes (sung notes) - if (_Player[p].SingLine[Line].NoteCount > 0) + if (_Player[p].SingLine[line].NoteCount > 0) { - CNote nt = _Player[p].SingLine[Line].LastNote; - if (notes[Note].StartBeat == beat || nt.EndBeat + 1 != beat || nt.Tone != Tone || !nt.Hit) - _Player[p].SingLine[Line].AddNote(new CNote(beat, 1, Tone, String.Empty, true, notes[Note].NoteType)); + CNote nt = _Player[p].SingLine[line].LastNote; + if (notes[note].StartBeat == beat || nt.EndBeat + 1 != beat || nt.Tone != tone || !nt.Hit) + _Player[p].SingLine[line].AddNote(new CNote(beat, 1, tone, String.Empty, true, notes[note].NoteType)); else - _Player[p].SingLine[Line].IncLastNoteLength(); + _Player[p].SingLine[line].IncLastNoteLength(); } else - _Player[p].SingLine[Line].AddNote(new CNote(beat, 1, Tone, String.Empty, true, notes[Note].NoteType)); + _Player[p].SingLine[line].AddNote(new CNote(beat, 1, tone, String.Empty, true, notes[note].NoteType)); - _Player[p].SingLine[Line].LastNote.IsPerfect(notes[Note]); - _Player[p].SingLine[Line].IsPerfect(lines[Line]); + _Player[p].SingLine[line].LastNote.IsPerfect(notes[note]); + _Player[p].SingLine[line].IsPerfect(lines[line]); } else { - if (_Player[p].SingLine[Line].NoteCount > 0) + if (_Player[p].SingLine[line].NoteCount > 0) { - CNote nt = _Player[p].SingLine[Line].LastNote; - if (nt.Tone == TonePlayer && nt.EndBeat + 1 == beat && !nt.Hit) - _Player[p].SingLine[Line].IncLastNoteLength(); + CNote nt = _Player[p].SingLine[line].LastNote; + if (nt.Tone == tonePlayer && nt.EndBeat + 1 == beat && !nt.Hit) + _Player[p].SingLine[line].IncLastNoteLength(); else - _Player[p].SingLine[Line].AddNote(new CNote(beat, 1, TonePlayer, String.Empty, false, ENoteType.Freestyle)); + _Player[p].SingLine[line].AddNote(new CNote(beat, 1, tonePlayer, String.Empty, false, ENoteType.Freestyle)); } else - _Player[p].SingLine[Line].AddNote(new CNote(beat, 1, TonePlayer, String.Empty, false, ENoteType.Freestyle)); + _Player[p].SingLine[line].AddNote(new CNote(beat, 1, tonePlayer, String.Empty, false, ENoteType.Freestyle)); } } // Line Bonus - int NumLinesWithPoints = song.Notes.GetNumLinesWithPoints(_Player[p].LineNr); - if (Note == lines[Line].NoteCount - 1 && NumLinesWithPoints > 0) + int numLinesWithPoints = song.Notes.GetNumLinesWithPoints(_Player[p].LineNr); + if (note == lines[line].NoteCount - 1 && numLinesWithPoints > 0) { - if (notes[Note].EndBeat == beat && lines[Line].Points > 0f) + if (notes[note].EndBeat == beat && lines[line].Points > 0f) { - double factor = _Player[p].SingLine[Line].Points / (double)lines[Line].Points; + double factor = _Player[p].SingLine[line].Points / (double)lines[line].Points; if (factor < 0.4) factor = 0.0; else if (factor > 0.9) @@ -354,7 +354,7 @@ namespace Vocaluxe.Base factor *= factor; } - double points = CSettings.LinebonusScore * factor * 1f / NumLinesWithPoints; + double points = CSettings.LinebonusScore * factor * 1f / numLinesWithPoints; _Player[p].Points += points; _Player[p].PointsLineBonus += points; } diff --git a/Vocaluxe/Base/CGraphics.cs b/Vocaluxe/Base/CGraphics.cs index bfe8e245..860fbf15 100644 --- a/Vocaluxe/Base/CGraphics.cs +++ b/Vocaluxe/Base/CGraphics.cs @@ -34,14 +34,14 @@ namespace Vocaluxe.Base public int X { - get { return (int)_Cursor.rect.X; } - set { UpdatePosition(value, (int)_Cursor.rect.Y); } + get { return (int)_Cursor.Rect.X; } + set { UpdatePosition(value, (int)_Cursor.Rect.Y); } } public int Y { - get { return (int)_Cursor.rect.Y; } - set { UpdatePosition((int)_Cursor.rect.X, value); } + get { return (int)_Cursor.Rect.Y; } + set { UpdatePosition((int)_Cursor.Rect.X, value); } } public bool IsActive @@ -60,10 +60,10 @@ namespace Vocaluxe.Base _CursorName = textureName; _Cursor = CDraw.AddTexture(CTheme.GetSkinFilePath(_CursorName, -1)); - _Cursor.color = color; - _Cursor.rect.W = w; - _Cursor.rect.H = h; - _Cursor.rect.Z = z; + _Cursor.Color = color; + _Cursor.Rect.W = w; + _Cursor.Rect.H = h; + _Cursor.Rect.Z = z; _Movetimer = new Stopwatch(); } @@ -73,7 +73,7 @@ namespace Vocaluxe.Base if (_Movetimer.IsRunning && _Movetimer.ElapsedMilliseconds / 1000f > CSettings.MouseMoveOffTime) { _Movetimer.Stop(); - Fade(0f, 0.5f); + _Fade(0f, 0.5f); } @@ -83,14 +83,14 @@ namespace Vocaluxe.Base if (t < _CursorFadingTime) { if (_CursorTargetAlpha >= _CursorStartAlpha) - _Cursor.color.A = _CursorStartAlpha + (_CursorTargetAlpha - _CursorStartAlpha) * t / _CursorFadingTime; + _Cursor.Color.A = _CursorStartAlpha + (_CursorTargetAlpha - _CursorStartAlpha) * t / _CursorFadingTime; else - _Cursor.color.A = (_CursorStartAlpha - _CursorTargetAlpha) * (1f - t / _CursorFadingTime); + _Cursor.Color.A = (_CursorStartAlpha - _CursorTargetAlpha) * (1f - t / _CursorFadingTime); } else { _CursorFadingTimer.Stop(); - _Cursor.color.A = _CursorTargetAlpha; + _Cursor.Color.A = _CursorTargetAlpha; } } @@ -100,19 +100,19 @@ namespace Vocaluxe.Base public void UpdatePosition(int x, int y) { - if (Math.Abs(_Cursor.rect.X - x) > CSettings.MouseMoveDiffMin || - Math.Abs(_Cursor.rect.Y - y) > CSettings.MouseMoveDiffMin) + if (Math.Abs(_Cursor.Rect.X - x) > CSettings.MouseMoveDiffMin || + Math.Abs(_Cursor.Rect.Y - y) > CSettings.MouseMoveDiffMin) { if (_CursorTargetAlpha == 0f) - Fade(1f, 0.2f); + _Fade(1f, 0.2f); _Movetimer.Reset(); _Movetimer.Start(); CSettings.MouseActive(); } - _Cursor.rect.X = x; - _Cursor.rect.Y = y; + _Cursor.Rect.X = x; + _Cursor.Rect.Y = y; } public void UnloadTextures() @@ -130,17 +130,17 @@ namespace Vocaluxe.Base public void FadeOut() { _Movetimer.Stop(); - Fade(0f, 0.5f); + _Fade(0f, 0.5f); } public void FadeIn() { _Movetimer.Reset(); _Movetimer.Start(); - Fade(1f, 0.2f); + _Fade(1f, 0.2f); } - private void Fade(float targetAlpha, float time) + private void _Fade(float targetAlpha, float time) { _CursorFadingTimer.Stop(); _CursorFadingTimer.Reset(); @@ -153,7 +153,7 @@ namespace Vocaluxe.Base if (time >= 0f) _CursorFadingTime = time; - _CursorStartAlpha = _Cursor.color.A; + _CursorStartAlpha = _Cursor.Color.A; _CursorFadingTimer.Start(); } } @@ -175,7 +175,7 @@ namespace Vocaluxe.Base private static readonly List _PopupScreens = new List(); private static Stopwatch _VolumePopupTimer; - private static bool CursorOverVolumeControl; + private static bool _CursorOverVolumeControl; public static float GlobalAlpha { @@ -241,9 +241,9 @@ namespace Vocaluxe.Base { _Cursor = new CCursor( CTheme.Cursor.SkinName, - new SColorF(CTheme.Cursor.r, CTheme.Cursor.g, CTheme.Cursor.b, CTheme.Cursor.a), - CTheme.Cursor.w, - CTheme.Cursor.h, + new SColorF(CTheme.Cursor.R, CTheme.Cursor.G, CTheme.Cursor.B, CTheme.Cursor.A), + CTheme.Cursor.W, + CTheme.Cursor.H, CSettings.ZNear); for (int i = 0; i < _Screens.Count; i++) @@ -263,7 +263,7 @@ namespace Vocaluxe.Base public static void ReloadTheme() { - ReloadCursor(); + _ReloadCursor(); for (int i = 0; i < _Screens.Count; i++) _Screens[i].ReloadTheme(CTheme.GetThemeScreensPath(-1)); @@ -273,7 +273,7 @@ namespace Vocaluxe.Base public static void ReloadSkin() { - ReloadCursor(); + _ReloadCursor(); for (int i = 0; i < _Screens.Count; i++) _Screens[i].ReloadTextures(); @@ -297,13 +297,13 @@ namespace Vocaluxe.Base _Screens[(int)_CurrentScreen].OnShowFinish(); } - public static bool UpdateGameLogic(CKeys Keys, CMouse Mouse) + public static bool UpdateGameLogic(CKeys keys, CMouse mouse) { - bool _Run = true; - _Cursor.CursorVisible = Mouse.Visible; + bool run = true; + _Cursor.CursorVisible = mouse.Visible; - Mouse.CopyEvents(); - Keys.CopyEvents(); + mouse.CopyEvents(); + keys.CopyEvents(); CVideo.Update(); CSound.Update(); @@ -315,17 +315,17 @@ namespace Vocaluxe.Base if (CSettings.GameState != EGameState.EditTheme) { - _Run &= HandleInputs(Keys, Mouse); - _Run &= Update(); + run &= _HandleInputs(keys, mouse); + run &= _Update(); CParty.UpdateGame(); } else { - _Run &= HandleInputThemeEditor(Keys, Mouse); - _Run &= Update(); + run &= _HandleInputThemeEditor(keys, mouse); + run &= _Update(); } - return _Run; + return run; } public static bool Draw() @@ -350,15 +350,15 @@ namespace Vocaluxe.Base if (_Fading) { - long FadeTime = (long)(CConfig.FadeTime * 1000); + long fadeTime = (long)(CConfig.FadeTime * 1000); - if ((_FadingTimer.ElapsedMilliseconds < FadeTime) && (CConfig.FadeTime > 0)) + if ((_FadingTimer.ElapsedMilliseconds < fadeTime) && (CConfig.FadeTime > 0)) { long ms = 1; if (_FadingTimer.ElapsedMilliseconds > 0) ms = _FadingTimer.ElapsedMilliseconds; - float factor = (float)ms / FadeTime; + float factor = (float)ms / fadeTime; _GlobalAlpha = 1f; // -factor / 100f; _ZOffset = CSettings.ZFar / 2; @@ -429,14 +429,14 @@ namespace Vocaluxe.Base _PopupScreens[i].Draw(); _Cursor.Draw(); - DrawDebugInfos(); + _DrawDebugInfos(); return true; } - public static void FadeTo(EScreens Screen) + public static void FadeTo(EScreens screen) { - if (Screen == EScreens.ScreenPartyDummy) + if (screen == EScreens.ScreenPartyDummy) { EScreens alt; CMenu scr = CParty.GetNextPartyScreen(out alt); @@ -448,22 +448,22 @@ namespace Vocaluxe.Base _Screens[(int)EScreens.ScreenPartyDummy] = scr; } - _NextScreen = Screen; + _NextScreen = screen; } - public static void ShowPopup(EPopupScreens PopupScreen) + public static void ShowPopup(EPopupScreens popupScreen) { - _PopupScreens[(int)PopupScreen].OnShow(); - _PopupScreens[(int)PopupScreen].OnShowFinish(); - _CurrentPopupScreen = PopupScreen; + _PopupScreens[(int)popupScreen].OnShow(); + _PopupScreens[(int)popupScreen].OnShowFinish(); + _CurrentPopupScreen = popupScreen; } - public static void HidePopup(EPopupScreens PopupScreen) + public static void HidePopup(EPopupScreens popupScreen) { - if (_CurrentPopupScreen != PopupScreen) + if (_CurrentPopupScreen != popupScreen) return; - _PopupScreens[(int)PopupScreen].OnClose(); + _PopupScreens[(int)popupScreen].OnClose(); _CurrentPopupScreen = EPopupScreens.NoPopup; } @@ -479,41 +479,41 @@ namespace Vocaluxe.Base #endregion public methods #region private stuff - private static bool HandleInputs(CKeys keys, CMouse Mouse) + private static bool _HandleInputs(CKeys keys, CMouse mouse) { - KeyEvent KeyEvent = new KeyEvent(); - MouseEvent MouseEvent = new MouseEvent(); - KeyEvent InputKeyEvent = new KeyEvent(); - MouseEvent InputMouseEvent = new MouseEvent(); + SKeyEvent keyEvent = new SKeyEvent(); + SMouseEvent mouseEvent = new SMouseEvent(); + SKeyEvent inputKeyEvent = new SKeyEvent(); + SMouseEvent inputMouseEvent = new SMouseEvent(); - bool PopupPlayerControlAllowed = _CurrentScreen != EScreens.ScreenOptionsRecord && _CurrentScreen != EScreens.ScreenSing && + bool popupPlayerControlAllowed = _CurrentScreen != EScreens.ScreenOptionsRecord && _CurrentScreen != EScreens.ScreenSing && (_CurrentScreen != EScreens.ScreenSong || (_CurrentScreen == EScreens.ScreenSong && !CSongs.IsInCategory && CConfig.Tabs == EOffOn.TR_CONFIG_ON)) && _CurrentScreen != EScreens.ScreenCredits && !CBackgroundMusic.Disabled; - bool PopupVolumeControlAllowed = _CurrentScreen != EScreens.ScreenCredits && _CurrentScreen != EScreens.ScreenOptionsRecord; + 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 || (_CurrentScreen == EScreens.ScreenSong && CSongs.Category == -1)) && _CurrentScreen != EScreens.ScreenSing && CConfig.BackgroundMusic == EOffOn.TR_CONFIG_OFF) - PopupVolumeControlAllowed = false; + popupVolumeControlAllowed = false; - bool Resume = true; - bool EventsAvailable = false; - bool InputEventsAvailable = CInput.PollKeyEvent(ref InputKeyEvent); + bool resume = true; + bool eventsAvailable = false; + bool inputEventsAvailable = CInput.PollKeyEvent(ref inputKeyEvent); - while ((EventsAvailable = keys.PollEvent(ref KeyEvent)) || InputEventsAvailable) + while ((eventsAvailable = keys.PollEvent(ref keyEvent)) || inputEventsAvailable) { - if (!EventsAvailable) - KeyEvent = InputKeyEvent; + if (!eventsAvailable) + keyEvent = inputKeyEvent; - if (KeyEvent.Key == Keys.Left || KeyEvent.Key == Keys.Right || KeyEvent.Key == Keys.Up || KeyEvent.Key == Keys.Down) + if (keyEvent.Key == Keys.Left || keyEvent.Key == Keys.Right || keyEvent.Key == Keys.Up || keyEvent.Key == Keys.Down) { CSettings.MouseInactive(); _Cursor.FadeOut(); } - if (PopupPlayerControlAllowed && KeyEvent.Key == Keys.Tab) + if (popupPlayerControlAllowed && keyEvent.Key == Keys.Tab) { if (_CurrentPopupScreen == EPopupScreens.NoPopup && CConfig.BackgroundMusic == EOffOn.TR_CONFIG_ON) ShowPopup(EPopupScreens.PopupPlayerControl); @@ -521,13 +521,13 @@ namespace Vocaluxe.Base HidePopup(EPopupScreens.PopupPlayerControl); } - if (PopupPlayerControlAllowed && CConfig.BackgroundMusic == EOffOn.TR_CONFIG_ON) + if (popupPlayerControlAllowed && CConfig.BackgroundMusic == EOffOn.TR_CONFIG_ON) { - if (KeyEvent.Key == Keys.MediaNextTrack) + if (keyEvent.Key == Keys.MediaNextTrack) CMain.BackgroundMusic.Next(); - else if (KeyEvent.Key == Keys.MediaPreviousTrack) + else if (keyEvent.Key == Keys.MediaPreviousTrack) CMain.BackgroundMusic.Previous(); - else if (KeyEvent.Key == Keys.MediaPlayPause) + else if (keyEvent.Key == Keys.MediaPlayPause) { if (CMain.BackgroundMusic.IsPlaying()) CMain.BackgroundMusic.Pause(); @@ -536,46 +536,46 @@ namespace Vocaluxe.Base } } - if (PopupVolumeControlAllowed) + if (popupVolumeControlAllowed) { - int Diff = 0; - if ((KeyEvent.ModSHIFT && (KeyEvent.Key == Keys.Add || KeyEvent.Key == Keys.PageUp)) || (KeyEvent.Sender == ESender.WiiMote && KeyEvent.Key == Keys.Add)) - Diff = 5; - else if ((KeyEvent.ModSHIFT && (KeyEvent.Key == Keys.Subtract || KeyEvent.Key == Keys.PageDown)) || - (KeyEvent.Sender == ESender.WiiMote && KeyEvent.Key == Keys.Subtract)) - Diff = -5; + int diff = 0; + if ((keyEvent.ModShift && (keyEvent.Key == Keys.Add || keyEvent.Key == Keys.PageUp)) || (keyEvent.Sender == ESender.WiiMote && keyEvent.Key == Keys.Add)) + diff = 5; + else if ((keyEvent.ModShift && (keyEvent.Key == Keys.Subtract || keyEvent.Key == Keys.PageDown)) || + (keyEvent.Sender == ESender.WiiMote && keyEvent.Key == Keys.Subtract)) + diff = -5; - if (Diff != 0) + if (diff != 0) { switch (CurrentScreen) { case EScreens.ScreenSong: if (CSongs.IsInCategory) { - CConfig.PreviewMusicVolume += Diff; + CConfig.PreviewMusicVolume += diff; _Screens[(int)_CurrentScreen].ApplyVolume(); } else { - CConfig.BackgroundMusicVolume += Diff; + CConfig.BackgroundMusicVolume += diff; CBackgroundMusic.ApplyVolume(); } break; case EScreens.ScreenSing: - CConfig.GameMusicVolume += Diff; + CConfig.GameMusicVolume += diff; _Screens[(int)_CurrentScreen].ApplyVolume(); break; default: - CConfig.BackgroundMusicVolume += Diff; + CConfig.BackgroundMusicVolume += diff; CBackgroundMusic.ApplyVolume(); break; } CConfig.SaveConfig(); } - if (_CurrentPopupScreen == EPopupScreens.NoPopup && Diff != 0) + if (_CurrentPopupScreen == EPopupScreens.NoPopup && diff != 0) { ShowPopup(EPopupScreens.PopupVolumeControl); _VolumePopupTimer.Reset(); @@ -585,11 +585,11 @@ namespace Vocaluxe.Base CMain.BackgroundMusic.ApplyVolume(); } - if (KeyEvent.ModSHIFT && (KeyEvent.Key == Keys.F1)) + if (keyEvent.ModShift && (keyEvent.Key == Keys.F1)) CSettings.GameState = EGameState.EditTheme; - else if (KeyEvent.ModALT && (KeyEvent.Key == Keys.Enter)) + else if (keyEvent.ModAlt && (keyEvent.Key == Keys.Enter)) CSettings.IsFullScreen = !CSettings.IsFullScreen; - else if (KeyEvent.ModALT && (KeyEvent.Key == Keys.P)) + else if (keyEvent.ModAlt && (keyEvent.Key == Keys.P)) CDraw.MakeScreenShot(); else { @@ -597,34 +597,34 @@ namespace Vocaluxe.Base { bool handled = false; if (_CurrentPopupScreen != EPopupScreens.NoPopup) - handled = _PopupScreens[(int)_CurrentPopupScreen].HandleInput(KeyEvent); + handled = _PopupScreens[(int)_CurrentPopupScreen].HandleInput(keyEvent); if (!handled) - Resume &= _Screens[(int)_CurrentScreen].HandleInput(KeyEvent); + resume &= _Screens[(int)_CurrentScreen].HandleInput(keyEvent); } } - if (!EventsAvailable) - InputEventsAvailable = CInput.PollKeyEvent(ref InputKeyEvent); + if (!eventsAvailable) + inputEventsAvailable = CInput.PollKeyEvent(ref inputKeyEvent); } - InputEventsAvailable = CInput.PollMouseEvent(ref InputMouseEvent); + inputEventsAvailable = CInput.PollMouseEvent(ref inputMouseEvent); - while ((EventsAvailable = Mouse.PollEvent(ref MouseEvent)) || InputEventsAvailable) + while ((eventsAvailable = mouse.PollEvent(ref mouseEvent)) || inputEventsAvailable) { - if (!EventsAvailable) - MouseEvent = InputMouseEvent; + if (!eventsAvailable) + mouseEvent = inputMouseEvent; - if (MouseEvent.Wheel != 0) + if (mouseEvent.Wheel != 0) { CSettings.MouseActive(); _Cursor.FadeIn(); } - UpdateMousePosition(MouseEvent.X, MouseEvent.Y); + _UpdateMousePosition(mouseEvent.X, mouseEvent.Y); - bool isOverPopupPlayerControl = CHelper.IsInBounds(_PopupScreens[(int)EPopupScreens.PopupPlayerControl].ScreenArea, MouseEvent); - if (PopupPlayerControlAllowed && isOverPopupPlayerControl) + bool isOverPopupPlayerControl = CHelper.IsInBounds(_PopupScreens[(int)EPopupScreens.PopupPlayerControl].ScreenArea, mouseEvent); + if (popupPlayerControlAllowed && isOverPopupPlayerControl) { if (_CurrentPopupScreen == EPopupScreens.NoPopup && CConfig.BackgroundMusic == EOffOn.TR_CONFIG_ON) ShowPopup(EPopupScreens.PopupPlayerControl); @@ -633,8 +633,8 @@ namespace Vocaluxe.Base if (!isOverPopupPlayerControl && _CurrentPopupScreen == EPopupScreens.PopupPlayerControl) HidePopup(EPopupScreens.PopupPlayerControl); - bool isOverPopupVolumeControl = CHelper.IsInBounds(_PopupScreens[(int)EPopupScreens.PopupVolumeControl].ScreenArea, MouseEvent); - if (PopupVolumeControlAllowed && isOverPopupVolumeControl) + bool isOverPopupVolumeControl = CHelper.IsInBounds(_PopupScreens[(int)EPopupScreens.PopupVolumeControl].ScreenArea, mouseEvent); + if (popupVolumeControlAllowed && isOverPopupVolumeControl) { if (_CurrentPopupScreen == EPopupScreens.NoPopup) { @@ -644,7 +644,7 @@ namespace Vocaluxe.Base } } - if (CursorOverVolumeControl && !isOverPopupVolumeControl) + if (_CursorOverVolumeControl && !isOverPopupVolumeControl) { if (_CurrentPopupScreen == EPopupScreens.PopupVolumeControl) { @@ -652,64 +652,64 @@ namespace Vocaluxe.Base _VolumePopupTimer.Reset(); } } - CursorOverVolumeControl = isOverPopupVolumeControl; + _CursorOverVolumeControl = isOverPopupVolumeControl; bool handled = false; if (_CurrentPopupScreen != EPopupScreens.NoPopup) - handled = _PopupScreens[(int)_CurrentPopupScreen].HandleMouse(MouseEvent); + handled = _PopupScreens[(int)_CurrentPopupScreen].HandleMouse(mouseEvent); if (handled && _CurrentPopupScreen == EPopupScreens.PopupVolumeControl) _Screens[(int)_CurrentScreen].ApplyVolume(); - if (!handled && !_Fading && (_Cursor.IsActive || MouseEvent.LB || MouseEvent.RB || MouseEvent.MB)) - Resume &= _Screens[(int)_CurrentScreen].HandleMouse(MouseEvent); + if (!handled && !_Fading && (_Cursor.IsActive || mouseEvent.LB || mouseEvent.RB || mouseEvent.MB)) + resume &= _Screens[(int)_CurrentScreen].HandleMouse(mouseEvent); - if (!EventsAvailable) - InputEventsAvailable = CInput.PollMouseEvent(ref InputMouseEvent); + if (!eventsAvailable) + inputEventsAvailable = CInput.PollMouseEvent(ref inputMouseEvent); } - return Resume; + return resume; } - private static bool HandleInputThemeEditor(CKeys keys, CMouse Mouse) + private static bool _HandleInputThemeEditor(CKeys keys, CMouse mouse) { - KeyEvent KeyEvent = new KeyEvent(); - MouseEvent MouseEvent = new MouseEvent(); + SKeyEvent keyEvent = new SKeyEvent(); + SMouseEvent mouseEvent = new SMouseEvent(); - while (keys.PollEvent(ref KeyEvent)) + while (keys.PollEvent(ref keyEvent)) { - if (KeyEvent.ModSHIFT && (KeyEvent.Key == Keys.F1)) + if (keyEvent.ModShift && (keyEvent.Key == Keys.F1)) { CSettings.GameState = EGameState.Normal; _Screens[(int)_CurrentScreen].NextInteraction(); } - else if (KeyEvent.ModALT && (KeyEvent.Key == Keys.Enter)) + else if (keyEvent.ModAlt && (keyEvent.Key == Keys.Enter)) CSettings.IsFullScreen = !CSettings.IsFullScreen; - else if (KeyEvent.ModALT && (KeyEvent.Key == Keys.P)) + else if (keyEvent.ModAlt && (keyEvent.Key == Keys.P)) CDraw.MakeScreenShot(); else { if (!_Fading) - _Screens[(int)_CurrentScreen].HandleInputThemeEditor(KeyEvent); + _Screens[(int)_CurrentScreen].HandleInputThemeEditor(keyEvent); } } - while (Mouse.PollEvent(ref MouseEvent)) + while (mouse.PollEvent(ref mouseEvent)) { if (!_Fading) - _Screens[(int)_CurrentScreen].HandleMouseThemeEditor(MouseEvent); + _Screens[(int)_CurrentScreen].HandleMouseThemeEditor(mouseEvent); - UpdateMousePosition(MouseEvent.X, MouseEvent.Y); + _UpdateMousePosition(mouseEvent.X, mouseEvent.Y); } return true; } - private static void UpdateMousePosition(int x, int y) + private static void _UpdateMousePosition(int x, int y) { _Cursor.UpdatePosition(x, y); } - private static bool Update() + private static bool _Update() { if (_VolumePopupTimer.IsRunning && _VolumePopupTimer.ElapsedMilliseconds >= 1500 && _CurrentPopupScreen == EPopupScreens.PopupVolumeControl) { @@ -725,21 +725,21 @@ namespace Vocaluxe.Base return _Screens[(int)_CurrentScreen].UpdateGame(); } - private static void DrawDebugInfos() + private static void _DrawDebugInfos() { string txt = String.Empty; CFonts.Style = EStyle.Normal; CFonts.SetFont("Normal"); - SColorF Gray = new SColorF(1f, 1f, 1f, 0.5f); + SColorF gray = new SColorF(1f, 1f, 1f, 0.5f); float dy = 0; if (CConfig.DebugLevel >= EDebugLevel.TR_CONFIG_ONLY_FPS) { txt = CTime.GetFPS().ToString("FPS: 000"); CFonts.Height = 30f; - RectangleF rect = new RectangleF(CSettings.iRenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt)); + RectangleF rect = new RectangleF(CSettings.RenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt)); - CDraw.DrawColor(Gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear)); + CDraw.DrawColor(gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear)); CFonts.DrawText(txt, rect.X, rect.Y, CSettings.ZNear); dy += rect.Height; } @@ -748,9 +748,9 @@ namespace Vocaluxe.Base { txt = CSound.GetStreamCount().ToString(CLanguage.Translate("TR_DEBUG_AUDIO_STREAMS") + ": 00"); - RectangleF rect = new RectangleF(CSettings.iRenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt)); + RectangleF rect = new RectangleF(CSettings.RenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt)); - CDraw.DrawColor(Gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear)); + CDraw.DrawColor(gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear)); CFonts.DrawText(txt, rect.X, rect.Y, CSettings.ZNear); dy += rect.Height; } @@ -759,9 +759,9 @@ namespace Vocaluxe.Base { txt = CVideo.GetNumStreams().ToString(CLanguage.Translate("TR_DEBUG_VIDEO_STREAMS") + ": 00"); - RectangleF rect = new RectangleF(CSettings.iRenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt)); + RectangleF rect = new RectangleF(CSettings.RenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt)); - CDraw.DrawColor(Gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear)); + CDraw.DrawColor(gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear)); CFonts.DrawText(txt, rect.X, rect.Y, CSettings.ZNear); dy += rect.Height; } @@ -770,9 +770,9 @@ namespace Vocaluxe.Base { txt = CDraw.TextureCount().ToString(CLanguage.Translate("TR_DEBUG_TEXTURES") + ": 00000"); - RectangleF rect = new RectangleF(CSettings.iRenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt)); + RectangleF rect = new RectangleF(CSettings.RenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt)); - CDraw.DrawColor(Gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear)); + CDraw.DrawColor(gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear)); CFonts.DrawText(txt, rect.X, rect.Y, CSettings.ZNear); dy += rect.Height; } @@ -782,9 +782,9 @@ namespace Vocaluxe.Base long memory = GC.GetTotalMemory(false); txt = (memory / 1000000L).ToString(CLanguage.Translate("TR_DEBUG_MEMORY") + ": 00000 MB"); - RectangleF rect = new RectangleF(CSettings.iRenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt)); + RectangleF rect = new RectangleF(CSettings.RenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt)); - CDraw.DrawColor(Gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear)); + CDraw.DrawColor(gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear)); CFonts.DrawText(txt, rect.X, rect.Y, CSettings.ZNear); dy += rect.Height; } @@ -793,35 +793,35 @@ namespace Vocaluxe.Base { txt = CSound.RecordGetToneAbs(0).ToString(CLanguage.Translate("TR_DEBUG_TONE_ABS") + " P1: 00"); - RectangleF rect = new RectangleF(CSettings.iRenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt)); + RectangleF rect = new RectangleF(CSettings.RenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt)); - CDraw.DrawColor(Gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear)); + CDraw.DrawColor(gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear)); CFonts.DrawText(txt, rect.X, rect.Y, CSettings.ZNear); dy += rect.Height; txt = CSound.RecordGetMaxVolume(0).ToString(CLanguage.Translate("TR_DEBUG_MAX_VOLUME") + " P1: 0.000"); - rect = new RectangleF(CSettings.iRenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt)); + rect = new RectangleF(CSettings.RenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt)); - CDraw.DrawColor(Gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear)); + CDraw.DrawColor(gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear)); CFonts.DrawText(txt, rect.X, rect.Y, CSettings.ZNear); dy += rect.Height; txt = CSound.RecordGetToneAbs(1).ToString(CLanguage.Translate("TR_DEBUG_TONE_ABS") + " P2: 00"); - rect = new RectangleF(CSettings.iRenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt)); + rect = new RectangleF(CSettings.RenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt)); - CDraw.DrawColor(Gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear)); + CDraw.DrawColor(gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear)); CFonts.DrawText(txt, rect.X, rect.Y, CSettings.ZNear); dy += rect.Height; txt = CSound.RecordGetMaxVolume(1).ToString(CLanguage.Translate("TR_DEBUG_MAX_VOLUME") + " P2: 0.000"); - rect = new RectangleF(CSettings.iRenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt)); + rect = new RectangleF(CSettings.RenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt)); - CDraw.DrawColor(Gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear)); + CDraw.DrawColor(gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear)); CFonts.DrawText(txt, rect.X, rect.Y, CSettings.ZNear); dy += rect.Height; } @@ -830,9 +830,9 @@ namespace Vocaluxe.Base { txt = CSongs.NumSongsWithCoverLoaded.ToString(CLanguage.Translate("TR_DEBUG_SONGS") + ": 00000"); - RectangleF rect = new RectangleF(CSettings.iRenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt)); + RectangleF rect = new RectangleF(CSettings.RenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt)); - CDraw.DrawColor(Gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear)); + CDraw.DrawColor(gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear)); CFonts.DrawText(txt, rect.X, rect.Y, CSettings.ZNear); dy += rect.Height; } @@ -841,33 +841,33 @@ namespace Vocaluxe.Base { txt = _Cursor.X.ToString(CLanguage.Translate("TR_DEBUG_MOUSE") + " : (0000/") + _Cursor.Y.ToString("0000)"); - RectangleF rect = new RectangleF(CSettings.iRenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt)); + RectangleF rect = new RectangleF(CSettings.RenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt)); - CDraw.DrawColor(Gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear)); + CDraw.DrawColor(gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear)); CFonts.DrawText(txt, rect.X, rect.Y, CSettings.ZNear); dy += rect.Height; } } - private static void ReloadCursor() + private static void _ReloadCursor() { _Cursor.UnloadTextures(); - if (CTheme.Cursor.color.Length > 0) + if (CTheme.Cursor.Color.Length > 0) { SColorF color; - color = CTheme.GetColor(CTheme.Cursor.color, -1); - CTheme.Cursor.r = color.R; - CTheme.Cursor.g = color.G; - CTheme.Cursor.b = color.B; - CTheme.Cursor.a = color.A; + color = CTheme.GetColor(CTheme.Cursor.Color, -1); + CTheme.Cursor.R = color.R; + CTheme.Cursor.G = color.G; + CTheme.Cursor.B = color.B; + CTheme.Cursor.A = color.A; } _Cursor = new CCursor( CTheme.Cursor.SkinName, - new SColorF(CTheme.Cursor.r, CTheme.Cursor.g, CTheme.Cursor.b, CTheme.Cursor.a), - CTheme.Cursor.w, - CTheme.Cursor.h, + new SColorF(CTheme.Cursor.R, CTheme.Cursor.G, CTheme.Cursor.B, CTheme.Cursor.A), + CTheme.Cursor.W, + CTheme.Cursor.H, CSettings.ZNear); } #endregion private stuff diff --git a/Vocaluxe/Base/CInput.cs b/Vocaluxe/Base/CInput.cs index 380d9cee..8ba98ba9 100644 --- a/Vocaluxe/Base/CInput.cs +++ b/Vocaluxe/Base/CInput.cs @@ -41,19 +41,19 @@ namespace Vocaluxe.Base _Input.Update(); } - public static bool PollKeyEvent(ref KeyEvent KeyEvent) + public static bool PollKeyEvent(ref SKeyEvent keyEvent) { - return _Input.PollKeyEvent(ref KeyEvent); + return _Input.PollKeyEvent(ref keyEvent); } - public static bool PollMouseEvent(ref MouseEvent MouseEvent) + public static bool PollMouseEvent(ref SMouseEvent mouseEvent) { - return _Input.PollMouseEvent(ref MouseEvent); + return _Input.PollMouseEvent(ref mouseEvent); } - public static void SetRumble(float Duration) + public static void SetRumble(float duration) { - _Input.SetRumble(Duration); + _Input.SetRumble(duration); } } } \ No newline at end of file diff --git a/Vocaluxe/Base/CLanguage.cs b/Vocaluxe/Base/CLanguage.cs index b7800ab7..a4d30909 100644 --- a/Vocaluxe/Base/CLanguage.cs +++ b/Vocaluxe/Base/CLanguage.cs @@ -24,7 +24,7 @@ namespace Vocaluxe.Base static class CLanguage { - private static readonly XmlWriterSettings _settings = new XmlWriterSettings(); + private static readonly XmlWriterSettings _Settings = new XmlWriterSettings(); private static List _Languages; private static int _CurrentLanguage; private static int _FallbackLanguage; @@ -46,31 +46,31 @@ namespace Vocaluxe.Base public static string[] GetLanguageNames() { - string[] Languages = new string[_Languages.Count]; + string[] languages = new string[_Languages.Count]; for (int i = 0; i < _Languages.Count; i++) - Languages[i] = _Languages[i].Name; + languages[i] = _Languages[i].Name; - return Languages; + return languages; } public static void Init() { _Languages = new List(); - _settings.Indent = true; - _settings.Encoding = Encoding.UTF8; - _settings.ConformanceLevel = ConformanceLevel.Document; + _Settings.Indent = true; + _Settings.Encoding = Encoding.UTF8; + _Settings.ConformanceLevel = ConformanceLevel.Document; List files = new List(); - files.AddRange(CHelper.ListFiles(CSettings.sFolderLanguages, "*.xml", true, true)); + files.AddRange(CHelper.ListFiles(CSettings.FolderLanguages, "*.xml", true, true)); foreach (string file in files) - LoadLanguageFile(file); + _LoadLanguageFile(file); } - public static bool SetLanguage(string Language) + public static bool SetLanguage(string language) { - int nr = GetLanguageNr(Language); + int nr = GetLanguageNr(language); if (nr != -1) { _CurrentLanguage = nr; @@ -79,92 +79,92 @@ namespace Vocaluxe.Base return false; } - public static int GetLanguageNr(string Language) + public static int GetLanguageNr(string language) { for (int i = 0; i < _Languages.Count; i++) { - if (_Languages[i].Name == Language) + if (_Languages[i].Name == language) return i; } return -1; } - public static string Translate(string KeyWord) + public static string Translate(string keyWord) { - return Translate(KeyWord, -1); + return Translate(keyWord, -1); } - public static string Translate(string KeyWord, int PartyModeID) + public static string Translate(string keyWord, int partyModeID) { - if (KeyWord == null) + if (keyWord == null) return "Error"; - if (KeyWord.Length < 3 || KeyWord.Substring(0, 3) != "TR_") - return KeyWord; + if (keyWord.Length < 3 || keyWord.Substring(0, 3) != "TR_") + return keyWord; string result; - if (PartyModeID != -1) + if (partyModeID != -1) { - int PartyModeNr = GetPartyModeNr(PartyModeID, _CurrentLanguage); - if (PartyModeNr != -1 && _Languages[_CurrentLanguage].PartyModeTexts[PartyModeNr].Texts.TryGetValue(KeyWord, out result)) + int partyModeNr = _GetPartyModeNr(partyModeID, _CurrentLanguage); + if (partyModeNr != -1 && _Languages[_CurrentLanguage].PartyModeTexts[partyModeNr].Texts.TryGetValue(keyWord, out result)) return result; - PartyModeNr = GetPartyModeNr(PartyModeID, _FallbackLanguage); - if (PartyModeNr != -1 && _Languages[_CurrentLanguage].PartyModeTexts[PartyModeNr].Texts.TryGetValue(KeyWord, out result)) + partyModeNr = _GetPartyModeNr(partyModeID, _FallbackLanguage); + if (partyModeNr != -1 && _Languages[_CurrentLanguage].PartyModeTexts[partyModeNr].Texts.TryGetValue(keyWord, out result)) return result; } - if (_Languages[_CurrentLanguage].Texts.TryGetValue(KeyWord, out result)) + if (_Languages[_CurrentLanguage].Texts.TryGetValue(keyWord, out result)) return result; - if (_Languages[_FallbackLanguage].Texts.TryGetValue(KeyWord, out result)) + if (_Languages[_FallbackLanguage].Texts.TryGetValue(keyWord, out result)) return result; - return KeyWord; + return keyWord; } - public static bool TranslationExists(string KeyWord, int PartyModeID = -1) + public static bool TranslationExists(string keyWord, int partyModeID = -1) { - if (KeyWord == null) + if (keyWord == null) return false; - if (KeyWord.Length < 3 || KeyWord.Substring(0, 3) != "TR_") + if (keyWord.Length < 3 || keyWord.Substring(0, 3) != "TR_") return false; - if (PartyModeID != -1) + if (partyModeID != -1) { - int PartyModeNr = GetPartyModeNr(PartyModeID, _CurrentLanguage); - if (PartyModeNr != -1 && _Languages[_CurrentLanguage].PartyModeTexts[PartyModeNr].Texts.ContainsKey(KeyWord)) + int partyModeNr = _GetPartyModeNr(partyModeID, _CurrentLanguage); + if (partyModeNr != -1 && _Languages[_CurrentLanguage].PartyModeTexts[partyModeNr].Texts.ContainsKey(keyWord)) return true; - PartyModeNr = GetPartyModeNr(PartyModeID, _FallbackLanguage); - if (PartyModeNr != -1 && _Languages[_CurrentLanguage].PartyModeTexts[PartyModeNr].Texts.ContainsKey(KeyWord)) + partyModeNr = _GetPartyModeNr(partyModeID, _FallbackLanguage); + if (partyModeNr != -1 && _Languages[_CurrentLanguage].PartyModeTexts[partyModeNr].Texts.ContainsKey(keyWord)) return true; } - if (_Languages[_CurrentLanguage].Texts.ContainsKey(KeyWord)) + if (_Languages[_CurrentLanguage].Texts.ContainsKey(keyWord)) return true; - if (_Languages[_FallbackLanguage].Texts.ContainsKey(KeyWord)) + if (_Languages[_FallbackLanguage].Texts.ContainsKey(keyWord)) return true; return false; } - public static bool LoadPartyLanguageFiles(int PartyModeID, string Path) + public static bool LoadPartyLanguageFiles(int partyModeID, string path) { List files = new List(); - files.AddRange(CHelper.ListFiles(Path, "*.xml", true, true)); + files.AddRange(CHelper.ListFiles(path, "*.xml", true, true)); foreach (string file in files) { - if (!LoadPartyLanguageFile(PartyModeID, file)) + if (!_LoadPartyLanguageFile(partyModeID, file)) return false; } return true; } - private static bool _LoadLanguageEntries(CXMLReader xmlReader, ref Dictionary Texts) + private static bool _LoadLanguageEntries(CXMLReader xmlReader, ref Dictionary texts) { - Texts = new Dictionary(); + texts = new Dictionary(); List names = xmlReader.GetAttributes("resources", "name"); string value = string.Empty; foreach (string name in names) @@ -173,7 +173,7 @@ namespace Vocaluxe.Base { try { - Texts.Add(name, value); + texts.Add(name, value); } catch (Exception e) { @@ -185,7 +185,7 @@ namespace Vocaluxe.Base return true; } - private static bool LoadPartyLanguageFile(int PartyModeID, string file) + private static bool _LoadPartyLanguageFile(int partyModeID, string file) { CXMLReader xmlReader = CXMLReader.OpenFile(file); if (xmlReader == null) @@ -200,7 +200,7 @@ namespace Vocaluxe.Base return true; SPartyLanguage lang = new SPartyLanguage(); - lang.PartyModeID = PartyModeID; + lang.PartyModeID = partyModeID; if (!_LoadLanguageEntries(xmlReader, ref lang.Texts)) return false; @@ -214,10 +214,10 @@ namespace Vocaluxe.Base } } - private static void LoadLanguageFile(string FileName) + private static void _LoadLanguageFile(string fileName) { SLanguage lang = new SLanguage(); - lang.LanguageFilePath = Path.Combine(CSettings.sFolderLanguages, FileName); + lang.LanguageFilePath = Path.Combine(CSettings.FolderLanguages, fileName); CXMLReader xmlReader = CXMLReader.OpenFile(lang.LanguageFilePath); if (xmlReader == null) @@ -239,11 +239,11 @@ namespace Vocaluxe.Base } } - private static int GetPartyModeNr(int PartyModeID, int Language) + private static int _GetPartyModeNr(int partyModeID, int language) { - for (int i = 0; i < _Languages[Language].PartyModeTexts.Count; i++) + for (int i = 0; i < _Languages[language].PartyModeTexts.Count; i++) { - if (_Languages[Language].PartyModeTexts[i].PartyModeID == PartyModeID) + if (_Languages[language].PartyModeTexts[i].PartyModeID == partyModeID) return i; } return -1; diff --git a/Vocaluxe/Base/CLog.cs b/Vocaluxe/Base/CLog.cs index f107c260..610ebacf 100644 --- a/Vocaluxe/Base/CLog.cs +++ b/Vocaluxe/Base/CLog.cs @@ -5,16 +5,16 @@ using System.Text; namespace Vocaluxe.Base { - class LogFile : IDisposable + class CLogFile : IDisposable { private readonly string _LogFileName; private readonly string _LogName; private StreamWriter _LogFile; - public LogFile(string FileName, string LogName) + public CLogFile(string fileName, string logName) { - _LogName = LogName; - _LogFileName = FileName; + _LogName = logName; + _LogFileName = fileName; } public void Close() @@ -30,20 +30,20 @@ namespace Vocaluxe.Base } } - public void Add(string Text) + public void Add(string text) { if (_LogFile == null) - Open(); + _Open(); try { - _LogFile.WriteLine(Text); + _LogFile.WriteLine(text); _LogFile.Flush(); } catch (Exception) {} } - private void Open() + private void _Open() { _LogFile = new StreamWriter(Path.Combine(Environment.CurrentDirectory, _LogFileName), false, Encoding.UTF8); @@ -65,24 +65,24 @@ namespace Vocaluxe.Base static class CLog { - private const int MaxBenchmarks = 10; + private const int _MaxBenchmarks = 10; - private static LogFile _ErrorLog; - private static LogFile _PerformanceLog; - private static LogFile _BenchmarkLog; + private static CLogFile _ErrorLog; + private static CLogFile _PerformanceLog; + private static CLogFile _BenchmarkLog; private static int _NumErrors; private static Stopwatch[] _BenchmarkTimer; - private static readonly double nanosecPerTick = (1000.0 * 1000.0 * 1000.0) / Stopwatch.Frequency; + private static readonly double _NanosecPerTick = (1000.0 * 1000.0 * 1000.0) / Stopwatch.Frequency; public static void Init() { - _ErrorLog = new LogFile(CSettings.sFileErrorLog, "ErrorLog"); - _PerformanceLog = new LogFile(CSettings.sFilePerformanceLog, "PerformanceLog"); - _BenchmarkLog = new LogFile(CSettings.sFileBenchmarkLog, "BenchmarkLog"); + _ErrorLog = new CLogFile(CSettings.FileErrorLog, "ErrorLog"); + _PerformanceLog = new CLogFile(CSettings.FilePerformanceLog, "PerformanceLog"); + _BenchmarkLog = new CLogFile(CSettings.FileBenchmarkLog, "BenchmarkLog"); _NumErrors = 0; - _BenchmarkTimer = new Stopwatch[MaxBenchmarks]; + _BenchmarkTimer = new Stopwatch[_MaxBenchmarks]; for (int i = 0; i < _BenchmarkTimer.Length; i++) _BenchmarkTimer[i] = new Stopwatch(); } @@ -95,57 +95,57 @@ namespace Vocaluxe.Base } #region LogError - public static void LogError(string ErrorText) + public static void LogError(string errorText) { _NumErrors++; - _ErrorLog.Add(_NumErrors.ToString() + ") " + ErrorText); + _ErrorLog.Add(_NumErrors.ToString() + ") " + errorText); _ErrorLog.Add(String.Empty); } #endregion LogError #region LogPerformance - public static void LogPerformance(string Text) + public static void LogPerformance(string text) { - _PerformanceLog.Add(Text); + _PerformanceLog.Add(text); _PerformanceLog.Add("-------------------------------"); } #endregion LogPerformance #region LogBenchmark - public static void StartBenchmark(int BenchmarkNr, string Text) + public static void StartBenchmark(int benchmarkNr, string text) { - if (BenchmarkNr >= 0 && BenchmarkNr < MaxBenchmarks) + if (benchmarkNr >= 0 && benchmarkNr < _MaxBenchmarks) { - _BenchmarkTimer[BenchmarkNr].Stop(); - _BenchmarkTimer[BenchmarkNr].Reset(); + _BenchmarkTimer[benchmarkNr].Stop(); + _BenchmarkTimer[benchmarkNr].Reset(); string space = String.Empty; - for (int i = 0; i < BenchmarkNr; i++) + for (int i = 0; i < benchmarkNr; i++) space += " "; - _BenchmarkLog.Add(space + "Start " + Text); + _BenchmarkLog.Add(space + "Start " + text); - _BenchmarkTimer[BenchmarkNr].Start(); + _BenchmarkTimer[benchmarkNr].Start(); } } - public static void StopBenchmark(int BenchmarkNr, string Text) + public static void StopBenchmark(int benchmarkNr, string text) { - if (BenchmarkNr >= 0 && BenchmarkNr < MaxBenchmarks) + if (benchmarkNr >= 0 && benchmarkNr < _MaxBenchmarks) { - _BenchmarkTimer[BenchmarkNr].Stop(); + _BenchmarkTimer[benchmarkNr].Stop(); string space = String.Empty; - for (int i = 0; i < BenchmarkNr; i++) + for (int i = 0; i < benchmarkNr; i++) space += " "; float ms; - if (Stopwatch.IsHighResolution && nanosecPerTick != 0.0) - ms = (float)((nanosecPerTick * _BenchmarkTimer[BenchmarkNr].ElapsedTicks) / (1000.0 * 1000.0)); + if (Stopwatch.IsHighResolution && _NanosecPerTick != 0.0) + ms = (float)((_NanosecPerTick * _BenchmarkTimer[benchmarkNr].ElapsedTicks) / (1000.0 * 1000.0)); else - ms = _BenchmarkTimer[BenchmarkNr].ElapsedMilliseconds; + ms = _BenchmarkTimer[benchmarkNr].ElapsedMilliseconds; - _BenchmarkLog.Add(space + "Stop " + Text + ", Elapsed Time: " + ms.ToString("0.000") + "ms"); + _BenchmarkLog.Add(space + "Stop " + text + ", Elapsed Time: " + ms.ToString("0.000") + "ms"); _BenchmarkLog.Add(String.Empty); } } diff --git a/Vocaluxe/Base/CMain.cs b/Vocaluxe/Base/CMain.cs index ed6ac6ff..1f0bc168 100644 --- a/Vocaluxe/Base/CMain.cs +++ b/Vocaluxe/Base/CMain.cs @@ -8,26 +8,26 @@ namespace Vocaluxe.Base { static class CMain { - public static IConfig Config = new BConfig(); - public static ISettings Settings = new BSettings(); - public static ITheme Theme = new BTheme(); - public static IHelper Helper = new BHelper(); - public static IBackgroundMusic BackgroundMusic = new BBackgroundMusic(); - public static IDrawing Draw = new BDraw(); - public static IGraphics Graphics = new BGraphics(); - public static ILog Log = new BLog(); - public static IFonts Fonts = new BFonts(); - public static ILanguage Language = new BLanguage(); - public static IGame Game = new BGame(); - public static IProfiles Profiles = new BProfiles(); - public static IRecording Record = new BRecord(); - public static ISongs Songs = new BSongs(); - public static IVideo Video = new BVideo(); - public static ISound Sound = new BSound(); - public static ICover Cover = new BCover(); - public static IDataBase DataBase = new BDataBase(); - public static IInputs Input = new BInputs(); - public static IPlaylist Playlist = new BPlaylist(); + public static IConfig Config = new CBconfig(); + public static ISettings Settings = new CBsettings(); + public static ITheme Theme = new CBtheme(); + public static IHelper Helper = new CBhelper(); + public static IBackgroundMusic BackgroundMusic = new CBbackgroundMusic(); + public static IDrawing Draw = new CBdraw(); + public static IGraphics Graphics = new CBGraphics(); + public static ILog Log = new CBlog(); + public static IFonts Fonts = new CBfonts(); + public static ILanguage Language = new CBlanguage(); + public static IGame Game = new CBGame(); + public static IProfiles Profiles = new CBprofiles(); + public static IRecording Record = new CBrecord(); + public static ISongs Songs = new CBsongs(); + public static IVideo Video = new CBvideo(); + public static ISound Sound = new CBsound(); + public static ICover Cover = new CBcover(); + public static IDataBase DataBase = new CBdataBase(); + public static IInputs Input = new CBinputs(); + public static IPlaylist Playlist = new CBplaylist(); public static void Init() { @@ -36,16 +36,16 @@ namespace Vocaluxe.Base } } - class BConfig : IConfig + class CBconfig : IConfig { - public void SetBackgroundMusicVolume(int NewVolume) + public void SetBackgroundMusicVolume(int newVolume) { - if (NewVolume < 0) + if (newVolume < 0) CConfig.BackgroundMusicVolume = 0; - else if (NewVolume > 100) + else if (newVolume > 100) CConfig.BackgroundMusicVolume = 100; else - CConfig.BackgroundMusicVolume = NewVolume; + CConfig.BackgroundMusicVolume = newVolume; CConfig.SaveConfig(); } @@ -115,9 +115,9 @@ namespace Vocaluxe.Base return CConfig.IgnoreArticles; } - public bool IsMicConfigured(int PlayerNr) + public bool IsMicConfigured(int playerNr) { - return CConfig.IsMicConfig(PlayerNr); + return CConfig.IsMicConfig(playerNr); } public int GetMaxNumMics() @@ -134,16 +134,16 @@ namespace Vocaluxe.Base } } - class BSettings : ISettings + class CBsettings : ISettings { public int GetRenderW() { - return CSettings.iRenderW; + return CSettings.RenderW; } public int GetRenderH() { - return CSettings.iRenderH; + return CSettings.RenderH; } public bool IsTabNavigation() @@ -207,51 +207,51 @@ namespace Vocaluxe.Base } } - class BTheme : ITheme + class CBtheme : ITheme { - public string GetThemeScreensPath(int PartyModeID) + public string GetThemeScreensPath(int partyModeID) { - return CTheme.GetThemeScreensPath(PartyModeID); + return CTheme.GetThemeScreensPath(partyModeID); } - public int GetSkinIndex(int PartyModeID) + public int GetSkinIndex(int partyModeID) { - return CTheme.GetSkinIndex(PartyModeID); + return CTheme.GetSkinIndex(partyModeID); } - public STexture GetSkinTexture(string TextureName, int PartyModeID) + public STexture GetSkinTexture(string textureName, int partyModeID) { - return CTheme.GetSkinTexture(TextureName, PartyModeID); + return CTheme.GetSkinTexture(textureName, partyModeID); } - public STexture GetSkinVideoTexture(string VideoName, int PartyModeID) + public STexture GetSkinVideoTexture(string videoName, int partyModeID) { - return CTheme.GetSkinVideoTexture(VideoName, PartyModeID); + return CTheme.GetSkinVideoTexture(videoName, partyModeID); } - public void SkinVideoResume(string VideoName, int PartyModeID) + public void SkinVideoResume(string videoName, int partyModeID) { - CTheme.SkinVideoResume(VideoName, PartyModeID); + CTheme.SkinVideoResume(videoName, partyModeID); } - public void SkinVideoPause(string VideoName, int PartyModeID) + public void SkinVideoPause(string videoName, int partyModeID) { - CTheme.SkinVideoPause(VideoName, PartyModeID); + CTheme.SkinVideoPause(videoName, partyModeID); } - public SColorF GetColor(string ColorName, int PartyModeID) + public SColorF GetColor(string colorName, int partyModeID) { - return CTheme.GetColor(ColorName, PartyModeID); + return CTheme.GetColor(colorName, partyModeID); } - public bool GetColor(string ColorName, int SkinIndex, out SColorF Color) + public bool GetColor(string colorName, int skinIndex, out SColorF color) { - return CTheme.GetColor(ColorName, SkinIndex, out Color); + return CTheme.GetColor(colorName, skinIndex, out color); } - public SColorF GetPlayerColor(int PlayerNr) + public SColorF GetPlayerColor(int playerNr) { - return CTheme.GetPlayerColor(PlayerNr); + return CTheme.GetPlayerColor(playerNr); } public void UnloadSkins() @@ -275,9 +275,9 @@ namespace Vocaluxe.Base } } - class BHelper : IHelper {} + class CBhelper : IHelper {} - class BBackgroundMusic : IBackgroundMusic + class CBbackgroundMusic : IBackgroundMusic { public bool IsDisabled() { @@ -299,9 +299,9 @@ namespace Vocaluxe.Base return CBackgroundMusic.VideoEnabled; } - public void SetStatus(bool Disabled) + public void SetStatus(bool disabled) { - CBackgroundMusic.Disabled = Disabled; + CBackgroundMusic.Disabled = disabled; } public void Next() @@ -335,55 +335,55 @@ namespace Vocaluxe.Base } } - class BDraw : IDrawing + class CBdraw : IDrawing { public RectangleF GetTextBounds(CText text) { return CDraw.GetTextBounds(text); } - public void DrawTexture(STexture Texture, SRectF Rect) + public void DrawTexture(STexture texture, SRectF rect) { - CDraw.DrawTexture(Texture, Rect); + CDraw.DrawTexture(texture, rect); } - public void DrawTexture(STexture Texture, SRectF Rect, SColorF Color) + public void DrawTexture(STexture texture, SRectF rect, SColorF color) { - CDraw.DrawTexture(Texture, Rect, Color); + CDraw.DrawTexture(texture, rect, color); } - public void DrawTexture(STexture Texture, SRectF Rect, SColorF Color, SRectF Bounds) + public void DrawTexture(STexture texture, SRectF rect, SColorF color, SRectF bounds) { - CDraw.DrawTexture(Texture, Rect, Color, Bounds); + CDraw.DrawTexture(texture, rect, color, bounds); } - public void DrawTexture(STexture Texture, SRectF Rect, SColorF Color, SRectF Bounds, bool Mirrored) + public void DrawTexture(STexture texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored) { - CDraw.DrawTexture(Texture, Rect, Color, Bounds, Mirrored); + CDraw.DrawTexture(texture, rect, color, bounds, mirrored); } - public void DrawTextureReflection(STexture Texture, SRectF Rect, SColorF Color, SRectF Bounds, float ReflectionSpace, float ReflectionHeight) + public void DrawTextureReflection(STexture texture, SRectF rect, SColorF color, SRectF bounds, float reflectionSpace, float reflectionHeight) { - CDraw.DrawTextureReflection(Texture, Rect, Color, Bounds, ReflectionSpace, ReflectionHeight); + CDraw.DrawTextureReflection(texture, rect, color, bounds, reflectionSpace, reflectionHeight); } - public void RemoveTexture(ref STexture Texture) + public void RemoveTexture(ref STexture texture) { - CDraw.RemoveTexture(ref Texture); + CDraw.RemoveTexture(ref texture); } - public void DrawColor(SColorF Color, SRectF Rect) + public void DrawColor(SColorF color, SRectF rect) { - CDraw.DrawColor(Color, Rect); + CDraw.DrawColor(color, rect); } - public void DrawColorReflection(SColorF Color, SRectF Rect, float Space, float Height) + public void DrawColorReflection(SColorF color, SRectF rect, float space, float height) { - CDraw.DrawColorReflection(Color, Rect, Space, Height); + CDraw.DrawColorReflection(color, rect, space, height); } } - class BGraphics : IGraphics + class CBGraphics : IGraphics { public void ReloadTheme() { @@ -395,9 +395,9 @@ namespace Vocaluxe.Base CGraphics.SaveTheme(); } - public void FadeTo(EScreens NextScreen) + public void FadeTo(EScreens nextScreen) { - CGraphics.FadeTo(NextScreen); + CGraphics.FadeTo(nextScreen); } public float GetGlobalAlpha() @@ -406,75 +406,75 @@ namespace Vocaluxe.Base } } - class BLog : ILog + class CBlog : ILog { - public void LogError(string ErrorText) + public void LogError(string errorText) { - CLog.LogError(ErrorText); + CLog.LogError(errorText); } } - class BFonts : IFonts + class CBfonts : IFonts { - public void SetFont(string FontName) + public void SetFont(string fontName) { - CFonts.SetFont(FontName); + CFonts.SetFont(fontName); } - public void SetStyle(EStyle FontStyle) + public void SetStyle(EStyle fontStyle) { - CFonts.Style = FontStyle; + CFonts.Style = fontStyle; } - public RectangleF GetTextBounds(CText Text, float TextHeight) + public RectangleF GetTextBounds(CText text, float textHeight) { - return CFonts.GetTextBounds(Text, TextHeight); + return CFonts.GetTextBounds(text, textHeight); } - public void DrawText(string Text, float TextHeight, float x, float y, float z, SColorF Color) + public void DrawText(string text, float textHeight, float x, float y, float z, SColorF color) { - CFonts.DrawText(Text, TextHeight, x, y, z, Color); + CFonts.DrawText(text, textHeight, x, y, z, color); } - public void DrawTextReflection(string Text, float TextHeight, float x, float y, float z, SColorF Color, float ReflectionSpace, float ReflectionHeight) + public void DrawTextReflection(string text, float textHeight, float x, float y, float z, SColorF color, float reflectionSpace, float reflectionHeight) { - CFonts.DrawTextReflection(Text, TextHeight, x, y, z, Color, ReflectionSpace, ReflectionHeight); + CFonts.DrawTextReflection(text, textHeight, x, y, z, color, reflectionSpace, reflectionHeight); } - public void DrawText(string Text, float TextHeight, float x, float y, float z, SColorF Color, float Begin, float End) + public void DrawText(string text, float textHeight, float x, float y, float z, SColorF color, float begin, float end) { - CFonts.DrawText(Text, TextHeight, x, y, z, Color, Begin, End); + CFonts.DrawText(text, textHeight, x, y, z, color, begin, end); } } - class BLanguage : ILanguage + class CBlanguage : ILanguage { - public string Translate(string KeyWord) + public string Translate(string keyWord) { - return CLanguage.Translate(KeyWord); + return CLanguage.Translate(keyWord); } - public string Translate(string KeyWord, int PartyModeID) + public string Translate(string keyWord, int partyModeID) { - return CLanguage.Translate(KeyWord, PartyModeID); + return CLanguage.Translate(keyWord, partyModeID); } - public bool TranslationExists(string KeyWord) + public bool TranslationExists(string keyWord) { - return CLanguage.TranslationExists(KeyWord); + return CLanguage.TranslationExists(keyWord); } } - class BGame : IGame + class CBGame : IGame { public int GetNumPlayer() { return CGame.NumPlayer; } - public void SetNumPlayer(int NumPlayer) + public void SetNumPlayer(int numPlayer) { - CGame.NumPlayer = NumPlayer; + CGame.NumPlayer = numPlayer; } public SPlayer[] GetPlayer() @@ -497,9 +497,9 @@ namespace Vocaluxe.Base return CGame.ActBeatD; } - public int GetRandom(int Max) + public int GetRandom(int max) { - return CGame.Rand.Next(Max); + return CGame.Rand.Next(max); } public double GetRandomDouble() @@ -507,14 +507,14 @@ namespace Vocaluxe.Base return CGame.Rand.NextDouble(); } - public float GetTimeFromBeats(float Beat, float BPM) + public float GetTimeFromBeats(float beat, float bpm) { - return CGame.GetTimeFromBeats(Beat, BPM); + return CGame.GetTimeFromBeats(beat, bpm); } - public void AddSong(int SongID, EGameMode GameMode) + public void AddSong(int songID, EGameMode gameMode) { - CGame.AddSong(SongID, GameMode); + CGame.AddSong(songID, gameMode); } public void Reset() @@ -533,7 +533,7 @@ namespace Vocaluxe.Base } } - class BProfiles : IProfiles + class CBprofiles : IProfiles { public SProfile[] GetProfiles() { @@ -541,15 +541,15 @@ namespace Vocaluxe.Base } } - class BRecord : IRecording + class CBrecord : IRecording { - public int GetToneAbs(int PlayerNr) + public int GetToneAbs(int playerNr) { - return CSound.RecordGetToneAbs(PlayerNr); + return CSound.RecordGetToneAbs(playerNr); } } - class BSongs : ISongs + class CBsongs : ISongs { public int GetNumSongs() { @@ -566,9 +566,9 @@ namespace Vocaluxe.Base return CSongs.NumCategories; } - public int NumSongsInCategory(int CategoryIndex) + public int NumSongsInCategory(int categoryIndex) { - return CSongs.NumSongsInCategory(CategoryIndex); + return CSongs.NumSongsInCategory(categoryIndex); } public int GetCurrentCategoryIndex() @@ -586,9 +586,9 @@ namespace Vocaluxe.Base return CSongs.Filter.SearchString; } - public void SetCategory(int CategoryIndex) + public void SetCategory(int categoryIndex) { - CSongs.Category = CategoryIndex; + CSongs.Category = categoryIndex; } public void UpdateRandomSongList() @@ -596,14 +596,14 @@ namespace Vocaluxe.Base CSongs.UpdateRandomSongList(); } - public CSong GetVisibleSong(int VisibleIndex) + public CSong GetVisibleSong(int visibleIndex) { - return CSongs.GetVisibleSongByIndex(VisibleIndex); + return CSongs.GetVisibleSongByIndex(visibleIndex); } - public CSong GetSongByID(int SongID) + public CSong GetSongByID(int songID) { - return CSongs.GetSong(SongID); + return CSongs.GetSong(songID); } public CSong[] GetSongs() @@ -616,17 +616,17 @@ namespace Vocaluxe.Base return CSongs.SongsNotSung; } - public CCategory GetCategory(int Index) + public CCategory GetCategory(int index) { - if (Index >= CSongs.NumCategories) + if (index >= CSongs.NumCategories) return null; - return new CCategory(CSongs.Categories[Index]); + return new CCategory(CSongs.Categories[index]); } - public void AddPartySongSung(int SongID) + public void AddPartySongSung(int songID) { - CSongs.AddPartySongSung(SongID); + CSongs.AddPartySongSung(songID); } public void ResetPartySongSung() @@ -634,14 +634,14 @@ namespace Vocaluxe.Base CSongs.ResetPartySongSung(); } - public void ResetPartySongSung(int CatIndex) + public void ResetPartySongSung(int catIndex) { - CSongs.ResetPartySongSung(CatIndex); + CSongs.ResetPartySongSung(catIndex); } - public void SortSongs(ESongSorting Sorting, EOffOn Tabs, EOffOn IgnoreArticles, String SearchString, EDuetOptions DuetOptions) + public void SortSongs(ESongSorting sorting, EOffOn tabs, EOffOn ignoreArticles, String searchString, EDuetOptions duetOptions) { - CSongs.Sort(Sorting, Tabs, IgnoreArticles, SearchString, DuetOptions); + CSongs.Sort(sorting, tabs, ignoreArticles, searchString, duetOptions); } public void NextCategory() @@ -655,88 +655,88 @@ namespace Vocaluxe.Base } } - class BVideo : IVideo + class CBvideo : IVideo { - public int Load(string VideoFileName) + public int Load(string videoFileName) { - return CVideo.VdLoad(VideoFileName); + return CVideo.VdLoad(videoFileName); } - public bool Skip(int VideoStream, float StartPosition, float VideoGap) + public bool Skip(int videoStream, float startPosition, float videoGap) { - return CVideo.VdSkip(VideoStream, StartPosition, VideoGap); + return CVideo.VdSkip(videoStream, startPosition, videoGap); } - public bool GetFrame(int VideoStream, ref STexture VideoTexture, float Time, ref float VideoTime) + public bool GetFrame(int videoStream, ref STexture videoTexture, float time, ref float videoTime) { - return CVideo.VdGetFrame(VideoStream, ref VideoTexture, Time, ref VideoTime); + return CVideo.VdGetFrame(videoStream, ref videoTexture, time, ref videoTime); } - public bool IsFinished(int VideoStream) + public bool IsFinished(int videoStream) { - return CVideo.VdFinished(VideoStream); + return CVideo.VdFinished(videoStream); } - public bool Close(int VideoStream) + public bool Close(int videoStream) { - return CVideo.VdClose(VideoStream); + return CVideo.VdClose(videoStream); } } - class BSound : ISound + class CBsound : ISound { - public int Load(string SoundFile, bool Prescan) + public int Load(string soundFile, bool prescan) { - return CSound.Load(SoundFile, Prescan); + return CSound.Load(soundFile, prescan); } - public void SetPosition(int SoundStream, float NewPosition) + public void SetPosition(int soundStream, float newPosition) { - CSound.SetPosition(SoundStream, NewPosition); + CSound.SetPosition(soundStream, newPosition); } - public void Play(int SoundStream) + public void Play(int soundStream) { - CSound.Play(SoundStream); + CSound.Play(soundStream); } - public void Fade(int SoundStream, float TargetVolume, float Duration) + public void Fade(int soundStream, float targetVolume, float duration) { - CSound.Fade(SoundStream, TargetVolume, Duration); + CSound.Fade(soundStream, targetVolume, duration); } - public bool IsFinished(int SoundStream) + public bool IsFinished(int soundStream) { - return CSound.IsFinished(SoundStream); + return CSound.IsFinished(soundStream); } - public float GetPosition(int SoundStream) + public float GetPosition(int soundStream) { - return CSound.GetPosition(SoundStream); + return CSound.GetPosition(soundStream); } - public float GetLength(int SoundStream) + public float GetLength(int soundStream) { - return CSound.GetLength(SoundStream); + return CSound.GetLength(soundStream); } - public void FadeAndStop(int SoundStream, float TargetVolume, float Duration) + public void FadeAndStop(int soundStream, float targetVolume, float duration) { - CSound.FadeAndStop(SoundStream, TargetVolume, Duration); + CSound.FadeAndStop(soundStream, targetVolume, duration); } - public void SetStreamVolume(int SoundStream, float Volume) + public void SetStreamVolume(int soundStream, float volume) { - CSound.SetStreamVolume(SoundStream, Volume); + CSound.SetStreamVolume(soundStream, volume); } - public void SetStreamVolumeMax(int SoundStream, float MaxVolume) + public void SetStreamVolumeMax(int soundStream, float maxVolume) { - CSound.SetStreamVolumeMax(SoundStream, MaxVolume); + CSound.SetStreamVolumeMax(soundStream, maxVolume); } } - class BCover : ICover + class CBcover : ICover { public STexture GetNoCover() { @@ -744,27 +744,27 @@ namespace Vocaluxe.Base } } - class BDataBase : IDataBase + class CBdataBase : IDataBase { - public bool GetCover(string FileName, ref STexture Texture, int CoverSize) + public bool GetCover(string fileName, ref STexture texture, int coverSize) { - return CDataBase.GetCover(FileName, ref Texture, CoverSize); + return CDataBase.GetCover(fileName, ref texture, coverSize); } } - class BInputs : IInputs + class CBinputs : IInputs { - public void SetRumble(float Duration) + public void SetRumble(float duration) { - CInput.SetRumble(Duration); + CInput.SetRumble(duration); } } - class BPlaylist : IPlaylist + class CBplaylist : IPlaylist { - public void SetPlaylistName(int PlaylistID, string Name) + public void SetPlaylistName(int playlistID, string name) { - CPlaylists.SetPlaylistName(PlaylistID, Name); + CPlaylists.SetPlaylistName(playlistID, name); } public string[] GetPlaylistNames() @@ -772,19 +772,19 @@ namespace Vocaluxe.Base return CPlaylists.GetPlaylistNames(); } - public string GetPlaylistName(int PlaylistID) + public string GetPlaylistName(int playlistID) { - return CPlaylists.GetPlaylistName(PlaylistID); + return CPlaylists.GetPlaylistName(playlistID); } - public void DeletePlaylist(int PlaylistID) + public void DeletePlaylist(int playlistID) { - CPlaylists.DeletePlaylist(PlaylistID); + CPlaylists.DeletePlaylist(playlistID); } - public void SavePlaylist(int PlaylistID) + public void SavePlaylist(int playlistID) { - CPlaylists.SavePlaylist(PlaylistID); + CPlaylists.SavePlaylist(playlistID); } public int GetNumPlaylists() @@ -792,49 +792,49 @@ namespace Vocaluxe.Base return CPlaylists.NumPlaylists; } - public void AddPlaylistSong(int PlaylistID, int SongID) + public void AddPlaylistSong(int playlistID, int songID) { - CPlaylists.AddPlaylistSong(PlaylistID, SongID); + CPlaylists.AddPlaylistSong(playlistID, songID); } - public void AddPlaylistSong(int PlaylistID, int SongID, EGameMode GameMode) + public void AddPlaylistSong(int playlistID, int songID, EGameMode gameMode) { - CPlaylists.AddPlaylistSong(PlaylistID, SongID, GameMode); + CPlaylists.AddPlaylistSong(playlistID, songID, gameMode); } - public void InsertPlaylistSong(int PlaylistID, int PositionIndex, int SongID, EGameMode GameMode) + public void InsertPlaylistSong(int playlistID, int positionIndex, int songID, EGameMode gameMode) { - CPlaylists.InsertPlaylistSong(PlaylistID, PositionIndex, SongID, GameMode); + CPlaylists.InsertPlaylistSong(playlistID, positionIndex, songID, gameMode); } - public void MovePlaylistSong(int PlaylistID, int SourceIndex, int DestIndex) + public void MovePlaylistSong(int playlistID, int sourceIndex, int destIndex) { - CPlaylists.MovePlaylistSong(PlaylistID, SourceIndex, DestIndex); + CPlaylists.MovePlaylistSong(playlistID, sourceIndex, destIndex); } - public void MovePlaylistSongDown(int PlaylistID, int SongIndex) + public void MovePlaylistSongDown(int playlistID, int songIndex) { - CPlaylists.MovePlaylistSongDown(PlaylistID, SongIndex); + CPlaylists.MovePlaylistSongDown(playlistID, songIndex); } - public void MovePlaylistSongUp(int PlaylistID, int SongIndex) + public void MovePlaylistSongUp(int playlistID, int songIndex) { - CPlaylists.MovePlaylistSongUp(PlaylistID, SongIndex); + CPlaylists.MovePlaylistSongUp(playlistID, songIndex); } - public void DeletePlaylistSong(int PlaylistID, int SongIndex) + public void DeletePlaylistSong(int playlistID, int songIndex) { - CPlaylists.DeletePlaylistSong(PlaylistID, SongIndex); + CPlaylists.DeletePlaylistSong(playlistID, songIndex); } - public int GetPlaylistSongCount(int PlaylistID) + public int GetPlaylistSongCount(int playlistID) { - return CPlaylists.GetPlaylistSongCount(PlaylistID); + return CPlaylists.GetPlaylistSongCount(playlistID); } - public CPlaylistSong GetPlaylistSong(int PlaylistID, int SongIndex) + public CPlaylistSong GetPlaylistSong(int playlistID, int songIndex) { - return CPlaylists.GetPlaylistSong(PlaylistID, SongIndex); + return CPlaylists.GetPlaylistSong(playlistID, songIndex); } } } \ No newline at end of file diff --git a/Vocaluxe/Base/CObservable.cs b/Vocaluxe/Base/CObservable.cs index d548e92e..5308ab84 100644 --- a/Vocaluxe/Base/CObservable.cs +++ b/Vocaluxe/Base/CObservable.cs @@ -7,7 +7,7 @@ namespace Vocaluxe.Base public event EventHandler ObjectChanged = delegate { }; protected bool _Changed = true; - protected void NotifyObservers() + protected void _NotifyObservers() { ObjectChanged.Invoke(this, null); } @@ -15,7 +15,7 @@ namespace Vocaluxe.Base protected void _SetChanged() { _Changed = true; - NotifyObservers(); + _NotifyObservers(); } } } \ No newline at end of file diff --git a/Vocaluxe/Base/CParty.cs b/Vocaluxe/Base/CParty.cs index 581f07c5..8328f42c 100644 --- a/Vocaluxe/Base/CParty.cs +++ b/Vocaluxe/Base/CParty.cs @@ -30,7 +30,7 @@ namespace Vocaluxe.Base static class CParty { - private const int PartyModeSystemVersion = 1; + private const int _PartyModeSystemVersion = 1; private static Dictionary _PartyModes; private static Queue _IDs; @@ -58,7 +58,7 @@ namespace Vocaluxe.Base _CurrentPartyMode = pm; //load other party modes - LoadPartyModes(); + _LoadPartyModes(); } public static int CurrentPartyModeID @@ -81,15 +81,15 @@ namespace Vocaluxe.Base { List infos = new List(); - int[] UsedKeys = new int[_PartyModes.Count]; - _PartyModes.Keys.CopyTo(UsedKeys, 0); + int[] usedKeys = new int[_PartyModes.Count]; + _PartyModes.Keys.CopyTo(usedKeys, 0); - for (int i = 0; i < UsedKeys.Length; i++) + for (int i = 0; i < usedKeys.Length; i++) { - if (UsedKeys[i] != _NormalGameModeID) + if (usedKeys[i] != _NormalGameModeID) { SPartyMode mode = new SPartyMode(); - _PartyModes.TryGetValue(UsedKeys[i], out mode); + _PartyModes.TryGetValue(usedKeys[i], out mode); if (mode.PartyMode != null) { @@ -122,17 +122,17 @@ namespace Vocaluxe.Base SetPartyMode(_NormalGameModeID); } - public static void SetPartyMode(int PartyModeID) + public static void SetPartyMode(int partyModeID) { - if (!_PartyModes.TryGetValue(PartyModeID, out _CurrentPartyMode)) - CLog.LogError("CParty: Can't find party mode ID: " + PartyModeID.ToString()); + if (!_PartyModes.TryGetValue(partyModeID, out _CurrentPartyMode)) + CLog.LogError("CParty: Can't find party mode ID: " + partyModeID.ToString()); _CurrentPartyMode.PartyMode.Init(); } - public static CMenu GetNextPartyScreen(out EScreens AlternativeScreen) + public static CMenu GetNextPartyScreen(out EScreens alternativeScreen) { - return _CurrentPartyMode.PartyMode.GetNextPartyScreen(out AlternativeScreen); + return _CurrentPartyMode.PartyMode.GetNextPartyScreen(out alternativeScreen); } #endregion public stuff @@ -152,34 +152,34 @@ namespace Vocaluxe.Base return _CurrentPartyMode.PartyMode.GetMainScreen(); } - public static ScreenSongOptions GetSongSelectionOptions() + public static SScreenSongOptions GetSongSelectionOptions() { return _CurrentPartyMode.PartyMode.GetScreenSongOptions(); } - public static void OnSongChange(int SongIndex, ref ScreenSongOptions ScreenSongOptions) + public static void OnSongChange(int songIndex, ref SScreenSongOptions screenSongOptions) { - _CurrentPartyMode.PartyMode.OnSongChange(SongIndex, ref ScreenSongOptions); + _CurrentPartyMode.PartyMode.OnSongChange(songIndex, ref screenSongOptions); } - public static void OnCategoryChange(int CategoryIndex, ref ScreenSongOptions ScreenSongOptions) + public static void OnCategoryChange(int categoryIndex, ref SScreenSongOptions screenSongOptions) { - _CurrentPartyMode.PartyMode.OnCategoryChange(CategoryIndex, ref ScreenSongOptions); + _CurrentPartyMode.PartyMode.OnCategoryChange(categoryIndex, ref screenSongOptions); } - public static void SetSearchString(string SearchString, bool Visible) + public static void SetSearchString(string searchString, bool visible) { - _CurrentPartyMode.PartyMode.SetSearchString(SearchString, Visible); + _CurrentPartyMode.PartyMode.SetSearchString(searchString, visible); } - public static void JokerUsed(int TeamNr) + public static void JokerUsed(int teamNr) { - _CurrentPartyMode.PartyMode.JokerUsed(TeamNr); + _CurrentPartyMode.PartyMode.JokerUsed(teamNr); } - public static void SongSelected(int SongID) + public static void SongSelected(int songID) { - _CurrentPartyMode.PartyMode.SongSelected(SongID); + _CurrentPartyMode.PartyMode.SongSelected(songID); } public static void FinishedSinging() @@ -199,19 +199,19 @@ namespace Vocaluxe.Base #endregion Interface #region private stuff - private static void LoadPartyModes() + private static void _LoadPartyModes() { List files = new List(); - files.AddRange(CHelper.ListFiles(CSettings.sFolderPartyModes, "*.xml", false, true)); + files.AddRange(CHelper.ListFiles(CSettings.FolderPartyModes, "*.xml", false, true)); foreach (string file in files) { - SPartyMode pm = LoadPartyMode(file); + SPartyMode pm = _LoadPartyMode(file); _PartyModes.Add(pm.PartyModeID, pm); } } - private static SPartyMode LoadPartyMode(string file) + private static SPartyMode _LoadPartyMode(string file) { SPartyMode pm = new SPartyMode(); pm.PartyModeID = _IDs.Dequeue(); @@ -243,7 +243,7 @@ namespace Vocaluxe.Base return pm; } - if (pm.PartyModeSystemVersion != PartyModeSystemVersion) + if (pm.PartyModeSystemVersion != _PartyModeSystemVersion) { CLog.LogError("Error loading PartyMode file (wrong PartyModeSystemVersion): " + file); return pm; @@ -255,23 +255,23 @@ namespace Vocaluxe.Base return pm; } - string PathToCode = Path.Combine(Path.Combine(CSettings.sFolderPartyModes, pm.Folder), CSettings.sFolderPartyModeCode); + string pathToCode = Path.Combine(Path.Combine(CSettings.FolderPartyModes, pm.Folder), CSettings.FolderPartyModeCode); - List FilesToCompile = new List(); - FilesToCompile.AddRange(CHelper.ListFiles(PathToCode, "*.cs", false, true)); + List filesToCompile = new List(); + filesToCompile.AddRange(CHelper.ListFiles(pathToCode, "*.cs", false, true)); - Assembly Output = CompileFiles(FilesToCompile.ToArray()); - if (Output == null) + Assembly output = _CompileFiles(filesToCompile.ToArray()); + if (output == null) return pm; - if (!CLanguage.LoadPartyLanguageFiles(pm.PartyModeID, Path.Combine(Path.Combine(CSettings.sFolderPartyModes, pm.Folder), CSettings.sFolderPartyModeLanguages))) + if (!CLanguage.LoadPartyLanguageFiles(pm.PartyModeID, Path.Combine(Path.Combine(CSettings.FolderPartyModes, pm.Folder), CSettings.FolderPartyModeLanguages))) { CLog.LogError("Error loading language files for PartyMode: " + file); return pm; } - object Instance = Output.CreateInstance(typeof(IPartyMode).Namespace + "." + pm.Folder + "." + pm.PartyModeFile); - if (Instance == null) + object instance = output.CreateInstance(typeof(IPartyMode).Namespace + "." + pm.Folder + "." + pm.PartyModeFile); + if (instance == null) { CLog.LogError("Error creating Instance of PartyMode file: " + file); return pm; @@ -279,7 +279,7 @@ namespace Vocaluxe.Base try { - pm.PartyMode = (IPartyMode)Instance; + pm.PartyMode = (IPartyMode)instance; } catch (Exception e) { @@ -288,31 +288,31 @@ namespace Vocaluxe.Base } pm.PartyMode.Initialize(); - if (!CTheme.AddTheme(Path.Combine(Directory.GetCurrentDirectory(), Path.Combine(Path.Combine(CSettings.sFolderPartyModes, pm.Folder), "Theme.xml")), pm.PartyModeID)) + if (!CTheme.AddTheme(Path.Combine(Directory.GetCurrentDirectory(), Path.Combine(Path.Combine(CSettings.FolderPartyModes, pm.Folder), "Theme.xml")), pm.PartyModeID)) return pm; - int ThemeIndex = CTheme.GetThemeIndex(pm.PartyModeID); - CTheme.ListSkins(ThemeIndex); - int SkinIndex = CTheme.GetSkinIndex(pm.PartyModeID); + int themeIndex = CTheme.GetThemeIndex(pm.PartyModeID); + CTheme.ListSkins(themeIndex); + int skinIndex = CTheme.GetSkinIndex(pm.PartyModeID); - if (!CTheme.LoadSkin(SkinIndex)) + if (!CTheme.LoadSkin(skinIndex)) return pm; - if (!CTheme.LoadTheme(ThemeIndex)) + if (!CTheme.LoadTheme(themeIndex)) return pm; foreach (string screenfile in pm.ScreenFiles) { - string XmlPath = Path.Combine(Path.Combine(CSettings.sFolderPartyModes, pm.Folder), CSettings.sFolderPartyModeScreens); - CMenuParty Screen = GetPartyScreenInstance(Output, screenfile, pm.Folder); + string xmlPath = Path.Combine(Path.Combine(CSettings.FolderPartyModes, pm.Folder), CSettings.FolderPartyModeScreens); + CMenuParty screen = _GetPartyScreenInstance(output, screenfile, pm.Folder); - if (Screen != null) + if (screen != null) { - Screen.Init(); - Screen.AssingPartyMode(pm.PartyMode); - Screen.SetPartyModeID(pm.PartyModeID); - Screen.LoadTheme(XmlPath); - pm.PartyMode.AddScreen(Screen, screenfile); + screen.Init(); + screen.AssingPartyMode(pm.PartyMode); + screen.SetPartyModeID(pm.PartyModeID); + screen.LoadTheme(xmlPath); + pm.PartyMode.AddScreen(screen, screenfile); } else return pm; @@ -322,7 +322,7 @@ namespace Vocaluxe.Base return pm; } - private static Assembly CompileFiles(string[] files) + private static Assembly _CompileFiles(string[] files) { if (files == null) return null; @@ -338,13 +338,13 @@ namespace Vocaluxe.Base compilerParams.IncludeDebugInformation = true; #endif - using (CodeDomProvider CDP = CodeDomProvider.CreateProvider("CSharp")) + using (CodeDomProvider cdp = CodeDomProvider.CreateProvider("CSharp")) { - CompilerResults CompileResult = null; + CompilerResults compileResult = null; try { - CompileResult = CDP.CompileAssemblyFromFile(compilerParams, files); + compileResult = cdp.CompileAssemblyFromFile(compilerParams, files); } catch (Exception e) { @@ -352,39 +352,39 @@ namespace Vocaluxe.Base return null; } - if (CompileResult.Errors.Count > 0) + if (compileResult.Errors.Count > 0) { - foreach (CompilerError e in CompileResult.Errors) + foreach (CompilerError e in compileResult.Errors) CLog.LogError("Error Compiling Source (" + CHelper.ListStrings(files) + "): " + e.ErrorText + " in '" + e.FileName + "' (" + e.Line + ")"); return null; } - return CompileResult.CompiledAssembly; + return compileResult.CompiledAssembly; } } - private static CMenuParty GetPartyScreenInstance(Assembly Assembly, string ScreenName, string partyModeName) + private static CMenuParty _GetPartyScreenInstance(Assembly assembly, string screenName, string partyModeName) { - if (Assembly == null) + if (assembly == null) return null; - object Instance = Assembly.CreateInstance(typeof(IPartyMode).Namespace + "." + partyModeName + "." + ScreenName); - if (Instance == null) + object instance = assembly.CreateInstance(typeof(IPartyMode).Namespace + "." + partyModeName + "." + screenName); + if (instance == null) { - CLog.LogError("Error creating Instance of PartyScreen: " + ScreenName); + CLog.LogError("Error creating Instance of PartyScreen: " + screenName); return null; } - CMenuParty Screen = null; + CMenuParty screen = null; try { - Screen = (CMenuParty)Instance; + screen = (CMenuParty)instance; } catch (Exception e) { - CLog.LogError("Error casting PartyScreen: " + ScreenName + "; " + e.Message); + CLog.LogError("Error casting PartyScreen: " + screenName + "; " + e.Message); return null; } - return Screen; + return screen; } #endregion private stuff } diff --git a/Vocaluxe/Base/CPlaylists.cs b/Vocaluxe/Base/CPlaylists.cs index 9c914e4e..03532e71 100644 --- a/Vocaluxe/Base/CPlaylists.cs +++ b/Vocaluxe/Base/CPlaylists.cs @@ -38,17 +38,17 @@ namespace Vocaluxe.Base LoadPlaylists(); ConvertUSDXPlaylists(); - SortPlaylistsByName(); + _SortPlaylistsByName(); } public static void ConvertUSDXPlaylists() { List files = new List(); - files.AddRange(CHelper.ListFiles(CSettings.sFolderPlaylists, "*.upl", true, true)); + files.AddRange(CHelper.ListFiles(CSettings.FolderPlaylists, "*.upl", true, true)); foreach (string file in files) { - CPlaylistFile playlist = ConvertUSDXPlaylist(file); + CPlaylistFile playlist = _ConvertUSDXPlaylist(file); playlist.SavePlaylist(); _Playlists.Add(playlist); } @@ -58,7 +58,7 @@ namespace Vocaluxe.Base { _Playlists = new List(); List files = new List(); - files.AddRange(CHelper.ListFiles(CSettings.sFolderPlaylists, "*.xml", true, true)); + files.AddRange(CHelper.ListFiles(CSettings.FolderPlaylists, "*.xml", true, true)); foreach (string file in files) { @@ -67,12 +67,12 @@ namespace Vocaluxe.Base } } - public static string GetPlaylistName(int PlaylistID) + public static string GetPlaylistName(int playlistID) { - if (PlaylistID >= _Playlists.Count || PlaylistID < 0) + if (playlistID >= _Playlists.Count || playlistID < 0) return "Error: Can't find Playlist"; - return _Playlists[PlaylistID].PlaylistName; + return _Playlists[playlistID].PlaylistName; } public static string[] GetPlaylistNames() @@ -85,37 +85,37 @@ namespace Vocaluxe.Base return result.ToArray(); } - public static void SetPlaylistName(int PlaylistID, string Name) + public static void SetPlaylistName(int playlistID, string name) { - if (PlaylistID >= _Playlists.Count || PlaylistID < 0) + if (playlistID >= _Playlists.Count || playlistID < 0) return; - _Playlists[PlaylistID].PlaylistName = Name; + _Playlists[playlistID].PlaylistName = name; } - public static void DeletePlaylist(int PlaylistID) + public static void DeletePlaylist(int playlistID) { - if (PlaylistID < 0 || PlaylistID >= _Playlists.Count) + if (playlistID < 0 || playlistID >= _Playlists.Count) return; - if (_Playlists[PlaylistID].PlaylistFile.Length > 0) + if (_Playlists[playlistID].PlaylistFile.Length > 0) { try { - File.Delete(_Playlists[PlaylistID].PlaylistFile); + File.Delete(_Playlists[playlistID].PlaylistFile); } catch (Exception) { - CLog.LogError("Can't delete Playlist File " + _Playlists[PlaylistID].PlaylistFile + ".xml"); + CLog.LogError("Can't delete Playlist File " + _Playlists[playlistID].PlaylistFile + ".xml"); } } - _Playlists.RemoveAt(PlaylistID); + _Playlists.RemoveAt(playlistID); } - public static void SavePlaylist(int PlaylistID) + public static void SavePlaylist(int playlistID) { - if (PlaylistID < 0 || PlaylistID >= _Playlists.Count) + if (playlistID < 0 || playlistID >= _Playlists.Count) return; - _Playlists[PlaylistID].SavePlaylist(); + _Playlists[playlistID].SavePlaylist(); } public static int NewPlaylist() @@ -126,96 +126,96 @@ namespace Vocaluxe.Base return _Playlists.Count - 1; } - public static void AddPlaylistSong(int PlaylistID, int SongID) + public static void AddPlaylistSong(int playlistID, int songID) { - if (PlaylistID >= _Playlists.Count || PlaylistID < 0) + if (playlistID >= _Playlists.Count || playlistID < 0) return; - _Playlists[PlaylistID].AddSong(SongID); + _Playlists[playlistID].AddSong(songID); } - public static void AddPlaylistSong(int PlaylistID, int SongID, EGameMode GameMode) + public static void AddPlaylistSong(int playlistID, int songID, EGameMode gameMode) { - if (PlaylistID >= _Playlists.Count || PlaylistID < 0) + if (playlistID >= _Playlists.Count || playlistID < 0) return; - _Playlists[PlaylistID].AddSong(SongID, GameMode); + _Playlists[playlistID].AddSong(songID, gameMode); } - public static void InsertPlaylistSong(int PlaylistID, int PositionIndex, int SongID, EGameMode GameMode) + public static void InsertPlaylistSong(int playlistID, int positionIndex, int songID, EGameMode gameMode) { - if (PlaylistID >= _Playlists.Count || PlaylistID < 0) + if (playlistID >= _Playlists.Count || playlistID < 0) return; - _Playlists[PlaylistID].SongInsert(PositionIndex, SongID, GameMode); + _Playlists[playlistID].SongInsert(positionIndex, songID, gameMode); } - public static void MovePlaylistSong(int PlaylistID, int SourceIndex, int DestIndex) + public static void MovePlaylistSong(int playlistID, int sourceIndex, int destIndex) { - if (PlaylistID >= _Playlists.Count || PlaylistID < 0) + if (playlistID >= _Playlists.Count || playlistID < 0) return; - _Playlists[PlaylistID].SongMove(SourceIndex, DestIndex); + _Playlists[playlistID].SongMove(sourceIndex, destIndex); } - public static void MovePlaylistSongDown(int PlaylistID, int SongIndex) + public static void MovePlaylistSongDown(int playlistID, int songIndex) { - if (PlaylistID >= _Playlists.Count || PlaylistID < 0) + if (playlistID >= _Playlists.Count || playlistID < 0) return; - _Playlists[PlaylistID].SongDown(SongIndex); + _Playlists[playlistID].SongDown(songIndex); } - public static void MovePlaylistSongUp(int PlaylistID, int SongIndex) + public static void MovePlaylistSongUp(int playlistID, int songIndex) { - if (PlaylistID >= _Playlists.Count || PlaylistID < 0) + if (playlistID >= _Playlists.Count || playlistID < 0) return; - _Playlists[PlaylistID].SongUp(SongIndex); + _Playlists[playlistID].SongUp(songIndex); } - public static void DeletePlaylistSong(int PlaylistID, int SongIndex) + public static void DeletePlaylistSong(int playlistID, int songIndex) { - if (PlaylistID >= _Playlists.Count || PlaylistID < 0) + if (playlistID >= _Playlists.Count || playlistID < 0) return; - _Playlists[PlaylistID].DeleteSong(SongIndex); + _Playlists[playlistID].DeleteSong(songIndex); } - public static int GetPlaylistSongCount(int PlaylistID) + public static int GetPlaylistSongCount(int playlistID) { - if (PlaylistID >= _Playlists.Count || PlaylistID < 0) + if (playlistID >= _Playlists.Count || playlistID < 0) return 0; - return _Playlists[PlaylistID].Songs.Count; + return _Playlists[playlistID].Songs.Count; } - public static CPlaylistSong GetPlaylistSong(int PlaylistID, int SongIndex) + public static CPlaylistSong GetPlaylistSong(int playlistID, int songIndex) { - if (PlaylistID >= _Playlists.Count || PlaylistID < 0) + if (playlistID >= _Playlists.Count || playlistID < 0) return null; - if (SongIndex >= _Playlists[PlaylistID].Songs.Count) + if (songIndex >= _Playlists[playlistID].Songs.Count) return null; - return _Playlists[PlaylistID].Songs[SongIndex]; + return _Playlists[playlistID].Songs[songIndex]; } #region private methods - private static void SortPlaylistsByName() + private static void _SortPlaylistsByName() { - _Playlists.Sort(CompareByPlaylistName); + _Playlists.Sort(_CompareByPlaylistName); } - private static int CompareByPlaylistName(CPlaylistFile a, CPlaylistFile b) + private static int _CompareByPlaylistName(CPlaylistFile a, CPlaylistFile b) { return String.Compare(a.PlaylistName, b.PlaylistName); } - private static CPlaylistFile ConvertUSDXPlaylist(string file) + private static CPlaylistFile _ConvertUSDXPlaylist(string file) { CPlaylistFile pl = new CPlaylistFile(); - CSong[] AllSongs = CSongs.AllSongs; + CSong[] allSongs = CSongs.AllSongs; if (!File.Exists(file)) return null; @@ -234,28 +234,28 @@ namespace Vocaluxe.Base //Name or comment if (line[0] == '#') { - string Identifier = line.Substring(1, pos - 1).Trim(); - string Value = line.Substring(pos + 1, line.Length - pos - 1).Trim(); - if (Identifier.ToUpper() == "NAME") - pl.PlaylistName = Value; + string identifier = line.Substring(1, pos - 1).Trim(); + string value = line.Substring(pos + 1, line.Length - pos - 1).Trim(); + if (identifier.ToUpper() == "NAME") + pl.PlaylistName = value; } //Song else { - string Artist = line.Substring(0, pos - 1).Trim(); - string Title = line.Substring(pos + 1, line.Length - pos - 1).Trim(); + string artist = line.Substring(0, pos - 1).Trim(); + string title = line.Substring(pos + 1, line.Length - pos - 1).Trim(); bool found = false; - for (int s = 0; s < AllSongs.Length; s++) + for (int s = 0; s < allSongs.Length; s++) { - if (AllSongs[s].Artist == Artist && AllSongs[s].Title == Title) + if (allSongs[s].Artist == artist && allSongs[s].Title == title) { - pl.AddSong(AllSongs[s].ID); + pl.AddSong(allSongs[s].ID); found = true; break; } } if (!found) - CLog.LogError("Can't find song '" + Title + "' from '" + Artist + "' in playlist file: " + file); + CLog.LogError("Can't find song '" + title + "' from '" + artist + "' in playlist file: " + file); } } } diff --git a/Vocaluxe/Base/CProfiles.cs b/Vocaluxe/Base/CProfiles.cs index 93d4d657..176807e1 100644 --- a/Vocaluxe/Base/CProfiles.cs +++ b/Vocaluxe/Base/CProfiles.cs @@ -9,7 +9,7 @@ namespace Vocaluxe.Base { static class CProfiles { - private static readonly XmlWriterSettings _settings = new XmlWriterSettings(); + private static readonly XmlWriterSettings _Settings = new XmlWriterSettings(); private static List _Profiles; private static readonly List _Avatars = new List(); @@ -35,9 +35,9 @@ namespace Vocaluxe.Base public static void Init() { - _settings.Indent = true; - _settings.Encoding = Encoding.UTF8; - _settings.ConformanceLevel = ConformanceLevel.Document; + _Settings.Indent = true; + _Settings.Encoding = Encoding.UTF8; + _Settings.ConformanceLevel = ConformanceLevel.Document; LoadAvatars(); LoadProfiles(); @@ -48,7 +48,7 @@ namespace Vocaluxe.Base return NewProfile(String.Empty); } - public static int NewProfile(string FileName) + public static int NewProfile(string fileName) { SProfile profile = new SProfile(); @@ -58,8 +58,8 @@ namespace Vocaluxe.Base profile.GuestProfile = EOffOn.TR_CONFIG_OFF; profile.Active = EOffOn.TR_CONFIG_ON; - if (FileName.Length > 0) - profile.ProfileFile = Path.Combine(CSettings.sFolderProfiles, FileName); + if (fileName.Length > 0) + profile.ProfileFile = Path.Combine(CSettings.FolderProfiles, fileName); else profile.ProfileFile = String.Empty; @@ -73,7 +73,7 @@ namespace Vocaluxe.Base public static void SaveProfiles() { for (int i = 0; i < _Profiles.Count; i++) - SaveProfile(i); + _SaveProfile(i); LoadProfiles(); } @@ -81,12 +81,12 @@ namespace Vocaluxe.Base { _Profiles = new List(); List files = new List(); - files.AddRange(CHelper.ListFiles(CSettings.sFolderProfiles, "*.xml", true, true)); + files.AddRange(CHelper.ListFiles(CSettings.FolderProfiles, "*.xml", true, true)); foreach (string file in files) - LoadProfile(file); + _LoadProfile(file); - SortProfilesByName(); + _SortProfilesByName(); } public static void LoadAvatars() @@ -99,16 +99,16 @@ namespace Vocaluxe.Base _Avatars.Clear(); List files = new List(); - files.AddRange(CHelper.ListFiles(CSettings.sFolderProfiles, "*.png", true, true)); - files.AddRange(CHelper.ListFiles(CSettings.sFolderProfiles, "*.jpg", true, true)); - files.AddRange(CHelper.ListFiles(CSettings.sFolderProfiles, "*.jpeg", true, true)); - files.AddRange(CHelper.ListFiles(CSettings.sFolderProfiles, "*.bmp", true, true)); + files.AddRange(CHelper.ListFiles(CSettings.FolderProfiles, "*.png", true, true)); + files.AddRange(CHelper.ListFiles(CSettings.FolderProfiles, "*.jpg", true, true)); + files.AddRange(CHelper.ListFiles(CSettings.FolderProfiles, "*.jpeg", true, true)); + files.AddRange(CHelper.ListFiles(CSettings.FolderProfiles, "*.bmp", true, true)); foreach (string file in files) { STexture tex = CDraw.AddTexture(file); - if (tex.index != -1) + if (tex.Index != -1) { SAvatar avatar = new SAvatar(); avatar.Texture = tex; @@ -118,179 +118,179 @@ namespace Vocaluxe.Base } } - public static string AddGetPlayerName(int ProfileNr, char Chr) + public static string AddGetPlayerName(int profileNr, char chr) { - if (ProfileNr < 0 || ProfileNr >= _Profiles.Count) + if (profileNr < 0 || profileNr >= _Profiles.Count) return String.Empty; - SProfile profile = _Profiles[ProfileNr]; - profile.PlayerName += Chr; - _Profiles[ProfileNr] = profile; + SProfile profile = _Profiles[profileNr]; + profile.PlayerName += chr; + _Profiles[profileNr] = profile; return profile.PlayerName; } - public static string GetPlayerName(int ProfileNr) + public static string GetPlayerName(int profileNr) { - if (ProfileNr < 0 || ProfileNr >= _Profiles.Count) + if (profileNr < 0 || profileNr >= _Profiles.Count) return String.Empty; - return _Profiles[ProfileNr].PlayerName; + return _Profiles[profileNr].PlayerName; } - public static string GetDeleteCharInPlayerName(int ProfileNr) + public static string GetDeleteCharInPlayerName(int profileNr) { - if (ProfileNr < 0 || ProfileNr >= _Profiles.Count) + if (profileNr < 0 || profileNr >= _Profiles.Count) return String.Empty; - SProfile profile = _Profiles[ProfileNr]; + SProfile profile = _Profiles[profileNr]; if (profile.PlayerName.Length > 0) profile.PlayerName = profile.PlayerName.Remove(profile.PlayerName.Length - 1); - _Profiles[ProfileNr] = profile; + _Profiles[profileNr] = profile; return profile.PlayerName; } - public static EGameDifficulty GetDifficulty(int ProfileNr) + public static EGameDifficulty GetDifficulty(int profileNr) { - if (ProfileNr < 0 || ProfileNr >= _Profiles.Count) + if (profileNr < 0 || profileNr >= _Profiles.Count) return EGameDifficulty.TR_CONFIG_NORMAL; - return _Profiles[ProfileNr].Difficulty; + return _Profiles[profileNr].Difficulty; } - public static void SetDifficulty(int ProfileNr, EGameDifficulty Difficulty) + public static void SetDifficulty(int profileNr, EGameDifficulty difficulty) { - if (ProfileNr < 0 || ProfileNr >= _Profiles.Count) + if (profileNr < 0 || profileNr >= _Profiles.Count) return; - SProfile profile = _Profiles[ProfileNr]; - profile.Difficulty = Difficulty; - _Profiles[ProfileNr] = profile; + SProfile profile = _Profiles[profileNr]; + profile.Difficulty = difficulty; + _Profiles[profileNr] = profile; } - public static EOffOn GetGuestProfile(int ProfileNr) + public static EOffOn GetGuestProfile(int profileNr) { - if (ProfileNr < 0 || ProfileNr >= _Profiles.Count) + if (profileNr < 0 || profileNr >= _Profiles.Count) return EOffOn.TR_CONFIG_OFF; - return _Profiles[ProfileNr].GuestProfile; + return _Profiles[profileNr].GuestProfile; } - public static EOffOn GetActive(int ProfileNr) + public static EOffOn GetActive(int profileNr) { - if (ProfileNr < 0 || ProfileNr >= _Profiles.Count) + if (profileNr < 0 || profileNr >= _Profiles.Count) return EOffOn.TR_CONFIG_OFF; - return _Profiles[ProfileNr].Active; + return _Profiles[profileNr].Active; } - public static void SetGuestProfile(int ProfileNr, EOffOn Option) + public static void SetGuestProfile(int profileNr, EOffOn option) { - if (ProfileNr < 0 || ProfileNr >= _Profiles.Count) + if (profileNr < 0 || profileNr >= _Profiles.Count) return; - SProfile profile = _Profiles[ProfileNr]; - profile.GuestProfile = Option; - _Profiles[ProfileNr] = profile; + SProfile profile = _Profiles[profileNr]; + profile.GuestProfile = option; + _Profiles[profileNr] = profile; } - public static void SetActive(int ProfileNr, EOffOn Option) + public static void SetActive(int profileNr, EOffOn option) { - if (ProfileNr < 0 || ProfileNr >= _Profiles.Count) + if (profileNr < 0 || profileNr >= _Profiles.Count) return; - SProfile profile = _Profiles[ProfileNr]; - profile.Active = Option; - _Profiles[ProfileNr] = profile; + SProfile profile = _Profiles[profileNr]; + profile.Active = option; + _Profiles[profileNr] = profile; } - public static bool IsGuestProfile(int ProfileNr) + public static bool IsGuestProfile(int profileNr) { - if (ProfileNr < 0 || ProfileNr >= _Profiles.Count) + if (profileNr < 0 || profileNr >= _Profiles.Count) return true; // this will prevent from saving dummy profiles to highscore db - return _Profiles[ProfileNr].GuestProfile == EOffOn.TR_CONFIG_ON; + return _Profiles[profileNr].GuestProfile == EOffOn.TR_CONFIG_ON; } - public static bool IsActive(int ProfileNr) + public static bool IsActive(int profileNr) { - if (ProfileNr < 0 || ProfileNr >= _Profiles.Count) + if (profileNr < 0 || profileNr >= _Profiles.Count) return false; - return _Profiles[ProfileNr].Active == EOffOn.TR_CONFIG_ON; + return _Profiles[profileNr].Active == EOffOn.TR_CONFIG_ON; } - public static void SetAvatar(int ProfileNr, int AvatarNr) + public static void SetAvatar(int profileNr, int avatarNr) { - if (ProfileNr < 0 || ProfileNr >= _Profiles.Count || AvatarNr < 0 || AvatarNr >= _Avatars.Count) + if (profileNr < 0 || profileNr >= _Profiles.Count || avatarNr < 0 || avatarNr >= _Avatars.Count) return; - SProfile profile = _Profiles[ProfileNr]; - profile.Avatar = _Avatars[AvatarNr]; - _Profiles[ProfileNr] = profile; + SProfile profile = _Profiles[profileNr]; + profile.Avatar = _Avatars[avatarNr]; + _Profiles[profileNr] = profile; } - public static int GetAvatarNr(int ProfileNr) + public static int GetAvatarNr(int profileNr) { - if (ProfileNr < 0 || ProfileNr >= _Profiles.Count) + if (profileNr < 0 || profileNr >= _Profiles.Count) return 0; for (int i = 0; i < _Avatars.Count; i++) { - if (_Profiles[ProfileNr].Avatar.FileName == _Avatars[i].FileName) + if (_Profiles[profileNr].Avatar.FileName == _Avatars[i].FileName) return i; } return 0; } - public static void DeleteProfile(int ProfileID) + public static void DeleteProfile(int profileID) { - if (ProfileID < 0 || ProfileID >= _Profiles.Count) + if (profileID < 0 || profileID >= _Profiles.Count) return; - if (_Profiles[ProfileID].ProfileFile.Length > 0) + if (_Profiles[profileID].ProfileFile.Length > 0) { try { - File.Delete(_Profiles[ProfileID].ProfileFile); - _Profiles.RemoveAt(ProfileID); + File.Delete(_Profiles[profileID].ProfileFile); + _Profiles.RemoveAt(profileID); } catch (Exception) { - CLog.LogError("Can't delete Profile File " + _Profiles[ProfileID].ProfileFile + ".xml"); + CLog.LogError("Can't delete Profile File " + _Profiles[profileID].ProfileFile + ".xml"); } } } - private static void SortProfilesByName() + private static void _SortProfilesByName() { - _Profiles.Sort(CompareByPlayerName); + _Profiles.Sort(_CompareByPlayerName); } - private static int CompareByPlayerName(SProfile a, SProfile b) + private static int _CompareByPlayerName(SProfile a, SProfile b) { return String.Compare(a.PlayerName, b.PlayerName); } #region private methods - private static SAvatar GetAvatar(string FileName) + private static SAvatar _GetAvatar(string fileName) { foreach (SAvatar avatar in _Avatars) { - if (FileName == avatar.FileName) + if (fileName == avatar.FileName) return avatar; } return new SAvatar(-1); } - private static void SaveProfile(int ProfileID) + private static void _SaveProfile(int profileID) { - if (ProfileID < 0 || ProfileID >= _Profiles.Count) + if (profileID < 0 || profileID >= _Profiles.Count) return; - if (_Profiles[ProfileID].ProfileFile.Length == 0) + if (_Profiles[profileID].ProfileFile.Length == 0) { string filename = string.Empty; - foreach (char chr in _Profiles[ProfileID].PlayerName) + foreach (char chr in _Profiles[profileID].PlayerName) { if (char.IsLetter(chr)) filename += chr.ToString(); @@ -300,26 +300,26 @@ namespace Vocaluxe.Base filename = "1"; int i = 0; - while (File.Exists(Path.Combine(CSettings.sFolderProfiles, filename + ".xml"))) + while (File.Exists(Path.Combine(CSettings.FolderProfiles, filename + ".xml"))) { i++; - if (!File.Exists(Path.Combine(CSettings.sFolderProfiles, filename + i + ".xml"))) + if (!File.Exists(Path.Combine(CSettings.FolderProfiles, filename + i + ".xml"))) filename += i; } - SProfile profile = _Profiles[ProfileID]; - profile.ProfileFile = Path.Combine(CSettings.sFolderProfiles, filename + ".xml"); - _Profiles[ProfileID] = profile; + SProfile profile = _Profiles[profileID]; + profile.ProfileFile = Path.Combine(CSettings.FolderProfiles, filename + ".xml"); + _Profiles[profileID] = profile; } XmlWriter writer; try { - writer = XmlWriter.Create(_Profiles[ProfileID].ProfileFile, _settings); + writer = XmlWriter.Create(_Profiles[profileID].ProfileFile, _Settings); } catch (Exception e) { - CLog.LogError("Error creating/opening Profile File " + _Profiles[ProfileID].ProfileFile + ": " + e.Message); + CLog.LogError("Error creating/opening Profile File " + _Profiles[profileID].ProfileFile + ": " + e.Message); return; } try @@ -328,11 +328,11 @@ namespace Vocaluxe.Base writer.WriteStartElement("root"); writer.WriteStartElement("Info"); - writer.WriteElementString("PlayerName", _Profiles[ProfileID].PlayerName); - writer.WriteElementString("Difficulty", Enum.GetName(typeof(EGameDifficulty), _Profiles[ProfileID].Difficulty)); - writer.WriteElementString("Avatar", _Profiles[ProfileID].Avatar.FileName); - writer.WriteElementString("GuestProfile", Enum.GetName(typeof(EOffOn), _Profiles[ProfileID].GuestProfile)); - writer.WriteElementString("Active", Enum.GetName(typeof(EOffOn), _Profiles[ProfileID].Active)); + writer.WriteElementString("PlayerName", _Profiles[profileID].PlayerName); + writer.WriteElementString("Difficulty", Enum.GetName(typeof(EGameDifficulty), _Profiles[profileID].Difficulty)); + writer.WriteElementString("Avatar", _Profiles[profileID].Avatar.FileName); + writer.WriteElementString("GuestProfile", Enum.GetName(typeof(EOffOn), _Profiles[profileID].GuestProfile)); + writer.WriteElementString("Active", Enum.GetName(typeof(EOffOn), _Profiles[profileID].Active)); writer.WriteEndElement(); writer.WriteEndElement(); //end of root @@ -347,10 +347,10 @@ namespace Vocaluxe.Base } } - private static void LoadProfile(string FileName) + private static void _LoadProfile(string fileName) { SProfile profile = new SProfile(); - profile.ProfileFile = Path.Combine(CSettings.sFolderProfiles, FileName); + profile.ProfileFile = Path.Combine(CSettings.FolderProfiles, fileName); CXMLReader xmlReader = CXMLReader.OpenFile(profile.ProfileFile); if (xmlReader == null) @@ -366,7 +366,7 @@ namespace Vocaluxe.Base profile.Avatar = new SAvatar(-1); if (xmlReader.GetValue("//root/Info/Avatar", ref value, value)) - profile.Avatar = GetAvatar(value); + profile.Avatar = _GetAvatar(value); profile.GuestProfile = EOffOn.TR_CONFIG_OFF; xmlReader.TryGetEnumValue("//root/Info/GuestProfile", ref profile.GuestProfile); @@ -377,7 +377,7 @@ namespace Vocaluxe.Base _Profiles.Add(profile); } else - CLog.LogError("Can't find PlayerName in Profile File: " + FileName); + CLog.LogError("Can't find PlayerName in Profile File: " + fileName); } #endregion private methods } diff --git a/Vocaluxe/Base/CSettings.cs b/Vocaluxe/Base/CSettings.cs index e14e704c..47a957ac 100644 --- a/Vocaluxe/Base/CSettings.cs +++ b/Vocaluxe/Base/CSettings.cs @@ -13,85 +13,79 @@ namespace Vocaluxe.Base Release } - enum EArch - { - x86, - x64 - } - static class CSettings { #if ARCH_X86 - public const EArch ARCH = EArch.x86; + public const String Arch = "x86"; #endif #if ARCH_X64 - public const EArch ARCH = EArch.x64; + public const String Arch = "x64"; #endif public static EGameState GameState = EGameState.Start; - public const string sProgramName = "Vocaluxe"; - public const string sProgramCodeName = "Shining Heaven"; + public const string ProgramName = "Vocaluxe"; + public const string ProgramCodeName = "Shining Heaven"; - public const int iVersionMajor = 0; - public const int iVersionMinor = 3; // milestones - public const int iVersionSub = 0; // patches + public const int VersionMajor = 0; + public const int VersionMinor = 3; // milestones + public const int VersionSub = 0; // patches public const ERevision VersionRevision = ERevision.Alpha; - public const int iBuild = 77; // Increase on every published version! Never Reset! + public const int Build = 77; // Increase on every published version! Never Reset! - public const int iDatabaseHighscoreVersion = 2; - public const int iDatabaseCoverVersion = 1; - public const int iDatabaseCreditsRessourcesVersion = 1; + public const int DatabaseHighscoreVersion = 2; + public const int DatabaseCoverVersion = 1; + public const int DatabaseCreditsRessourcesVersion = 1; - public static int iRenderW = 1280; - public static int iRenderH = 720; + public static int RenderW = 1280; + public static int RenderH = 720; public const int ZNear = -100; public const int ZFar = 100; public static bool IsFullScreen = false; - public static int iVertexBufferElements = 10000; + public static int VertexBufferElements = 10000; - public const string sIcon = "Vocaluxe.ico"; - public const string sLogo = "Logo.png"; + public const string Icon = "Vocaluxe.ico"; + public const string Logo = "Logo.png"; public const string FallbackLanguage = "English"; - public const string sBassRegistration = "Registration.xml"; - public static string sFileConfig = "Config.xml"; - public const string sFileCover = "Cover.xml"; - public const string sFileFonts = "Fonts.xml"; + public const string BassRegistration = "Registration.xml"; + public static string FileConfig = "Config.xml"; + public const string FileCover = "Cover.xml"; + public const string FileFonts = "Fonts.xml"; - public const string sFileOldHighscoreDB = "Ultrastar.db"; - public static string sFileHighscoreDB = "HighscoreDB.sqlite"; - public const string sFileCoverDB = "CoverDB.sqlite"; - public const string sFileCreditsRessourcesDB = "CreditsRessourcesDB.sqlite"; - public const string sFilePerformanceLog = "Performance.log"; - public const string sFileErrorLog = "Error.log"; - public const string sFileBenchmarkLog = "Benchmark.log"; + public const string FileOldHighscoreDB = "Ultrastar.db"; + public static string FileHighscoreDB = "HighscoreDB.sqlite"; + public const string FileCoverDB = "CoverDB.sqlite"; + public const string FileCreditsRessourcesDB = "CreditsRessourcesDB.sqlite"; + public const string FilePerformanceLog = "Performance.log"; + public const string FileErrorLog = "Error.log"; + public const string FileBenchmarkLog = "Benchmark.log"; - public const string sSoundT440 = "440Hz.mp3"; + public const string SoundT440 = "440Hz.mp3"; - public const string sFolderCover = "Cover"; - public const string sFolderGraphics = "Graphics"; - public const string sFolderFonts = "Fonts"; - public const string sFolderThemes = "Themes"; - public const string sFolderSkins = "Skins"; - public const string sFolderThemeFonts = "Fonts"; - public const string sFolderScreens = "Screens"; - public static string sFolderProfiles = "Profiles"; - public const string sFolderSongs = "Songs"; - public const string sFolderSounds = "Sounds"; - public const string sFolderLanguages = "Languages"; - public const string sFolderScreenshots = "Screenshots"; - public const string sFolderBackgroundMusic = "BackgroundMusic"; - public static string sFolderPlaylists = "Playlists"; + public const string FolderCover = "Cover"; + public const string FolderGraphics = "Graphics"; + public const string FolderFonts = "Fonts"; + public const string FolderThemes = "Themes"; + public const string FolderSkins = "Skins"; + public const string FolderThemeFonts = "Fonts"; + public const string FolderScreens = "Screens"; + public static string FolderProfiles = "Profiles"; + public const string FolderSongs = "Songs"; + public const string FolderSounds = "Sounds"; + public const string FolderLanguages = "Languages"; + public const string FolderScreenshots = "Screenshots"; + public const string FolderBackgroundMusic = "BackgroundMusic"; + public static string FolderPlaylists = "Playlists"; - public const string sFolderPartyModes = "PartyModes"; - public const string sFolderPartyModeCode = "Code"; - public const string sFolderPartyModeScreens = "Screens"; - public const string sFolderPartyModeLanguages = "Languages"; - public const string sFolderPartyModeFonts = "Fonts"; + public const string FolderPartyModes = "PartyModes"; + public const string FolderPartyModeCode = "Code"; + public const string FolderPartyModeScreens = "Screens"; + public const string FolderPartyModeLanguages = "Languages"; + public const string FolderPartyModeFonts = "Fonts"; //public const String[] ToneStrings = new String[]{ "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B" }; public const int ToneMin = -36; @@ -129,39 +123,39 @@ namespace Vocaluxe.Base public static string GetVersionText() { - string sVersion = "v" + iVersionMajor.ToString() + "." + - iVersionMinor.ToString() + "." + - iVersionSub.ToString() + " (" + Enum.GetName(typeof(EArch), ARCH) + ")"; + string version = "v" + VersionMajor.ToString() + "." + + VersionMinor.ToString() + "." + + VersionSub.ToString() + " (" + Arch + ")"; if (VersionRevision != ERevision.Release) - sVersion += " " + GetVersionStatus() + String.Format(" ({0:0000)}", iBuild); + version += " " + GetVersionStatus() + String.Format(" ({0:0000)}", Build); - return sVersion; + return version; } public static string GetFullVersionText() { - string sVersion = sProgramName; + string version = ProgramName; - if (sProgramCodeName.Length > 0) - sVersion += " \"" + sProgramCodeName + "\""; + if (ProgramCodeName.Length > 0) + version += " \"" + ProgramCodeName + "\""; - return sVersion += " " + GetVersionText(); + return version + " " + GetVersionText(); } public static string GetVersionStatus() { - string _Result = String.Empty; + string result = String.Empty; if (VersionRevision != ERevision.Release) - _Result = Enum.GetName(typeof(ERevision), VersionRevision); + result = Enum.GetName(typeof(ERevision), VersionRevision); - return _Result; + return result; } public static float GetRenderAspect() { - return iRenderW / (float)iRenderH; + return RenderW / (float)RenderH; } public static void MouseInactive() @@ -176,18 +170,18 @@ namespace Vocaluxe.Base public static void CreateFolders() { - List Folders = new List(); + List folders = new List(); - Folders.Add(sFolderCover); - Folders.Add(sFolderFonts); - Folders.Add(sFolderProfiles); - Folders.Add(sFolderSongs); - Folders.Add(sFolderScreenshots); - Folders.Add(sFolderBackgroundMusic); - Folders.Add(sFolderSounds); - Folders.Add(sFolderPlaylists); + folders.Add(FolderCover); + folders.Add(FolderFonts); + folders.Add(FolderProfiles); + folders.Add(FolderSongs); + folders.Add(FolderScreenshots); + folders.Add(FolderBackgroundMusic); + folders.Add(FolderSounds); + folders.Add(FolderPlaylists); - foreach (string folder in Folders) + foreach (string folder in folders) { string path = Path.Combine(Environment.CurrentDirectory, folder); CreateFolder(path); diff --git a/Vocaluxe/Base/CSongCategorizer.cs b/Vocaluxe/Base/CSongCategorizer.cs index 8ac25804..c51ab696 100644 --- a/Vocaluxe/Base/CSongCategorizer.cs +++ b/Vocaluxe/Base/CSongCategorizer.cs @@ -13,7 +13,7 @@ namespace Vocaluxe.Base public CSongCategorizer() { - CSongs.Filter.ObjectChanged += HandleSortedSongsChanged; + CSongs.Filter.ObjectChanged += _HandleSortedSongsChanged; } public List Categories @@ -38,7 +38,7 @@ namespace Vocaluxe.Base } } - private void HandleSortedSongsChanged(object sender, EventArgs args) + private void _HandleSortedSongsChanged(object sender, EventArgs args) { _SetChanged(); } @@ -46,7 +46,7 @@ namespace Vocaluxe.Base private void _CreateCategoriesLetter() { string category = ""; - int NotLetterCat = -1; + int notLetterCat = -1; for (int i = 0; i < CSongs.Sorter.SortedSongs.Length; i++) { Char firstLetter = Char.ToUpper(CSongs.Sorter.SortedSongs[i].SortString.Normalize(NormalizationForm.FormD)[0]); @@ -55,7 +55,7 @@ namespace Vocaluxe.Base firstLetter = '#'; if (firstLetter.ToString() != category) { - if (firstLetter != '#' || NotLetterCat == -1) + if (firstLetter != '#' || notLetterCat == -1) { category = firstLetter.ToString(); _Categories.Add(new CCategory(category)); @@ -63,20 +63,20 @@ namespace Vocaluxe.Base CSongs.Sorter.SortedSongs[i].CatIndex = _Categories.Count - 1; if (firstLetter == '#') - NotLetterCat = CSongs.Sorter.SortedSongs[i].CatIndex; + notLetterCat = CSongs.Sorter.SortedSongs[i].CatIndex; } else - CSongs.Sorter.SortedSongs[i].CatIndex = NotLetterCat; + CSongs.Sorter.SortedSongs[i].CatIndex = notLetterCat; } else CSongs.Sorter.SortedSongs[i].CatIndex = _Categories.Count - 1; } } - private void _CreateCategoriesNormal(string NoCategoryName) + private void _CreateCategoriesNormal(string noCategoryName) { string category = ""; - int NoCategoryIndex = -1; + int noCategoryIndex = -1; for (int i = 0; i < CSongs.Sorter.SortedSongs.Length; i++) { if (CSongs.Sorter.SortedSongs[i].SortString.Length > 0) @@ -90,59 +90,59 @@ namespace Vocaluxe.Base } else { - if (NoCategoryIndex < 0) + if (noCategoryIndex < 0) { - category = NoCategoryName; + category = noCategoryName; _Categories.Add(new CCategory(category)); - NoCategoryIndex = _Categories.Count - 1; + noCategoryIndex = _Categories.Count - 1; } - CSongs.Sorter.SortedSongs[i].CatIndex = NoCategoryIndex; + CSongs.Sorter.SortedSongs[i].CatIndex = noCategoryIndex; } } } private void _CreateCategories() { - string NoCategoryName = ""; + string noCategoryName = ""; - ESongSorting Sorting = CSongs.Sorter.SongSorting; + ESongSorting sorting = CSongs.Sorter.SongSorting; - switch (Sorting) + switch (sorting) { case ESongSorting.TR_CONFIG_EDITION: - NoCategoryName = CLanguage.Translate("TR_SCREENSONG_NOEDITION"); + noCategoryName = CLanguage.Translate("TR_SCREENSONG_NOEDITION"); break; case ESongSorting.TR_CONFIG_GENRE: - NoCategoryName = CLanguage.Translate("TR_SCREENSONG_NOGENRE"); + noCategoryName = CLanguage.Translate("TR_SCREENSONG_NOGENRE"); break; case ESongSorting.TR_CONFIG_DECADE: case ESongSorting.TR_CONFIG_YEAR: - NoCategoryName = CLanguage.Translate("TR_SCREENSONG_NOYEAR"); + noCategoryName = CLanguage.Translate("TR_SCREENSONG_NOYEAR"); break; case ESongSorting.TR_CONFIG_LANGUAGE: - NoCategoryName = CLanguage.Translate("TR_SCREENSONG_NOLANGUAGE"); + noCategoryName = CLanguage.Translate("TR_SCREENSONG_NOLANGUAGE"); break; case ESongSorting.TR_CONFIG_NONE: - NoCategoryName = CLanguage.Translate("TR_SCREENSONG_ALLSONGS"); + noCategoryName = CLanguage.Translate("TR_SCREENSONG_ALLSONGS"); break; } - if (Sorting == ESongSorting.TR_CONFIG_ARTIST_LETTER || Sorting == ESongSorting.TR_CONFIG_TITLE_LETTER) + if (sorting == ESongSorting.TR_CONFIG_ARTIST_LETTER || sorting == ESongSorting.TR_CONFIG_TITLE_LETTER) _CreateCategoriesLetter(); else { - if (Sorting == ESongSorting.TR_CONFIG_DECADE) + if (sorting == ESongSorting.TR_CONFIG_DECADE) { for (int i = 0; i < CSongs.Sorter.SortedSongs.Length; i++) { - string Year = CSongs.Sorter.SortedSongs[i].SortString; - if (Year.Length > 0) + string year = CSongs.Sorter.SortedSongs[i].SortString; + if (year.Length > 0) { - Year = Year.Substring(0, 3); - CSongs.Sorter.SortedSongs[i].SortString = Year + "0 - " + Year + "9"; + year = year.Substring(0, 3); + CSongs.Sorter.SortedSongs[i].SortString = year + "0 - " + year + "9"; } } } - _CreateCategoriesNormal(NoCategoryName); + _CreateCategoriesNormal(noCategoryName); } } diff --git a/Vocaluxe/Base/CSongSorter.cs b/Vocaluxe/Base/CSongSorter.cs index 6687b79d..ec5a486b 100644 --- a/Vocaluxe/Base/CSongSorter.cs +++ b/Vocaluxe/Base/CSongSorter.cs @@ -8,16 +8,16 @@ namespace Vocaluxe.Base { class CSongSorter : CObservable { - private SongPointer[] _SortedSongs = new SongPointer[0]; + private SSongPointer[] _SortedSongs = new SSongPointer[0]; private EOffOn _IgnoreArticles = CConfig.IgnoreArticles; private ESongSorting _SongSorting = CConfig.SongSorting; public CSongSorter() { - CSongs.Filter.ObjectChanged += HandleFilteredSongsChanged; + CSongs.Filter.ObjectChanged += _HandleFilteredSongsChanged; } - public SongPointer[] SortedSongs + public SSongPointer[] SortedSongs { get { @@ -62,12 +62,12 @@ namespace Vocaluxe.Base } } - private void HandleFilteredSongsChanged(object sender, EventArgs args) + private void _HandleFilteredSongsChanged(object sender, EventArgs args) { _SetChanged(); } - private int _SortByFieldArtistTitle(SongPointer s1, SongPointer s2) + private int _SortByFieldArtistTitle(SSongPointer s1, SSongPointer s2) { int res = s1.SortString.ToUpper().CompareTo(s2.SortString.ToUpper()); if (res == 0) @@ -90,7 +90,7 @@ namespace Vocaluxe.Base return res; } - private int _SortByFieldTitle(SongPointer s1, SongPointer s2) + private int _SortByFieldTitle(SSongPointer s1, SSongPointer s2) { int res = s1.SortString.ToUpper().CompareTo(s2.SortString.ToUpper()); if (res == 0) @@ -103,13 +103,13 @@ namespace Vocaluxe.Base return res; } - private List _CreateSortList(string fieldName) + private List _CreateSortList(string fieldName) { FieldInfo field = null; bool isString = false; - List SortList = new List(); + List sortList = new List(); if (fieldName.Length == 0) - CSongs.Filter.FilteredSongs.ForEach((song) => SortList.Add(new SongPointer(song.ID, ""))); + CSongs.Filter.FilteredSongs.ForEach((song) => sortList.Add(new SSongPointer(song.ID, ""))); else { field = typeof(CSong).GetField(fieldName, BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.Public); @@ -120,21 +120,21 @@ namespace Vocaluxe.Base { object value = field.GetValue(song); if (isString) - SortList.Add(new SongPointer(song.ID, (String)value)); + sortList.Add(new SSongPointer(song.ID, (String)value)); else { List values = (List)value; if (values.Count == 0) - SortList.Add(new SongPointer(song.ID, "")); + sortList.Add(new SSongPointer(song.ID, "")); else { foreach (String sortString in (List)value) - SortList.Add(new SongPointer(song.ID, sortString)); + sortList.Add(new SSongPointer(song.ID, sortString)); } } } } - return SortList; + return sortList; } private void _SortSongs() @@ -177,19 +177,19 @@ namespace Vocaluxe.Base fieldName = ""; break; } - List SortList = _CreateSortList(fieldName); + List sortList = _CreateSortList(fieldName); switch (_SongSorting) { case ESongSorting.TR_CONFIG_ARTIST_LETTER: case ESongSorting.TR_CONFIG_ARTIST: case ESongSorting.TR_CONFIG_NONE: - SortList.Sort(_SortByFieldTitle); + sortList.Sort(_SortByFieldTitle); break; default: - SortList.Sort(_SortByFieldArtistTitle); + sortList.Sort(_SortByFieldArtistTitle); break; } - _SortedSongs = SortList.ToArray(); + _SortedSongs = sortList.ToArray(); _Changed = false; } } diff --git a/Vocaluxe/Base/CSongs.cs b/Vocaluxe/Base/CSongs.cs index 53e30bba..20cf4335 100644 --- a/Vocaluxe/Base/CSongs.cs +++ b/Vocaluxe/Base/CSongs.cs @@ -8,7 +8,7 @@ using VocaluxeLib.Menu.SongMenu; namespace Vocaluxe.Base { - public struct SongPointer + public struct SSongPointer { public int SongID; public string SortString; @@ -17,9 +17,9 @@ namespace Vocaluxe.Base public bool Visible; public bool PartyHidden; - public SongPointer(int ID, string sortString) + public SSongPointer(int iD, string sortString) { - SongID = ID; + SongID = iD; SortString = sortString; CatIndex = -1; Visible = false; @@ -75,13 +75,13 @@ namespace Vocaluxe.Base { get { - int Result = 0; - foreach (SongPointer sp in Sorter.SortedSongs) + int result = 0; + foreach (SSongPointer sp in Sorter.SortedSongs) { if (sp.Visible) - Result++; + result++; } - return Result; + return result; } } @@ -113,17 +113,17 @@ namespace Vocaluxe.Base /// /// Returns the number of song in the category specified with CatIndex /// - /// Category index + /// Category index /// - public static int NumSongsInCategory(int CatIndex) + public static int NumSongsInCategory(int catIndex) { - if (Categorizer.Categories.Count <= CatIndex || CatIndex < 0) + 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) + if (Sorter.SortedSongs[i].CatIndex == catIndex && !Sorter.SortedSongs[i].PartyHidden) num++; } return num; @@ -145,14 +145,14 @@ namespace Vocaluxe.Base Category--; } - public static int GetNextSongWithoutCover(ref CSong Song) + public static int GetNextSongWithoutCover(ref CSong song) { if (!SongsLoaded) return -1; if (_CoverLoadIndex < _Songs.Count) { - Song = _Songs[_CoverLoadIndex]; + song = _Songs[_CoverLoadIndex]; _CoverLoadIndex++; return _CoverLoadIndex; } @@ -165,22 +165,22 @@ namespace Vocaluxe.Base get { return _CoverLoadIndex; } } - public static void SetCoverSmall(int SongIndex, STexture Texture) + public static void SetCoverSmall(int songIndex, STexture texture) { if (!_SongsLoaded) return; - if (SongIndex < _Songs.Count) - _Songs[SongIndex].CoverTextureSmall = Texture; + if (songIndex < _Songs.Count) + _Songs[songIndex].CoverTextureSmall = texture; } - public static void SetCoverBig(int SongIndex, STexture Texture) + public static void SetCoverBig(int songIndex, STexture texture) { if (!_SongsLoaded) return; - if (SongIndex < _Songs.Count) - _Songs[SongIndex].CoverTextureBig = Texture; + if (songIndex < _Songs.Count) + _Songs[songIndex].CoverTextureBig = texture; } public static string GetCurrentCategoryName() @@ -191,22 +191,22 @@ namespace Vocaluxe.Base return String.Empty; } - public static CSong GetSong(int SongID) + public static CSong GetSong(int songID) { foreach (CSong song in _Songs) { - if (song.ID == SongID) + if (song.ID == songID) return song; } return null; } - public static void AddPartySongSung(int SongID) + public static void AddPartySongSung(int songID) { int cat = -1; for (int i = 0; i < Sorter.SortedSongs.Length; i++) { - if (SongID == Sorter.SortedSongs[i].SongID) + if (songID == Sorter.SortedSongs[i].SongID) { Sorter.SortedSongs[i].PartyHidden = true; Sorter.SortedSongs[i].Visible = false; @@ -231,11 +231,11 @@ namespace Vocaluxe.Base } } - public static void ResetPartySongSung(int CatIndex) + public static void ResetPartySongSung(int catIndex) { for (int i = 0; i < Sorter.SortedSongs.Length; i++) { - if (Sorter.SortedSongs[i].CatIndex == 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; @@ -243,13 +243,13 @@ namespace Vocaluxe.Base } } - public static int GetVisibleSongNumber(int SongID) + public static int GetVisibleSongNumber(int songID) { int i = -1; foreach (CSong song in VisibleSongs) { i++; - if (song.ID == SongID) + if (song.ID == songID) return i; } return i; @@ -284,7 +284,7 @@ namespace Vocaluxe.Base CCategory category = _CategoriesForRandom[CGame.Rand.Next(0, _CategoriesForRandom.Count - 1)]; _CategoriesForRandom.Remove(category); - return GetCategoryNumber(category); + return _GetCategoryNumber(category); } public static void UpdateRandomCategoryList() @@ -293,7 +293,7 @@ namespace Vocaluxe.Base _CategoriesForRandom.AddRange(Categories); } - private static int GetCategoryNumber(CCategory category) + private static int _GetCategoryNumber(CCategory category) { for (int i = 0; i < Categories.Length; i++) { @@ -313,7 +313,7 @@ namespace Vocaluxe.Base get { List songs = new List(); - foreach (SongPointer sp in Sorter.SortedSongs) + foreach (SSongPointer sp in Sorter.SortedSongs) { if (sp.Visible) songs.Add(_Songs[sp.SongID]); @@ -327,7 +327,7 @@ namespace Vocaluxe.Base get { List songs = new List(); - foreach (SongPointer sp in Sorter.SortedSongs) + foreach (SSongPointer sp in Sorter.SortedSongs) { if (sp.Visible) songs.Add(_Songs[sp.SongID]); @@ -346,7 +346,7 @@ namespace Vocaluxe.Base if (index < 0) return null; - foreach (SongPointer sp in Sorter.SortedSongs) + foreach (SSongPointer sp in Sorter.SortedSongs) { if (sp.Visible) { @@ -358,17 +358,17 @@ namespace Vocaluxe.Base return null; } - private static void HandleCategoriesChanged(object sender, EventArgs args) + private static void _HandleCategoriesChanged(object sender, EventArgs args) { _CategoriesForRandom.Clear(); Category = _CatIndex; } - public static void Sort(ESongSorting Sorting, EOffOn Tabs, EOffOn IgnoreArticles, String SearchString, EDuetOptions DuetOptions) + public static void Sort(ESongSorting sorting, EOffOn tabs, EOffOn ignoreArticles, String searchString, EDuetOptions duetOptions) { - Filter.SetOptions(SearchString, DuetOptions); - Sorter.SetOptions(Sorting, IgnoreArticles); - Categorizer.Tabs = Tabs; + Filter.SetOptions(searchString, duetOptions); + Sorter.SetOptions(sorting, ignoreArticles); + Categorizer.Tabs = tabs; } public static void LoadSongs() @@ -390,12 +390,12 @@ namespace Vocaluxe.Base CLog.StartBenchmark(2, "Read TXTs"); foreach (string file in files) { - CSong Song = CSong.LoadSong(file); - if (Song != null) + CSong song = CSong.LoadSong(file); + if (song != null) { - Song.ID = _Songs.Count; - _Songs.Add(Song); - Song.ReadNotes(); + song.ID = _Songs.Count; + _Songs.Add(song); + song.ReadNotes(); } } CLog.StopBenchmark(2, "Read TXTs"); @@ -404,7 +404,7 @@ namespace Vocaluxe.Base Sorter.SongSorting = CConfig.SongSorting; Sorter.IgnoreArticles = CConfig.IgnoreArticles; Categorizer.Tabs = CConfig.Tabs; - Categorizer.ObjectChanged += HandleCategoriesChanged; + Categorizer.ObjectChanged += _HandleCategoriesChanged; CLog.StopBenchmark(2, "Sort Songs"); Category = -1; _SongsLoaded = true; diff --git a/Vocaluxe/Base/CSound.cs b/Vocaluxe/Base/CSound.cs index c4ea483a..2f5bf1cb 100644 --- a/Vocaluxe/Base/CSound.cs +++ b/Vocaluxe/Base/CSound.cs @@ -39,9 +39,9 @@ namespace Vocaluxe.Base return true; } - public static void SetGlobalVolume(float Volume) + public static void SetGlobalVolume(float volume) { - _Playback.SetGlobalVolume(Volume); + _Playback.SetGlobalVolume(volume); } public static int GetStreamCount() @@ -55,89 +55,89 @@ namespace Vocaluxe.Base } #region Stream Handling - public static int Load(string Media) + public static int Load(string media) { - return _Playback.Load(Media); + return _Playback.Load(media); } - public static int Load(string Media, bool Prescan) + public static int Load(string media, bool prescan) { - return _Playback.Load(Media, Prescan); + return _Playback.Load(media, prescan); } - public static void Close(int Stream) + public static void Close(int stream) { - _Playback.Close(Stream); + _Playback.Close(stream); } - public static void Play(int Stream) + public static void Play(int stream) { - _Playback.Play(Stream); + _Playback.Play(stream); } - public static void Play(int Stream, bool Loop) + public static void Play(int stream, bool loop) { - _Playback.Play(Stream, Loop); + _Playback.Play(stream, loop); } - public static void Pause(int Stream) + public static void Pause(int stream) { - _Playback.Pause(Stream); + _Playback.Pause(stream); } - public static void Stop(int Stream) + public static void Stop(int stream) { - _Playback.Stop(Stream); + _Playback.Stop(stream); } - public static void Fade(int Stream, float TargetVolume, float Seconds) + public static void Fade(int stream, float targetVolume, float seconds) { - _Playback.Fade(Stream, TargetVolume, Seconds); + _Playback.Fade(stream, targetVolume, seconds); } - public static void FadeAndPause(int Stream, float TargetVolume, float Seconds) + public static void FadeAndPause(int stream, float targetVolume, float seconds) { - _Playback.FadeAndPause(Stream, TargetVolume, Seconds); + _Playback.FadeAndPause(stream, targetVolume, seconds); } - public static void FadeAndStop(int Stream, float TargetVolume, float Seconds) + public static void FadeAndStop(int stream, float targetVolume, float seconds) { - _Playback.FadeAndStop(Stream, TargetVolume, Seconds); + _Playback.FadeAndStop(stream, targetVolume, seconds); } - public static void SetStreamVolume(int Stream, float Volume) + public static void SetStreamVolume(int stream, float volume) { - _Playback.SetStreamVolume(Stream, Volume); + _Playback.SetStreamVolume(stream, volume); } - public static void SetStreamVolumeMax(int Stream, float Volume) + public static void SetStreamVolumeMax(int stream, float volume) { - _Playback.SetStreamVolumeMax(Stream, Volume); + _Playback.SetStreamVolumeMax(stream, volume); } - public static float GetLength(int Stream) + public static float GetLength(int stream) { - return _Playback.GetLength(Stream); + return _Playback.GetLength(stream); } - public static float GetPosition(int Stream) + public static float GetPosition(int stream) { - return _Playback.GetPosition(Stream); + return _Playback.GetPosition(stream); } - public static bool IsPlaying(int Stream) + public static bool IsPlaying(int stream) { - return _Playback.IsPlaying(Stream); + return _Playback.IsPlaying(stream); } - public static bool IsPaused(int Stream) + public static bool IsPaused(int stream) { - return _Playback.IsPaused(Stream); + return _Playback.IsPaused(stream); } - public static bool IsFinished(int Stream) + public static bool IsFinished(int stream) { - return _Playback.IsFinished(Stream); + return _Playback.IsFinished(stream); } public static void Update() @@ -145,22 +145,22 @@ namespace Vocaluxe.Base _Playback.Update(); } - public static void SetPosition(int Stream, float Position) + public static void SetPosition(int stream, float position) { - _Playback.SetPosition(Stream, Position); + _Playback.SetPosition(stream, position); } #endregion Stream Handling #endregion Playback #region Sounds - public static int PlaySound(ESounds Sound) + public static int PlaySound(ESounds sound) { - string file = Path.Combine(Environment.CurrentDirectory, CSettings.sFolderSounds); - switch (Sound) + string file = Path.Combine(Environment.CurrentDirectory, CSettings.FolderSounds); + switch (sound) { case ESounds.T440: - file = Path.Combine(file, CSettings.sSoundT440); + file = Path.Combine(file, CSettings.SoundT440); break; } @@ -217,44 +217,44 @@ namespace Vocaluxe.Base return _Record.Stop(); } - public static void AnalyzeBuffer(int Player) + public static void AnalyzeBuffer(int player) { - _Record.AnalyzeBuffer(Player); + _Record.AnalyzeBuffer(player); } - public static int RecordGetToneAbs(int Player) + public static int RecordGetToneAbs(int player) { - return _Record.GetToneAbs(Player); + return _Record.GetToneAbs(player); } - public static int RecordGetTone(int Player) + public static int RecordGetTone(int player) { - return _Record.GetTone(Player); + return _Record.GetTone(player); } - public static void RecordSetTone(int Player, int Tone) + public static void RecordSetTone(int player, int tone) { - _Record.SetTone(Player, Tone); + _Record.SetTone(player, tone); } - public static bool RecordToneValid(int Player) + public static bool RecordToneValid(int player) { - return _Record.ToneValid(Player); + return _Record.ToneValid(player); } - public static float RecordGetMaxVolume(int Player) + public static float RecordGetMaxVolume(int player) { - return _Record.GetMaxVolume(Player); + return _Record.GetMaxVolume(player); } - public static int NumHalfTones(int Player) + public static int NumHalfTones(int player) { - return _Record.NumHalfTones(Player); + return _Record.NumHalfTones(player); } - public static float[] ToneWeigth(int Player) + public static float[] ToneWeigth(int player) { - return _Record.ToneWeigth(Player); + return _Record.ToneWeigth(player); } public static SRecordDevice[] RecordGetDevices() @@ -269,8 +269,8 @@ namespace Vocaluxe.Base { SInput input = devices[dev].Inputs[inp]; - input.PlayerChannel1 = GetPlayerFromMicConfig(devices[dev].Name, devices[dev].Driver, input.Name, 1); - input.PlayerChannel2 = GetPlayerFromMicConfig(devices[dev].Name, devices[dev].Driver, input.Name, 2); + input.PlayerChannel1 = _GetPlayerFromMicConfig(devices[dev].Name, devices[dev].Driver, input.Name, 1); + input.PlayerChannel2 = _GetPlayerFromMicConfig(devices[dev].Name, devices[dev].Driver, input.Name, 2); devices[dev].Inputs[inp] = input; } @@ -281,7 +281,7 @@ namespace Vocaluxe.Base return null; } - private static int GetPlayerFromMicConfig(string device, string devicedriver, string input, int channel) + private static int _GetPlayerFromMicConfig(string device, string devicedriver, string input, int channel) { for (int p = 0; p < CSettings.MaxNumPlayer; p++) { @@ -462,83 +462,83 @@ namespace Vocaluxe.Base _MaxVolume = 0; for (int i = 0; i < _AnalysisBuffer.Length / 4; i++) { - float Volume = Math.Abs((float)_AnalysisBuffer[i]) / Int16.MaxValue; - if (Volume > MaxVolume) - _MaxVolume = Volume; + float volume = Math.Abs((float)_AnalysisBuffer[i]) / Int16.MaxValue; + if (volume > MaxVolume) + _MaxVolume = volume; } if (_MaxVolume >= 0.02f) - AnalyzeByAutocorrelation(true); + _AnalyzeByAutocorrelation(true); else - AnalyzeByAutocorrelation(false); + _AnalyzeByAutocorrelation(false); } catch (Exception) {} } - private void AnalyzeByAutocorrelation(bool valid) + private void _AnalyzeByAutocorrelation(bool valid) { - const double HalftoneBase = 1.05946309436; // 2^(1/12) -> HalftoneBase^12 = 2 (one octave) + const double halftoneBase = 1.05946309436; // 2^(1/12) -> HalftoneBase^12 = 2 (one octave) // prepare to analyze - double MaxWeight = -1.0; - double MinWeight = 1.0; - int MaxTone = -1; - float[] Weigth = new float[_NumHalfTones]; + double maxWeight = -1.0; + double minWeight = 1.0; + int maxTone = -1; + float[] weigth = new float[_NumHalfTones]; // analyze halftones // Note: at the lowest tone (~65Hz) and a buffer-size of 4096 // at 44.1 (or 48kHz) only 6 (or 5) samples are compared, this might be // too few samples -> use a bigger buffer-size - for (int ToneIndex = 0; ToneIndex < _NumHalfTones; ToneIndex++) + for (int toneIndex = 0; toneIndex < _NumHalfTones; toneIndex++) { - double CurFreq = _BaseToneFreq * Math.Pow(HalftoneBase, ToneIndex); - double CurWeight = AnalyzeAutocorrelationFreq(CurFreq); + double curFreq = _BaseToneFreq * Math.Pow(halftoneBase, toneIndex); + double curWeight = _AnalyzeAutocorrelationFreq(curFreq); - if (CurWeight > MaxWeight) + if (curWeight > maxWeight) { - MaxWeight = CurWeight; - MaxTone = ToneIndex; + maxWeight = curWeight; + maxTone = toneIndex; } - if (CurWeight < MinWeight) - MinWeight = CurWeight; + if (curWeight < minWeight) + minWeight = curWeight; - Weigth[ToneIndex] = (float)CurWeight; + weigth[toneIndex] = (float)curWeight; } - if (valid && MaxWeight - MinWeight > 0.01) + if (valid && maxWeight - minWeight > 0.01) { - for (int i = 0; i < Weigth.Length; i++) - _ToneWeigth[i] = Weigth[i]; + for (int i = 0; i < weigth.Length; i++) + _ToneWeigth[i] = weigth[i]; - _ToneAbs = MaxTone; - _Tone = MaxTone % 12; + _ToneAbs = maxTone; + _Tone = maxTone % 12; _ToneValid = true; } else _ToneValid = false; } - private double AnalyzeAutocorrelationFreq(double Freq) + private double _AnalyzeAutocorrelationFreq(double freq) { - int SampleIndex = 0; // index of sample to analyze - int SamplesPerPeriod = (int)Math.Round(44100.0 / Freq); // samples in one period - int CorrelatingSampleIndex = SampleIndex + SamplesPerPeriod; // index of sample one period ahead + int sampleIndex = 0; // index of sample to analyze + int samplesPerPeriod = (int)Math.Round(44100.0 / freq); // samples in one period + int correlatingSampleIndex = sampleIndex + samplesPerPeriod; // index of sample one period ahead - double AccumDist = 0.0; // accumulated distances + double accumDist = 0.0; // accumulated distances // compare correlating samples - while (CorrelatingSampleIndex < _AnalysisBuffer.Length) + while (correlatingSampleIndex < _AnalysisBuffer.Length) { // calc distance (correlation: 1-dist) to corresponding sample in next period // distance (0=equal .. 1=totally different) between correlated samples - double Dist = Math.Abs((double)_AnalysisBuffer[SampleIndex] - _AnalysisBuffer[CorrelatingSampleIndex]) / Int16.MaxValue; - AccumDist += Dist; - SampleIndex++; - CorrelatingSampleIndex++; + double dist = Math.Abs((double)_AnalysisBuffer[sampleIndex] - _AnalysisBuffer[correlatingSampleIndex]) / Int16.MaxValue; + accumDist += dist; + sampleIndex++; + correlatingSampleIndex++; } - return 1 - AccumDist / _AnalysisBuffer.Length; + return 1 - accumDist / _AnalysisBuffer.Length; } public void Dispose() @@ -554,7 +554,7 @@ namespace Vocaluxe.Base class CSyncTimer { - private readonly PT1 _ExternTime; + private readonly CPt1 _ExternTime; private readonly Stopwatch _Timer; private float _SetValue; @@ -581,16 +581,16 @@ namespace Vocaluxe.Base } } - public CSyncTimer(float CurrentTime, float K, float T) + public CSyncTimer(float currentTime, float k, float t) { - _ExternTime = new PT1(CurrentTime, K, T); + _ExternTime = new CPt1(currentTime, k, t); _Timer = new Stopwatch(); - _SetValue = CurrentTime; + _SetValue = currentTime; } - public float Update(float NewTime) + public float Update(float newTime) { - float et = _ExternTime.Update(NewTime); + float et = _ExternTime.Update(newTime); float dt = Time; @@ -628,7 +628,7 @@ namespace Vocaluxe.Base } } - class PT1 + class CPt1 { private float _CurrentTime; private float _OldTime; @@ -663,17 +663,17 @@ namespace Vocaluxe.Base } } - public PT1(float CurrentTime, float K, float T) + public CPt1(float currentTime, float k, float t) { - _CurrentTime = CurrentTime; - _OldTime = CurrentTime; + _CurrentTime = currentTime; + _OldTime = currentTime; _Timer = new Stopwatch(); - _K = K; - _T = T; + _K = k; + _T = t; } - public float Update(float NewTime) + public float Update(float newTime) { _Timer.Stop(); @@ -684,11 +684,11 @@ namespace Vocaluxe.Base if (Stopwatch.IsHighResolution && ticks != 0) dt = (float)(ticks * nanosecPerTick / 1000000000.0); - float Ts = 0f; + float ts = 0f; if (dt > 0) - Ts = 1 / (_T / dt + 1); + ts = 1 / (_T / dt + 1); - _CurrentTime = Ts * (_K * NewTime - _OldTime) + _OldTime; + _CurrentTime = ts * (_K * newTime - _OldTime) + _OldTime; _OldTime = _CurrentTime; _Timer.Reset(); diff --git a/Vocaluxe/Base/CTheme.cs b/Vocaluxe/Base/CTheme.cs index 97826aee..bd4ec83f 100644 --- a/Vocaluxe/Base/CTheme.cs +++ b/Vocaluxe/Base/CTheme.cs @@ -10,7 +10,7 @@ namespace Vocaluxe.Base { #region Structs - struct Theme + struct STheme { public string Name; public string Author; @@ -23,7 +23,7 @@ namespace Vocaluxe.Base public int PartyModeID; } - struct SkinElement + struct SSkinElement { public string Name; public string Value; @@ -32,7 +32,7 @@ namespace Vocaluxe.Base public int VideoIndex; } - struct Skin + struct SSkin { public string Name; public string Author; @@ -43,8 +43,8 @@ namespace Vocaluxe.Base public string FileName; public int PartyModeID; - public Dictionary SkinList; - public List VideoList; + public Dictionary SkinList; + public List VideoList; public SColors ThemeColors; } @@ -65,33 +65,33 @@ namespace Vocaluxe.Base { public string SkinName; - public float w; - public float h; + public float W; + public float H; - public float r; - public float g; - public float b; - public float a; + public float R; + public float G; + public float B; + public float A; - public string color; + public string Color; } #endregion Structs static class CTheme { // Version number for main theme and skin files. Increment it, if you've changed something on the theme files! - private const int ThemeSystemVersion = 5; - private const int SkinSystemVersion = 3; + private const int _ThemeSystemVersion = 5; + private const int _SkinSystemVersion = 3; #region Vars - private static readonly XmlWriterSettings _settings = new XmlWriterSettings(); - private static readonly List _Themes = new List(); + private static readonly XmlWriterSettings _Settings = new XmlWriterSettings(); + private static readonly List _Themes = new List(); public static string[] ThemeNames { get { List names = new List(); - foreach (Theme th in _Themes) + foreach (STheme th in _Themes) { if (th.PartyModeID == -1) names.Add(th.Name); @@ -100,13 +100,13 @@ namespace Vocaluxe.Base } } - private static readonly List _Skins = new List(); + private static readonly List _Skins = new List(); public static string[] SkinNames { get { List names = new List(); - foreach (Skin sk in _Skins) + foreach (SSkin sk in _Skins) { if (sk.PartyModeID == -1) names.Add(sk.Name); @@ -121,11 +121,11 @@ namespace Vocaluxe.Base #region Theme and Skin loading and writing public static void InitTheme() { - _settings.Indent = true; - _settings.Encoding = Encoding.UTF8; - _settings.ConformanceLevel = ConformanceLevel.Document; + _Settings.Indent = true; + _Settings.Encoding = Encoding.UTF8; + _Settings.ConformanceLevel = ConformanceLevel.Document; - ListThemes(); + _ListThemes(); ListSkins(); LoadSkins(); @@ -141,9 +141,9 @@ namespace Vocaluxe.Base } } - public static bool LoadSkin(int SkinIndex) + public static bool LoadSkin(int skinIndex) { - CXMLReader xmlReader = CXMLReader.OpenFile(Path.Combine(_Skins[SkinIndex].Path, _Skins[SkinIndex].FileName)); + CXMLReader xmlReader = CXMLReader.OpenFile(Path.Combine(_Skins[skinIndex].Path, _Skins[skinIndex].FileName)); if (xmlReader == null) return false; @@ -151,18 +151,18 @@ namespace Vocaluxe.Base // load skins/textures - List keys = new List(_Skins[SkinIndex].SkinList.Keys); + List keys = new List(_Skins[skinIndex].SkinList.Keys); foreach (string name in keys) { try { xmlReader.GetValue("//root/Skins/" + name, ref value, String.Empty); - SkinElement sk = _Skins[SkinIndex].SkinList[name]; + SSkinElement sk = _Skins[skinIndex].SkinList[name]; sk.Value = value; sk.VideoIndex = -1; - sk.Texture = CDraw.AddTexture(Path.Combine(_Skins[SkinIndex].Path, sk.Value)); - _Skins[SkinIndex].SkinList[name] = sk; + sk.Texture = CDraw.AddTexture(Path.Combine(_Skins[skinIndex].Path, sk.Value)); + _Skins[skinIndex].SkinList[name] = sk; } catch (Exception e) { @@ -173,55 +173,55 @@ namespace Vocaluxe.Base // load videos - for (int i = 0; i < _Skins[SkinIndex].VideoList.Count; i++) + for (int i = 0; i < _Skins[skinIndex].VideoList.Count; i++) { try { - xmlReader.GetValue("//root/Videos/" + _Skins[SkinIndex].VideoList[i].Name, ref value, String.Empty); - SkinElement sk = new SkinElement(); - sk.Name = _Skins[SkinIndex].VideoList[i].Name; + xmlReader.GetValue("//root/Videos/" + _Skins[skinIndex].VideoList[i].Name, ref value, String.Empty); + SSkinElement sk = new SSkinElement(); + sk.Name = _Skins[skinIndex].VideoList[i].Name; sk.Value = value; - sk.VideoIndex = CVideo.VdLoad(Path.Combine(_Skins[SkinIndex].Path, sk.Value)); + sk.VideoIndex = CVideo.VdLoad(Path.Combine(_Skins[skinIndex].Path, sk.Value)); CVideo.VdSetLoop(sk.VideoIndex, true); CVideo.VdPause(sk.VideoIndex); sk.Texture = new STexture(-1); - _Skins[SkinIndex].VideoList[i] = sk; + _Skins[skinIndex].VideoList[i] = sk; } catch (Exception e) { - MessageBox.Show("Error on loading video \"" + _Skins[SkinIndex].VideoList[i].Name + "\": " + e.Message + e.StackTrace); - CLog.LogError("Error on loading video \"" + _Skins[SkinIndex].VideoList[i].Name + "\": " + e.Message + e.StackTrace); + MessageBox.Show("Error on loading video \"" + _Skins[skinIndex].VideoList[i].Name + "\": " + e.Message + e.StackTrace); + CLog.LogError("Error on loading video \"" + _Skins[skinIndex].VideoList[i].Name + "\": " + e.Message + e.StackTrace); } } // load colors - LoadColors(xmlReader, SkinIndex); + _LoadColors(xmlReader, skinIndex); return true; } public static void UnloadSkins() { - int NumPartyModeSkins = 0; + int numPartyModeSkins = 0; for (int i = 0; i < _Skins.Count; i++) { - foreach (SkinElement sk in _Skins[i].SkinList.Values) + foreach (SSkinElement sk in _Skins[i].SkinList.Values) { - STexture Texture = sk.Texture; - CDraw.RemoveTexture(ref Texture); + STexture texture = sk.Texture; + CDraw.RemoveTexture(ref texture); } for (int j = 0; j < _Skins[i].VideoList.Count; j++) { CVideo.VdClose(_Skins[i].VideoList[j].VideoIndex); - STexture VideoTexture = _Skins[i].VideoList[j].Texture; - CDraw.RemoveTexture(ref VideoTexture); + STexture videoTexture = _Skins[i].VideoList[j].Texture; + CDraw.RemoveTexture(ref videoTexture); } if (_Skins[i].PartyModeID != -1) - NumPartyModeSkins++; + numPartyModeSkins++; } - while (_Skins.Count > NumPartyModeSkins) + while (_Skins.Count > numPartyModeSkins) { int num = _Skins.Count; for (int i = 0; i < num; i++) @@ -244,36 +244,36 @@ namespace Vocaluxe.Base } } - public static bool LoadTheme(int ThemeIndex) + public static bool LoadTheme(int themeIndex) { - if (ThemeIndex < 0 || ThemeIndex >= _Themes.Count) + if (themeIndex < 0 || themeIndex >= _Themes.Count) { - CLog.LogError("Can't find Theme Index " + ThemeIndex.ToString()); + CLog.LogError("Can't find Theme Index " + themeIndex.ToString()); return false; } - CXMLReader xmlReader = CXMLReader.OpenFile(Path.Combine(_Themes[ThemeIndex].Path, _Themes[ThemeIndex].FileName)); + CXMLReader xmlReader = CXMLReader.OpenFile(Path.Combine(_Themes[themeIndex].Path, _Themes[themeIndex].FileName)); if (xmlReader == null) return false; - int skinIndex = GetSkinIndex(_Themes[ThemeIndex].PartyModeID); + int skinIndex = GetSkinIndex(_Themes[themeIndex].PartyModeID); // Load Cursor - if (_Themes[ThemeIndex].PartyModeID == -1) - LoadCursor(xmlReader, skinIndex); + if (_Themes[themeIndex].PartyModeID == -1) + _LoadCursor(xmlReader, skinIndex); // load fonts - if (_Themes[ThemeIndex].PartyModeID == -1) + if (_Themes[themeIndex].PartyModeID == -1) { CFonts.LoadThemeFonts( - _Themes[ThemeIndex].Name, - Path.Combine(Path.Combine(_Themes[ThemeIndex].Path, _Themes[ThemeIndex].SkinFolder), CSettings.sFolderThemeFonts), + _Themes[themeIndex].Name, + Path.Combine(Path.Combine(_Themes[themeIndex].Path, _Themes[themeIndex].SkinFolder), CSettings.FolderThemeFonts), xmlReader); } else { - CFonts.LoadPartyModeFonts(_Themes[ThemeIndex].PartyModeID, - Path.Combine(_Themes[ThemeIndex].Path, CSettings.sFolderPartyModeFonts), + CFonts.LoadPartyModeFonts(_Themes[themeIndex].PartyModeID, + Path.Combine(_Themes[themeIndex].Path, CSettings.FolderPartyModeFonts), xmlReader); } return true; @@ -286,40 +286,40 @@ namespace Vocaluxe.Base for (int i = 0; i < _Themes.Count; i++) { if (_Themes[i].Name == CConfig.Theme && _Themes[i].PartyModeID == -1 || _Themes[i].PartyModeID != -1) - SaveTheme(i); + _SaveTheme(i); } } - private static void SaveTheme(int ThemeIndex) + private static void _SaveTheme(int themeIndex) { #region ThemeMainFile - using (XmlWriter writer = XmlWriter.Create(Path.Combine(_Themes[ThemeIndex].Path, _Themes[ThemeIndex].FileName), _settings)) + using (XmlWriter writer = XmlWriter.Create(Path.Combine(_Themes[themeIndex].Path, _Themes[themeIndex].FileName), _Settings)) { writer.WriteStartDocument(); writer.WriteStartElement("root"); // ThemeSystemVersion - writer.WriteElementString("ThemeSystemVersion", ThemeSystemVersion.ToString()); + writer.WriteElementString("ThemeSystemVersion", _ThemeSystemVersion.ToString()); #region Info writer.WriteStartElement("Info"); - writer.WriteElementString("Name", _Themes[ThemeIndex].Name); - writer.WriteElementString("Author", _Themes[ThemeIndex].Author); - writer.WriteElementString("SkinFolder", _Themes[ThemeIndex].SkinFolder); - writer.WriteElementString("ThemeVersionMajor", _Themes[ThemeIndex].ThemeVersionMajor.ToString()); - writer.WriteElementString("ThemeVersionMinor", _Themes[ThemeIndex].ThemeVersionMinor.ToString()); + writer.WriteElementString("Name", _Themes[themeIndex].Name); + writer.WriteElementString("Author", _Themes[themeIndex].Author); + writer.WriteElementString("SkinFolder", _Themes[themeIndex].SkinFolder); + writer.WriteElementString("ThemeVersionMajor", _Themes[themeIndex].ThemeVersionMajor.ToString()); + writer.WriteElementString("ThemeVersionMinor", _Themes[themeIndex].ThemeVersionMinor.ToString()); writer.WriteEndElement(); #endregion Info // Cursor - if (_Themes[ThemeIndex].PartyModeID == -1) - SaveCursor(writer); + if (_Themes[themeIndex].PartyModeID == -1) + _SaveCursor(writer); // save fonts - if (_Themes[ThemeIndex].PartyModeID == -1) - CFonts.SaveThemeFonts(_Themes[ThemeIndex].Name, writer); + if (_Themes[themeIndex].PartyModeID == -1) + CFonts.SaveThemeFonts(_Themes[themeIndex].Name, writer); // End of File @@ -333,34 +333,34 @@ namespace Vocaluxe.Base public static void SaveSkin() { - for (int SkinIndex = 0; SkinIndex < _Skins.Count; SkinIndex++) + for (int skinIndex = 0; skinIndex < _Skins.Count; skinIndex++) { - using (XmlWriter writer = XmlWriter.Create(Path.Combine(_Skins[SkinIndex].Path, _Skins[SkinIndex].FileName), _settings)) + using (XmlWriter writer = XmlWriter.Create(Path.Combine(_Skins[skinIndex].Path, _Skins[skinIndex].FileName), _Settings)) { writer.WriteStartDocument(); writer.WriteStartElement("root"); // ThemeSystemVersion - writer.WriteElementString("SkinSystemVersion", SkinSystemVersion.ToString()); + writer.WriteElementString("SkinSystemVersion", _SkinSystemVersion.ToString()); #region Info writer.WriteStartElement("Info"); - writer.WriteElementString("Name", _Skins[SkinIndex].Name); - writer.WriteElementString("Author", _Skins[SkinIndex].Author); - writer.WriteElementString("SkinVersionMajor", _Skins[SkinIndex].SkinVersionMajor.ToString()); - writer.WriteElementString("SkinVersionMinor", _Skins[SkinIndex].SkinVersionMinor.ToString()); + writer.WriteElementString("Name", _Skins[skinIndex].Name); + writer.WriteElementString("Author", _Skins[skinIndex].Author); + writer.WriteElementString("SkinVersionMajor", _Skins[skinIndex].SkinVersionMajor.ToString()); + writer.WriteElementString("SkinVersionMinor", _Skins[skinIndex].SkinVersionMinor.ToString()); writer.WriteEndElement(); #endregion Info // save colors - SaveColors(writer, SkinIndex); + _SaveColors(writer, skinIndex); #region Skins writer.WriteStartElement("Skins"); - foreach (SkinElement element in _Skins[SkinIndex].SkinList.Values) + foreach (SSkinElement element in _Skins[skinIndex].SkinList.Values) writer.WriteElementString(element.Name, element.Value); writer.WriteEndElement(); #endregion Skins @@ -368,7 +368,7 @@ namespace Vocaluxe.Base #region Videos writer.WriteStartElement("Videos"); - foreach (SkinElement element in _Skins[SkinIndex].VideoList) + foreach (SSkinElement element in _Skins[skinIndex].VideoList) writer.WriteElementString(element.Name, element.Value); writer.WriteEndElement(); #endregion Videos @@ -382,29 +382,29 @@ namespace Vocaluxe.Base } } - private static void ListThemes() + private static void _ListThemes() { _Themes.Clear(); - string path = Path.Combine(Directory.GetCurrentDirectory(), CSettings.sFolderThemes); + string path = Path.Combine(Directory.GetCurrentDirectory(), CSettings.FolderThemes); List files = CHelper.ListFiles(path, "*.xml", false); foreach (string file in files) AddTheme(Path.Combine(path, file), -1); } - public static bool AddTheme(string FilePath, int PartyModeID) + public static bool AddTheme(string filePath, int partyModeID) { - CXMLReader xmlReader = CXMLReader.OpenFile(FilePath); + CXMLReader xmlReader = CXMLReader.OpenFile(filePath); if (xmlReader == null) return false; - Theme theme = new Theme(); + STheme theme = new STheme(); int version = 0; xmlReader.TryGetIntValue("//root/ThemeSystemVersion", ref version); - if (version == ThemeSystemVersion) + if (version == _ThemeSystemVersion) { xmlReader.GetValue("//root/Info/Name", ref theme.Name, String.Empty); if (theme.Name.Length > 0) @@ -413,22 +413,22 @@ namespace Vocaluxe.Base xmlReader.GetValue("//root/Info/SkinFolder", ref theme.SkinFolder, String.Empty); xmlReader.TryGetIntValue("//root/Info/ThemeVersionMajor", ref theme.ThemeVersionMajor); xmlReader.TryGetIntValue("//root/Info/ThemeVersionMinor", ref theme.ThemeVersionMinor); - theme.Path = Path.GetDirectoryName(FilePath); - theme.FileName = Path.GetFileName(FilePath); - theme.PartyModeID = PartyModeID; + theme.Path = Path.GetDirectoryName(filePath); + theme.FileName = Path.GetFileName(filePath); + theme.PartyModeID = partyModeID; _Themes.Add(theme); } } else { - string msg = "Can't load Theme \"" + FilePath + "\", "; - if (version < ThemeSystemVersion) + string msg = "Can't load Theme \"" + filePath + "\", "; + if (version < _ThemeSystemVersion) msg += "the file is outdated! "; else msg += "the file is for newer program versions! "; - msg += "Current ThemeSystemVersion is " + ThemeSystemVersion.ToString() + " but found " + version; + msg += "Current ThemeSystemVersion is " + _ThemeSystemVersion.ToString() + " but found " + version; CLog.LogError(msg); } return true; @@ -447,15 +447,15 @@ namespace Vocaluxe.Base ListSkins(themeIndex); } - public static void ListSkins(int ThemeIndex) + public static void ListSkins(int themeIndex) { - if (ThemeIndex < 0 || ThemeIndex >= _Themes.Count) + if (themeIndex < 0 || themeIndex >= _Themes.Count) { - CLog.LogError("Error List Skins. Can't find Theme index: " + ThemeIndex.ToString()); + CLog.LogError("Error List Skins. Can't find Theme index: " + themeIndex.ToString()); return; } - Theme theme = _Themes[ThemeIndex]; + STheme theme = _Themes[themeIndex]; string path = Path.Combine(theme.Path, theme.SkinFolder); List files = CHelper.ListFiles(path, "*.xml", false); @@ -466,12 +466,12 @@ namespace Vocaluxe.Base if (xmlReader == null) continue; - Skin skin = new Skin(); + SSkin skin = new SSkin(); int version = 0; xmlReader.TryGetIntValue("//root/SkinSystemVersion", ref version); - if (version == SkinSystemVersion) + if (version == _SkinSystemVersion) { xmlReader.GetValue("//root/Info/Name", ref skin.Name, String.Empty); if (skin.Name.Length > 0) @@ -485,21 +485,21 @@ namespace Vocaluxe.Base skin.FileName = file; skin.PartyModeID = theme.PartyModeID; - skin.SkinList = new Dictionary(); + skin.SkinList = new Dictionary(); List names = xmlReader.GetValues("Skins"); foreach (string str in names) { - SkinElement sk = new SkinElement(); + SSkinElement sk = new SSkinElement(); sk.Name = str; sk.Value = String.Empty; skin.SkinList[str] = sk; } - skin.VideoList = new List(); + skin.VideoList = new List(); names = xmlReader.GetValues("Videos"); foreach (string str in names) { - SkinElement sk = new SkinElement(); + SSkinElement sk = new SSkinElement(); sk.Name = str; sk.Value = String.Empty; skin.VideoList.Add(sk); @@ -510,12 +510,12 @@ namespace Vocaluxe.Base else { string msg = "Can't load Skin \"" + file + "\", "; - if (version < SkinSystemVersion) + if (version < _SkinSystemVersion) msg += "the file ist outdated! "; else msg += "the file is for newer program versions! "; - msg += "Current SkinSystemVersion is " + SkinSystemVersion.ToString(); + msg += "Current SkinSystemVersion is " + _SkinSystemVersion.ToString(); CLog.LogError(msg); } } @@ -523,41 +523,41 @@ namespace Vocaluxe.Base #endregion Theme and Skin loading and writing #region Theme and Skin index handling - public static int GetSkinIndex(int PartyModeID) + public static int GetSkinIndex(int partyModeID) { for (int i = 0; i < _Skins.Count; i++) { - if (PartyModeID != -1 && _Skins[i].PartyModeID == PartyModeID) + if (partyModeID != -1 && _Skins[i].PartyModeID == partyModeID) return i; - else if (PartyModeID == -1 && _Skins[i].Name == CConfig.Skin) + else if (partyModeID == -1 && _Skins[i].Name == CConfig.Skin) return i; } return -1; } - public static int GetThemeIndex(int PartyModeID) + public static int GetThemeIndex(int partyModeID) { for (int i = 0; i < _Themes.Count; i++) { - if (PartyModeID != -1 && _Themes[i].PartyModeID == PartyModeID) + if (partyModeID != -1 && _Themes[i].PartyModeID == partyModeID) return i; - else if (PartyModeID == -1 && _Themes[i].Name == CConfig.Theme) + else if (partyModeID == -1 && _Themes[i].Name == CConfig.Theme) return i; } return -1; } - public static string GetThemeScreensPath(int PartyModeID) + public static string GetThemeScreensPath(int partyModeID) { string path = String.Empty; - int themeIndex = GetThemeIndex(PartyModeID); + int themeIndex = GetThemeIndex(partyModeID); if (themeIndex != -1) { path = Path.Combine(_Themes[themeIndex].Path, _Themes[themeIndex].SkinFolder); - path = Path.Combine(path, CSettings.sFolderScreens); + path = Path.Combine(path, CSettings.FolderScreens); } else CLog.LogError("Can't find current Theme"); @@ -565,59 +565,59 @@ namespace Vocaluxe.Base return path; } - public static STexture GetSkinTexture(string TextureName, int PartyModeID) + public static STexture GetSkinTexture(string textureName, int partyModeID) { - int SkinIndex = GetSkinIndex(PartyModeID); - if (SkinIndex != -1 && TextureName != null && _Skins[SkinIndex].SkinList.ContainsKey(TextureName)) - return _Skins[SkinIndex].SkinList[TextureName].Texture; + int skinIndex = GetSkinIndex(partyModeID); + if (skinIndex != -1 && textureName != null && _Skins[skinIndex].SkinList.ContainsKey(textureName)) + return _Skins[skinIndex].SkinList[textureName].Texture; return new STexture(-1); } - public static string GetSkinFilePath(string SkinName, int PartyModeID) + public static string GetSkinFilePath(string skinName, int partyModeID) { - return GetSkinFileName(SkinName, GetSkinIndex(PartyModeID), true); + return _GetSkinFileName(skinName, GetSkinIndex(partyModeID), true); } - private static string GetSkinFileName(string SkinName, int SkinIndex) + private static string _GetSkinFileName(string skinName, int skinIndex) { - return GetSkinFileName(SkinName, SkinIndex, false); + return _GetSkinFileName(skinName, skinIndex, false); } - private static string GetSkinFileName(string SkinName, int SkinIndex, bool ReturnPath) + private static string _GetSkinFileName(string skinName, int skinIndex, bool returnPath) { - foreach (SkinElement sk in _Skins[SkinIndex].SkinList.Values) + foreach (SSkinElement sk in _Skins[skinIndex].SkinList.Values) { - if (sk.Name == SkinName) + if (sk.Name == skinName) { - if (!ReturnPath) + if (!returnPath) return sk.Value; else - return Path.Combine(_Skins[SkinIndex].Path, sk.Value); + return Path.Combine(_Skins[skinIndex].Path, sk.Value); } } - CLog.LogError("Can't find Skin Element \"" + SkinName); - return SkinName; + CLog.LogError("Can't find Skin Element \"" + skinName); + return skinName; } - public static STexture GetSkinVideoTexture(string VideoName, int PartyModeID) + public static STexture GetSkinVideoTexture(string videoName, int partyModeID) { - int SkinIndex = GetSkinIndex(PartyModeID); - if (SkinIndex != -1) + int skinIndex = GetSkinIndex(partyModeID); + if (skinIndex != -1) { - for (int i = 0; i < _Skins[SkinIndex].VideoList.Count; i++) + for (int i = 0; i < _Skins[skinIndex].VideoList.Count; i++) { - SkinElement sk = _Skins[SkinIndex].VideoList[i]; - if (sk.Name == VideoName) + SSkinElement sk = _Skins[skinIndex].VideoList[i]; + if (sk.Name == videoName) { - float Time = 0f; + float time = 0f; if (sk.VideoIndex == -1) { - sk.VideoIndex = CVideo.VdLoad(GetVideoFilePath(sk.Name, PartyModeID)); + sk.VideoIndex = CVideo.VdLoad(GetVideoFilePath(sk.Name, partyModeID)); CVideo.VdSetLoop(sk.VideoIndex, true); } - CVideo.VdGetFrame(sk.VideoIndex, ref sk.Texture, Time, ref Time); - _Skins[SkinIndex].VideoList[i] = sk; + CVideo.VdGetFrame(sk.VideoIndex, ref sk.Texture, time, ref time); + _Skins[skinIndex].VideoList[i] = sk; return sk.Texture; } } @@ -625,88 +625,88 @@ namespace Vocaluxe.Base return new STexture(-1); } - public static void SkinVideoPause(string VideoName, int PartyModeID) + public static void SkinVideoPause(string videoName, int partyModeID) { - int SkinIndex = GetSkinIndex(PartyModeID); - if (SkinIndex != -1) + int skinIndex = GetSkinIndex(partyModeID); + if (skinIndex != -1) { - for (int i = 0; i < _Skins[SkinIndex].VideoList.Count; i++) + for (int i = 0; i < _Skins[skinIndex].VideoList.Count; i++) { - SkinElement sk = _Skins[SkinIndex].VideoList[i]; - if (sk.Name == VideoName) + SSkinElement sk = _Skins[skinIndex].VideoList[i]; + if (sk.Name == videoName) { if (sk.VideoIndex == -1) { - sk.VideoIndex = CVideo.VdLoad(GetVideoFilePath(sk.Name, PartyModeID)); + sk.VideoIndex = CVideo.VdLoad(GetVideoFilePath(sk.Name, partyModeID)); CVideo.VdSetLoop(sk.VideoIndex, true); } CVideo.VdPause(sk.VideoIndex); - _Skins[SkinIndex].VideoList[i] = sk; + _Skins[skinIndex].VideoList[i] = sk; return; } } } } - public static void SkinVideoResume(string VideoName, int PartyModeID) + public static void SkinVideoResume(string videoName, int partyModeID) { - int SkinIndex = GetSkinIndex(PartyModeID); - if (SkinIndex != -1) + int skinIndex = GetSkinIndex(partyModeID); + if (skinIndex != -1) { - for (int i = 0; i < _Skins[SkinIndex].VideoList.Count; i++) + for (int i = 0; i < _Skins[skinIndex].VideoList.Count; i++) { - SkinElement sk = _Skins[SkinIndex].VideoList[i]; - if (sk.Name == VideoName) + SSkinElement sk = _Skins[skinIndex].VideoList[i]; + if (sk.Name == videoName) { if (sk.VideoIndex == -1) { - sk.VideoIndex = CVideo.VdLoad(GetVideoFilePath(sk.Name, PartyModeID)); + sk.VideoIndex = CVideo.VdLoad(GetVideoFilePath(sk.Name, partyModeID)); CVideo.VdSetLoop(sk.VideoIndex, true); } CVideo.VdResume(sk.VideoIndex); - _Skins[SkinIndex].VideoList[i] = sk; + _Skins[skinIndex].VideoList[i] = sk; return; } } } } - public static string GetVideoFilePath(string VideoName, int PartyModeID) + public static string GetVideoFilePath(string videoName, int partyModeID) { - return GetVideoFileName(VideoName, GetSkinIndex(PartyModeID), true); + return _GetVideoFileName(videoName, GetSkinIndex(partyModeID), true); } - private static string GetVideoFileName(string VideoName, int SkinIndex) + private static string _GetVideoFileName(string videoName, int skinIndex) { - return GetVideoFileName(VideoName, SkinIndex, false); + return _GetVideoFileName(videoName, skinIndex, false); } - private static string GetVideoFileName(string VideoName, int SkinIndex, bool ReturnPath) + private static string _GetVideoFileName(string videoName, int skinIndex, bool returnPath) { - foreach (SkinElement sk in _Skins[SkinIndex].VideoList) + foreach (SSkinElement sk in _Skins[skinIndex].VideoList) { - if (sk.Name == VideoName) + if (sk.Name == videoName) { - if (!ReturnPath) + if (!returnPath) return sk.Value; else - return Path.Combine(_Skins[SkinIndex].Path, sk.Value); + return Path.Combine(_Skins[skinIndex].Path, sk.Value); } } - CLog.LogError("Can't find Video Element \"" + VideoName); - return VideoName; + CLog.LogError("Can't find Video Element \"" + videoName); + return videoName; } #endregion Theme and Skin index handling #region Element loading - private static void LoadColors(CXMLReader xmlReader, int SkinIndex) + private static void _LoadColors(CXMLReader xmlReader, int skinIndex) { - Skin skin = _Skins[SkinIndex]; + SSkin skin = _Skins[skinIndex]; - if (_Skins[SkinIndex].PartyModeID == -1) + if (_Skins[skinIndex].PartyModeID == -1) { - List PlayerColors = new List(); + List playerColors = new List(); float value = 0f; int i = 1; @@ -719,13 +719,13 @@ namespace Vocaluxe.Base xmlReader.TryGetFloatValue("//root/Colors/Player" + i.ToString() + "/B", ref color.B); xmlReader.TryGetFloatValue("//root/Colors/Player" + i.ToString() + "/A", ref color.A); - PlayerColors.Add(color); + playerColors.Add(color); i++; } - skin.ThemeColors.Player = PlayerColors.ToArray(); + skin.ThemeColors.Player = playerColors.ToArray(); } - List ColorScheme = new List(); + List colorScheme = new List(); List names = xmlReader.GetValues("ColorSchemes"); foreach (string str in names) { @@ -737,55 +737,55 @@ namespace Vocaluxe.Base xmlReader.TryGetFloatValue("//root/ColorSchemes/" + str + "/B", ref scheme.Color.B); xmlReader.TryGetFloatValue("//root/ColorSchemes/" + str + "/A", ref scheme.Color.A); - ColorScheme.Add(scheme); + colorScheme.Add(scheme); } - skin.ThemeColors.ColorSchemes = ColorScheme.ToArray(); + skin.ThemeColors.ColorSchemes = colorScheme.ToArray(); - _Skins[SkinIndex] = skin; + _Skins[skinIndex] = skin; } - private static void LoadCursor(CXMLReader xmlReader, int SkinIndex) + private static void _LoadCursor(CXMLReader xmlReader, int skinIndex) { string value = String.Empty; xmlReader.GetValue("//root/Cursor/Skin", ref Cursor.SkinName, value); - xmlReader.TryGetFloatValue("//root/Cursor/W", ref Cursor.w); - xmlReader.TryGetFloatValue("//root/Cursor/H", ref Cursor.h); + xmlReader.TryGetFloatValue("//root/Cursor/W", ref Cursor.W); + xmlReader.TryGetFloatValue("//root/Cursor/H", ref Cursor.H); if (xmlReader.GetValue("//root/Cursor/Color", ref value, value)) { - SColorF color = GetColor(value, _Skins[SkinIndex].PartyModeID); - Cursor.r = color.R; - Cursor.g = color.G; - Cursor.b = color.B; - Cursor.a = color.A; - Cursor.color = value; + SColorF color = GetColor(value, _Skins[skinIndex].PartyModeID); + Cursor.R = color.R; + Cursor.G = color.G; + Cursor.B = color.B; + Cursor.A = color.A; + Cursor.Color = value; } else { - Cursor.color = String.Empty; - xmlReader.TryGetFloatValue("//root/Cursor/R", ref Cursor.r); - xmlReader.TryGetFloatValue("//root/Cursor/G", ref Cursor.g); - xmlReader.TryGetFloatValue("//root/Cursor/B", ref Cursor.b); - xmlReader.TryGetFloatValue("//root/Cursor/A", ref Cursor.a); + Cursor.Color = String.Empty; + xmlReader.TryGetFloatValue("//root/Cursor/R", ref Cursor.R); + xmlReader.TryGetFloatValue("//root/Cursor/G", ref Cursor.G); + xmlReader.TryGetFloatValue("//root/Cursor/B", ref Cursor.B); + xmlReader.TryGetFloatValue("//root/Cursor/A", ref Cursor.A); } } #endregion Element loading #region Element Writing - private static void SaveColors(XmlWriter writer, int SkinIndex) + private static void _SaveColors(XmlWriter writer, int skinIndex) { - if (_Skins[SkinIndex].PartyModeID == -1) + if (_Skins[skinIndex].PartyModeID == -1) { writer.WriteStartElement("Colors"); - for (int i = 0; i < _Skins[SkinIndex].ThemeColors.Player.Length; i++) + for (int i = 0; i < _Skins[skinIndex].ThemeColors.Player.Length; i++) { writer.WriteStartElement("Player" + (i + 1).ToString()); - writer.WriteElementString("R", _Skins[SkinIndex].ThemeColors.Player[i].R.ToString("#0.000")); - writer.WriteElementString("G", _Skins[SkinIndex].ThemeColors.Player[i].G.ToString("#0.000")); - writer.WriteElementString("B", _Skins[SkinIndex].ThemeColors.Player[i].B.ToString("#0.000")); - writer.WriteElementString("A", _Skins[SkinIndex].ThemeColors.Player[i].A.ToString("#0.000")); + writer.WriteElementString("R", _Skins[skinIndex].ThemeColors.Player[i].R.ToString("#0.000")); + writer.WriteElementString("G", _Skins[skinIndex].ThemeColors.Player[i].G.ToString("#0.000")); + writer.WriteElementString("B", _Skins[skinIndex].ThemeColors.Player[i].B.ToString("#0.000")); + writer.WriteElementString("A", _Skins[skinIndex].ThemeColors.Player[i].A.ToString("#0.000")); writer.WriteEndElement(); } @@ -793,7 +793,7 @@ namespace Vocaluxe.Base } writer.WriteStartElement("ColorSchemes"); - foreach (SColorScheme scheme in _Skins[SkinIndex].ThemeColors.ColorSchemes) + foreach (SColorScheme scheme in _Skins[skinIndex].ThemeColors.ColorSchemes) { writer.WriteStartElement(scheme.Name); @@ -807,23 +807,23 @@ namespace Vocaluxe.Base writer.WriteEndElement(); } - private static void SaveCursor(XmlWriter writer) + private static void _SaveCursor(XmlWriter writer) { writer.WriteStartElement("Cursor"); writer.WriteElementString("Skin", Cursor.SkinName); - writer.WriteElementString("W", Cursor.w.ToString("#0.000")); - writer.WriteElementString("H", Cursor.h.ToString("#0.000")); + writer.WriteElementString("W", Cursor.W.ToString("#0.000")); + writer.WriteElementString("H", Cursor.H.ToString("#0.000")); - if (Cursor.color.Length > 0) - writer.WriteElementString("Color", Cursor.color); + if (Cursor.Color.Length > 0) + writer.WriteElementString("Color", Cursor.Color); else { - writer.WriteElementString("R", Cursor.r.ToString("#0.000")); - writer.WriteElementString("G", Cursor.g.ToString("#0.000")); - writer.WriteElementString("B", Cursor.b.ToString("#0.000")); - writer.WriteElementString("A", Cursor.a.ToString("#0.000")); + writer.WriteElementString("R", Cursor.R.ToString("#0.000")); + writer.WriteElementString("G", Cursor.G.ToString("#0.000")); + writer.WriteElementString("B", Cursor.B.ToString("#0.000")); + writer.WriteElementString("A", Cursor.A.ToString("#0.000")); } writer.WriteEndElement(); @@ -831,77 +831,77 @@ namespace Vocaluxe.Base #endregion ElementWriting #region Color Handling - public static SColorF GetColor(string ColorName, int PartyModeID) + public static SColorF GetColor(string colorName, int partyModeID) { SColorF color; - int SkinIndex = GetSkinIndex(PartyModeID); + int skinIndex = GetSkinIndex(partyModeID); - GetColor(ColorName, SkinIndex, out color); + GetColor(colorName, skinIndex, out color); return color; } - public static bool GetColor(string ColorName, int SkinIndex, out SColorF Color) + public static bool GetColor(string colorName, int skinIndex, out SColorF color) { - foreach (SColorScheme scheme in _Skins[SkinIndex].ThemeColors.ColorSchemes) + foreach (SColorScheme scheme in _Skins[skinIndex].ThemeColors.ColorSchemes) { - if (scheme.Name == ColorName) + if (scheme.Name == colorName) { - Color = new SColorF(scheme.Color); + color = new SColorF(scheme.Color); return true; } } bool success; - Color = GetPlayerColor(ColorName, GetSkinIndex(-1), out success); + color = GetPlayerColor(colorName, GetSkinIndex(-1), out success); return success; } - public static SColorF GetPlayerColor(int PlayerNr) + public static SColorF GetPlayerColor(int playerNr) { SColorF color = new SColorF(1f, 1f, 1f, 1f); - int SkinIndex = GetSkinIndex(-1); + int skinIndex = GetSkinIndex(-1); - if (_Skins[SkinIndex].ThemeColors.Player.Length < PlayerNr) + if (_Skins[skinIndex].ThemeColors.Player.Length < playerNr) return color; - return _Skins[SkinIndex].ThemeColors.Player[PlayerNr - 1]; + return _Skins[skinIndex].ThemeColors.Player[playerNr - 1]; } - public static SColorF GetPlayerColor(string PlayerNrString) + public static SColorF GetPlayerColor(string playerNrString) { bool dummy; - return GetPlayerColor(PlayerNrString, GetSkinIndex(-1), out dummy); + return GetPlayerColor(playerNrString, GetSkinIndex(-1), out dummy); } - public static SColorF GetPlayerColor(string PlayerNrString, int SkinIndex, out bool success) + public static SColorF GetPlayerColor(string playerNrString, int skinIndex, out bool success) { int selection = 0; - if (PlayerNrString.StartsWith("Player")) - int.TryParse(PlayerNrString.Substring(6), out selection); + if (playerNrString.StartsWith("Player")) + int.TryParse(playerNrString.Substring(6), out selection); - return GetPlayerColor(selection, SkinIndex, out success); + return GetPlayerColor(selection, skinIndex, out success); } - public static SColorF GetPlayerColor(int PlayerNr, out bool success) + public static SColorF GetPlayerColor(int playerNr, out bool success) { - return GetPlayerColor(PlayerNr, GetSkinIndex(-1), out success); + return GetPlayerColor(playerNr, GetSkinIndex(-1), out success); } - public static SColorF GetPlayerColor(int PlayerNr, int SkinIndex, out bool success) + public static SColorF GetPlayerColor(int playerNr, int skinIndex, out bool success) { success = false; SColorF color = new SColorF(1f, 1f, 1f, 1f); - if (_Skins[SkinIndex].PartyModeID != -1) - SkinIndex = GetSkinIndex(-1); + if (_Skins[skinIndex].PartyModeID != -1) + skinIndex = GetSkinIndex(-1); - if (_Skins[SkinIndex].ThemeColors.Player.Length < PlayerNr || PlayerNr < 1) + if (_Skins[skinIndex].ThemeColors.Player.Length < playerNr || playerNr < 1) return color; success = true; - return _Skins[SkinIndex].ThemeColors.Player[PlayerNr - 1]; + return _Skins[skinIndex].ThemeColors.Player[playerNr - 1]; } #endregion Color Handling } diff --git a/Vocaluxe/Base/CUtility.cs b/Vocaluxe/Base/CUtility.cs index d9811d94..2bda8739 100644 --- a/Vocaluxe/Base/CUtility.cs +++ b/Vocaluxe/Base/CUtility.cs @@ -9,8 +9,8 @@ namespace Vocaluxe.Base static class CTime { private static readonly Stopwatch _Stopwatch = new Stopwatch(); - private static float _fps; - private static readonly double nanosecPerTick = (1000.0 * 1000.0 * 1000.0) / Stopwatch.Frequency; + private static float _Fps; + private static readonly double _NanosecPerTick = (1000.0 * 1000.0 * 1000.0) / Stopwatch.Frequency; public static void Reset() { @@ -39,7 +39,7 @@ namespace Vocaluxe.Base { long ticks = _Stopwatch.ElapsedTicks; if (Stopwatch.IsHighResolution && ticks != 0) - return (float)((nanosecPerTick * ticks) / (1000.0 * 1000.0)); + return (float)((_NanosecPerTick * ticks) / (1000.0 * 1000.0)); else return _Stopwatch.ElapsedMilliseconds; } @@ -52,57 +52,57 @@ namespace Vocaluxe.Base float ms = GetMilliseconds(); if (ms > 0) - _fps = 1 / ms; + _Fps = 1 / ms; - return _fps * 1000f; + return _Fps * 1000f; } public static double GetFPS() { - return _fps * 1000f; + return _Fps * 1000f; } } class CKeys { - private readonly List _KeysPool; - private readonly List _ActualPool; + private readonly List _KeysPool; + private readonly List _ActualPool; private readonly Object _CopyLock = new Object(); - private bool _ModALT; - private bool _ModCTRL; - private bool _ModSHIFT; + private bool _ModAlt; + private bool _ModCtrl; + private bool _ModShift; private bool _KeyPressed; private Keys _Keys; - private Char _char; - private readonly Stopwatch _timer; + private Char _Char; + private readonly Stopwatch _Timer; public CKeys() { - _ModALT = false; - _ModCTRL = false; - _ModSHIFT = false; - _char = ' '; + _ModAlt = false; + _ModCtrl = false; + _ModShift = false; + _Char = ' '; _KeyPressed = false; _Keys = Keys.D0; - _KeysPool = new List(); - _ActualPool = new List(); - _timer = new Stopwatch(); + _KeysPool = new List(); + _ActualPool = new List(); + _Timer = new Stopwatch(); } - private void Add(bool alt, bool shift, bool ctrl, bool pressed, char unicode, Keys key) + private void _Add(bool alt, bool shift, bool ctrl, bool pressed, char unicode, Keys key) { - bool KeyRepeat = false; - if ((_char == unicode) && _KeyPressed) - KeyRepeat = true; + bool keyRepeat = false; + if ((_Char == unicode) && _KeyPressed) + keyRepeat = true; else if (_Keys == key) - KeyRepeat = true; + keyRepeat = true; - if (!_timer.IsRunning || (_timer.ElapsedMilliseconds > 75) || !KeyRepeat) + if (!_Timer.IsRunning || (_Timer.ElapsedMilliseconds > 75) || !keyRepeat) { - KeyEvent pool = new KeyEvent(ESender.Keyboard, alt, shift, ctrl, pressed && (unicode != Char.MinValue), unicode, key); + SKeyEvent pool = new SKeyEvent(ESender.Keyboard, alt, shift, ctrl, pressed && (unicode != Char.MinValue), unicode, key); lock (_CopyLock) { @@ -113,64 +113,64 @@ namespace Vocaluxe.Base catch (Exception) {} } - _timer.Reset(); - _timer.Start(); + _Timer.Reset(); + _Timer.Start(); } } - private void Del(int index) + private void _Del(int index) { _ActualPool.RemoveAt(index); } - private void CheckModifiers() + private void _CheckModifiers() { Keys keys = Control.ModifierKeys; - _ModSHIFT = (keys & Keys.Shift) == Keys.Shift; - _ModALT = (keys & Keys.Alt) == Keys.Alt; - _ModCTRL = (keys & Keys.Control) == Keys.Control; + _ModShift = (keys & Keys.Shift) == Keys.Shift; + _ModAlt = (keys & Keys.Alt) == Keys.Alt; + _ModCtrl = (keys & Keys.Control) == Keys.Control; } public void KeyDown(KeyEventArgs e) { - CheckModifiers(); + _CheckModifiers(); - bool Repeat = false; + bool repeat = false; if (_Keys == e.KeyCode) - Repeat = true; + repeat = true; - if (!_timer.IsRunning || (_timer.ElapsedMilliseconds > 75) || !Repeat) + if (!_Timer.IsRunning || (_Timer.ElapsedMilliseconds > 75) || !repeat) { _Keys = e.KeyCode; - if (Repeat) - Add(_ModALT, _ModSHIFT, _ModCTRL, _KeyPressed, _char, _Keys); + if (repeat) + _Add(_ModAlt, _ModShift, _ModCtrl, _KeyPressed, _Char, _Keys); else - Add(_ModALT, _ModSHIFT, _ModCTRL, _KeyPressed, Char.MinValue, _Keys); + _Add(_ModAlt, _ModShift, _ModCtrl, _KeyPressed, Char.MinValue, _Keys); } } public void KeyPress(KeyPressEventArgs e) { - CheckModifiers(); + _CheckModifiers(); - Add(_ModALT, _ModSHIFT, _ModCTRL, true, e.KeyChar, Keys.None); - _char = e.KeyChar; + _Add(_ModAlt, _ModShift, _ModCtrl, true, e.KeyChar, Keys.None); + _Char = e.KeyChar; _KeyPressed = true; } public void KeyUp(KeyEventArgs e) { - CheckModifiers(); + _CheckModifiers(); _KeyPressed = false; } - public bool PollEvent(ref KeyEvent KeyEvent) + public bool PollEvent(ref SKeyEvent keyEvent) { if (_ActualPool.Count > 0) { - KeyEvent = _ActualPool[0]; - Del(0); + keyEvent = _ActualPool[0]; + _Del(0); return true; } else @@ -181,7 +181,7 @@ namespace Vocaluxe.Base { lock (_CopyLock) { - foreach (KeyEvent e in _KeysPool) + foreach (SKeyEvent e in _KeysPool) _ActualPool.Add(e); _KeysPool.Clear(); } @@ -190,110 +190,110 @@ namespace Vocaluxe.Base class CMouse { - private readonly List _EventsPool; - private readonly List _CurrentPool; + private readonly List _EventsPool; + private readonly List _CurrentPool; - private int _x; - private int _y; + private int _X; + private int _Y; private readonly Object _CopyLock = new Object(); - private bool _ModALT; - private bool _ModCTRL; - private bool _ModSHIFT; + private bool _ModAlt; + private bool _ModCtrl; + private bool _ModShift; - private readonly Stopwatch _timer; + private readonly Stopwatch _Timer; public int X { - get { return _x; } + get { return _X; } } public int Y { - get { return _y; } + get { return _Y; } } public bool Visible = false; public CMouse() { - _ModALT = false; - _ModCTRL = false; - _ModSHIFT = false; + _ModAlt = false; + _ModCtrl = false; + _ModShift = false; - _EventsPool = new List(); - _CurrentPool = new List(); + _EventsPool = new List(); + _CurrentPool = new List(); - _timer = new Stopwatch(); + _Timer = new Stopwatch(); } - private void Add(bool alt, bool shift, bool ctrl, int x, int y, bool lb, bool ld, bool rb, int wheel, bool lbh, bool rbh, bool mb, bool mbh) + private void _Add(bool alt, bool shift, bool ctrl, int x, int y, bool lb, bool ld, bool rb, int wheel, bool lbh, bool rbh, bool mb, bool mbh) { - x = (int)(x * (float)CSettings.iRenderW / CDraw.GetScreenWidth()); - y = (int)(y * (float)CSettings.iRenderH / CDraw.GetScreenHeight()); + x = (int)(x * (float)CSettings.RenderW / CDraw.GetScreenWidth()); + y = (int)(y * (float)CSettings.RenderH / CDraw.GetScreenHeight()); - MouseEvent pool = new MouseEvent(ESender.Mouse, alt, shift, ctrl, x, y, lb, ld, rb, -wheel / 120, lbh, rbh, mb, mbh); + SMouseEvent pool = new SMouseEvent(ESender.Mouse, alt, shift, ctrl, x, y, lb, ld, rb, -wheel / 120, lbh, rbh, mb, mbh); lock (_CopyLock) { _EventsPool.Add(pool); } - _x = x; - _y = y; + _X = x; + _Y = y; } - private void Del(int index) + private void _Del(int index) { _CurrentPool.RemoveAt(index); } - private void CheckModifiers() + private void _CheckModifiers() { Keys keys = Control.ModifierKeys; - _ModSHIFT = (keys & Keys.Shift) == Keys.Shift; - _ModALT = (keys & Keys.Alt) == Keys.Alt; - _ModCTRL = (keys & Keys.Control) == Keys.Control; + _ModShift = (keys & Keys.Shift) == Keys.Shift; + _ModAlt = (keys & Keys.Alt) == Keys.Alt; + _ModCtrl = (keys & Keys.Control) == Keys.Control; } public void MouseMove(MouseEventArgs e) { - CheckModifiers(); - Add(_ModALT, _ModSHIFT, _ModCTRL, e.X, e.Y, false, false, false, e.Delta, e.Button == MouseButtons.Left, e.Button == MouseButtons.Right, + _CheckModifiers(); + _Add(_ModAlt, _ModShift, _ModCtrl, e.X, e.Y, false, false, false, e.Delta, e.Button == MouseButtons.Left, e.Button == MouseButtons.Right, false, e.Button == MouseButtons.Middle); } public void MouseWheel(MouseEventArgs e) { - CheckModifiers(); - Add(_ModALT, _ModSHIFT, _ModCTRL, e.X, e.Y, false, false, false, e.Delta, e.Button == MouseButtons.Left, e.Button == MouseButtons.Right, + _CheckModifiers(); + _Add(_ModAlt, _ModShift, _ModCtrl, e.X, e.Y, false, false, false, e.Delta, e.Button == MouseButtons.Left, e.Button == MouseButtons.Right, false, e.Button == MouseButtons.Middle); } public void MouseDown(MouseEventArgs e) { - CheckModifiers(); + _CheckModifiers(); bool lb = e.Button == MouseButtons.Left; bool ld = false; if (lb) { - if (_timer.IsRunning && _timer.ElapsedMilliseconds < 450) + if (_Timer.IsRunning && _Timer.ElapsedMilliseconds < 450) { ld = true; - _timer.Reset(); + _Timer.Reset(); } else { - _timer.Reset(); - _timer.Start(); + _Timer.Reset(); + _Timer.Start(); } } else - _timer.Reset(); + _Timer.Reset(); - Add(_ModALT, _ModSHIFT, _ModCTRL, e.X, e.Y, lb, ld, e.Button == MouseButtons.Right, e.Delta, false, false, + _Add(_ModAlt, _ModShift, _ModCtrl, e.X, e.Y, lb, ld, e.Button == MouseButtons.Right, e.Delta, false, false, e.Button == MouseButtons.Middle, false); } @@ -303,12 +303,12 @@ namespace Vocaluxe.Base //Add(_ModALT, _ModSHIFT, _ModCTRL, e.X, e.Y, e.Button == MouseButtons.Left, e.Button == MouseButtons.Right, e.Delta); } - public bool PollEvent(ref MouseEvent MouseEvent) + public bool PollEvent(ref SMouseEvent mouseEvent) { if (_CurrentPool.Count > 0) { - MouseEvent = _CurrentPool[0]; - Del(0); + mouseEvent = _CurrentPool[0]; + _Del(0); return true; } else @@ -319,7 +319,7 @@ namespace Vocaluxe.Base { lock (_CopyLock) { - foreach (MouseEvent e in _EventsPool) + foreach (SMouseEvent e in _EventsPool) _CurrentPool.Add(e); _EventsPool.Clear(); } diff --git a/Vocaluxe/Base/CVideo.cs b/Vocaluxe/Base/CVideo.cs index be09eb05..bd4e136a 100644 --- a/Vocaluxe/Base/CVideo.cs +++ b/Vocaluxe/Base/CVideo.cs @@ -46,49 +46,49 @@ namespace Vocaluxe.Base return _VideoDecoder.GetNumStreams(); } - public static int VdLoad(string VideoFileName) + public static int VdLoad(string videoFileName) { - return _VideoDecoder.Load(VideoFileName); + return _VideoDecoder.Load(videoFileName); } - public static bool VdClose(int StreamID) + public static bool VdClose(int streamID) { - return _VideoDecoder.Close(StreamID); + return _VideoDecoder.Close(streamID); } - public static float VdGetLength(int StreamID) + public static float VdGetLength(int streamID) { - return _VideoDecoder.GetLength(StreamID); + return _VideoDecoder.GetLength(streamID); } - public static bool VdGetFrame(int StreamID, ref STexture Frame, float Time, ref float VideoTime) + public static bool VdGetFrame(int streamID, ref STexture frame, float time, ref float videoTime) { - return _VideoDecoder.GetFrame(StreamID, ref Frame, Time, ref VideoTime); + return _VideoDecoder.GetFrame(streamID, ref frame, time, ref videoTime); } - public static bool VdSkip(int StreamID, float Start, float Gap) + public static bool VdSkip(int streamID, float start, float gap) { - return _VideoDecoder.Skip(StreamID, Start, Gap); + return _VideoDecoder.Skip(streamID, start, gap); } - public static void VdSetLoop(int StreamID, bool Loop) + public static void VdSetLoop(int streamID, bool loop) { - _VideoDecoder.SetLoop(StreamID, Loop); + _VideoDecoder.SetLoop(streamID, loop); } - public static void VdPause(int StreamID) + public static void VdPause(int streamID) { - _VideoDecoder.Pause(StreamID); + _VideoDecoder.Pause(streamID); } - public static void VdResume(int StreamID) + public static void VdResume(int streamID) { - _VideoDecoder.Resume(StreamID); + _VideoDecoder.Resume(streamID); } - public static bool VdFinished(int StreamID) + public static bool VdFinished(int streamID) { - return _VideoDecoder.Finished(StreamID); + return _VideoDecoder.Finished(streamID); } public static void Update() @@ -100,7 +100,7 @@ namespace Vocaluxe.Base #endregion VideoDecoder } - class VideoPlayer + class CVideoPlayer { private STexture _VideoTexture; private int _VideoStream; @@ -118,7 +118,7 @@ namespace Vocaluxe.Base set { CVideo.VdSetLoop(_VideoStream, value); } } - public VideoPlayer() + public CVideoPlayer() { _VideoTimer = new Stopwatch(); _VideoTexture = new STexture(-1); @@ -126,9 +126,9 @@ namespace Vocaluxe.Base _Loaded = false; } - public void Load(string VideoName) + public void Load(string videoName) { - _VideoStream = CVideo.VdLoad(CTheme.GetVideoFilePath(VideoName, -1)); + _VideoStream = CVideo.VdLoad(CTheme.GetVideoFilePath(videoName, -1)); _Loaded = true; } @@ -154,21 +154,21 @@ namespace Vocaluxe.Base { if (!_Finished) { - float VideoTime = _VideoTimer.ElapsedMilliseconds / 1000f; + float videoTime = _VideoTimer.ElapsedMilliseconds / 1000f; _Finished = CVideo.VdFinished(_VideoStream); STexture tex = new STexture(-1); - tex.height = 0f; - CVideo.VdGetFrame(_VideoStream, ref tex, VideoTime, ref VideoTime); + tex.Height = 0f; + CVideo.VdGetFrame(_VideoStream, ref tex, videoTime, ref videoTime); - if (tex.height > 0) + if (tex.Height > 0) { CDraw.RemoveTexture(ref _VideoTexture); _VideoTexture = tex; } } - RectangleF bounds = new RectangleF(0f, 0f, CSettings.iRenderW, CSettings.iRenderH); - RectangleF rect = new RectangleF(0f, 0f, _VideoTexture.width, _VideoTexture.height); + RectangleF bounds = new RectangleF(0f, 0f, CSettings.RenderW, CSettings.RenderH); + RectangleF rect = new RectangleF(0f, 0f, _VideoTexture.Width, _VideoTexture.Height); CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, EAspect.Crop); CDraw.DrawTexture(_VideoTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CSettings.ZFar / 4)); @@ -176,12 +176,12 @@ namespace Vocaluxe.Base public void PreLoad() { - float VideoTime = 0f; - while (_VideoTexture.index == -1 && VideoTime < 1f) + float videoTime = 0f; + while (_VideoTexture.Index == -1 && videoTime < 1f) { float dummy = 0f; CVideo.VdGetFrame(_VideoStream, ref _VideoTexture, 0, ref dummy); - VideoTime += 0.05f; + videoTime += 0.05f; } } diff --git a/Vocaluxe/GameModes/CGameMode.cs b/Vocaluxe/GameModes/CGameMode.cs index e3c5bc48..b4e2ca55 100644 --- a/Vocaluxe/GameModes/CGameMode.cs +++ b/Vocaluxe/GameModes/CGameMode.cs @@ -5,12 +5,12 @@ using VocaluxeLib.Menu.SongMenu; namespace Vocaluxe.GameModes { - struct SongQueque + struct SSongQueque { public int SongID; public EGameMode GameMode; - public SongQueque(int songID, EGameMode gameMode) + public SSongQueque(int songID, EGameMode gameMode) { SongID = songID; GameMode = gameMode; @@ -20,14 +20,14 @@ namespace Vocaluxe.GameModes abstract class CGameMode : IGameMode { protected bool _Initialized = false; - protected List _SongQueque; + protected List _SongQueque; protected int _CurrentSong; protected CPoints _Points; #region Implementation public virtual void Init() { - _SongQueque = new List(); + _SongQueque = new List(); Reset(); } @@ -38,43 +38,43 @@ namespace Vocaluxe.GameModes return EGameMode.TR_GAMEMODE_NORMAL; } - public virtual bool AddVisibleSong(int VisibleIndex, EGameMode GameMode) + public virtual bool AddVisibleSong(int visibleIndex, EGameMode gameMode) { - if (CSongs.VisibleSongs.Length > VisibleIndex) + if (CSongs.VisibleSongs.Length > visibleIndex) { - int SongID = CSongs.VisibleSongs[VisibleIndex].ID; - if (GameMode == EGameMode.TR_GAMEMODE_DUET && !CSongs.GetSong(SongID).IsDuet) + int songID = CSongs.VisibleSongs[visibleIndex].ID; + if (gameMode == EGameMode.TR_GAMEMODE_DUET && !CSongs.GetSong(songID).IsDuet) return false; - _SongQueque.Add(new SongQueque(SongID, GameMode)); + _SongQueque.Add(new SSongQueque(songID, gameMode)); return true; } return false; } - public virtual bool AddSong(int AbsoluteIndex, EGameMode GameMode) + public virtual bool AddSong(int absoluteIndex, EGameMode gameMode) { - if (CSongs.AllSongs.Length > AbsoluteIndex) + if (CSongs.AllSongs.Length > absoluteIndex) { - int SongID = CSongs.AllSongs[AbsoluteIndex].ID; - if (GameMode == EGameMode.TR_GAMEMODE_DUET && !CSongs.GetSong(SongID).IsDuet) + int songID = CSongs.AllSongs[absoluteIndex].ID; + if (gameMode == EGameMode.TR_GAMEMODE_DUET && !CSongs.GetSong(songID).IsDuet) return false; - _SongQueque.Add(new SongQueque(SongID, GameMode)); + _SongQueque.Add(new SSongQueque(songID, gameMode)); return true; } return false; } - public virtual bool RemoveVisibleSong(int VisibleIndex) + public virtual bool RemoveVisibleSong(int visibleIndex) { - if (CSongs.VisibleSongs.Length > VisibleIndex) + if (CSongs.VisibleSongs.Length > visibleIndex) { int index = -1; - int SongID = CSongs.VisibleSongs[VisibleIndex].ID; + int songID = CSongs.VisibleSongs[visibleIndex].ID; for (int i = 0; i < _SongQueque.Count; i++) { - if (_SongQueque[i].SongID == SongID) + if (_SongQueque[i].SongID == songID) { index = i; break; @@ -90,15 +90,15 @@ namespace Vocaluxe.GameModes return false; } - public virtual bool RemoveSong(int AbsoluteIndex) + public virtual bool RemoveSong(int absoluteIndex) { - if (CSongs.AllSongs.Length > AbsoluteIndex) + if (CSongs.AllSongs.Length > absoluteIndex) { int index = -1; - int SongID = CSongs.AllSongs[AbsoluteIndex].ID; + int songID = CSongs.AllSongs[absoluteIndex].ID; for (int i = 0; i < _SongQueque.Count; i++) { - if (_SongQueque[i].SongID == SongID) + if (_SongQueque[i].SongID == songID) { index = i; break; @@ -123,12 +123,12 @@ namespace Vocaluxe.GameModes _CurrentSong = -1; } - public virtual void Start(SPlayer[] Player) + public virtual void Start(SPlayer[] player) { - _Points = new CPoints(_SongQueque.Count, Player); + _Points = new CPoints(_SongQueque.Count, player); } - public virtual void NextRound(SPlayer[] Player) + public virtual void NextRound(SPlayer[] player) { if (_CurrentSong < _SongQueque.Count && _SongQueque.Count > 0) { @@ -137,7 +137,7 @@ namespace Vocaluxe.GameModes _Points.SetPoints( _CurrentSong, _SongQueque[_CurrentSong].SongID, - Player, + player, _SongQueque[_CurrentSong].GameMode == EGameMode.TR_GAMEMODE_MEDLEY, _SongQueque[_CurrentSong].GameMode == EGameMode.TR_GAMEMODE_DUET, _SongQueque[_CurrentSong].GameMode == EGameMode.TR_GAMEMODE_SHORTSONG); @@ -195,18 +195,18 @@ namespace Vocaluxe.GameModes return _SongQueque.Count; } - public virtual CSong GetSong(int Num) + public virtual CSong GetSong(int num) { - if (Num - 1 < _SongQueque.Count && Num - 1 > -1) - return CSongs.GetSong(_SongQueque[Num - 1].SongID); + if (num - 1 < _SongQueque.Count && num - 1 > -1) + return CSongs.GetSong(_SongQueque[num - 1].SongID); return null; } - public virtual EGameMode GetGameMode(int Num) + public virtual EGameMode GetGameMode(int num) { - if (Num - 1 < _SongQueque.Count && Num > -1) - return _SongQueque[Num].GameMode; + if (num - 1 < _SongQueque.Count && num > -1) + return _SongQueque[num].GameMode; return EGameMode.TR_GAMEMODE_NORMAL; } @@ -217,6 +217,6 @@ namespace Vocaluxe.GameModes } #endregion Implementation - protected virtual void SongManipulation(int SongIndex) {} + protected virtual void _SongManipulation(int songIndex) {} } } \ No newline at end of file diff --git a/Vocaluxe/GameModes/IGameMode.cs b/Vocaluxe/GameModes/IGameMode.cs index c581f2ce..16db3898 100644 --- a/Vocaluxe/GameModes/IGameMode.cs +++ b/Vocaluxe/GameModes/IGameMode.cs @@ -9,15 +9,15 @@ namespace Vocaluxe.GameModes EGameMode GetCurrentGameMode(); - bool AddVisibleSong(int VisibleIndex, EGameMode GameMode); - bool AddSong(int AbsoluteIndex, EGameMode GameMode); - bool RemoveVisibleSong(int VisibleIndex); - bool RemoveSong(int AbsoluteIndex); + 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); + void Start(SPlayer[] player); + void NextRound(SPlayer[] player); bool IsFinished(); int GetCurrentRoundNr(); @@ -25,7 +25,7 @@ namespace Vocaluxe.GameModes int GetNumSongs(); CSong GetSong(); - CSong GetSong(int Num); - EGameMode GetGameMode(int Num); + CSong GetSong(int num); + EGameMode GetGameMode(int num); } } \ No newline at end of file diff --git a/Vocaluxe/Lib/Draw/CDirect3D.cs b/Vocaluxe/Lib/Draw/CDirect3D.cs index c86d4715..631abfd7 100644 --- a/Vocaluxe/Lib/Draw/CDirect3D.cs +++ b/Vocaluxe/Lib/Draw/CDirect3D.cs @@ -26,7 +26,7 @@ namespace Vocaluxe.Lib.Draw private readonly Device _Device; private readonly PresentParameters _PresentParameters; - private bool _fullscreen; + private bool _Fullscreen; private Size _OldSize; private Size _SizeBeforeMinimize; @@ -35,19 +35,19 @@ namespace Vocaluxe.Lib.Draw private readonly List _Queque; private readonly Queue _IDs; - private readonly Object MutexTexture = new Object(); + private readonly Object _MutexTexture = new Object(); private VertexBuffer _VertexBuffer; private IndexBuffer _IndexBuffer; - private int h = 1; - private int w = 1; - private int y; - private int x; + private int _H = 1; + private int _W = 1; + private int _Y; + private int _X; private STexture _BlankTexture; - private readonly Queue _Vertices; + private readonly Queue _Vertices; private readonly Queue _VerticesTextures; private readonly Queue _VerticesRotationMatrices; @@ -59,7 +59,7 @@ namespace Vocaluxe.Lib.Draw /// public CDirect3D() { - Icon = new Icon(Path.Combine(Environment.CurrentDirectory, CSettings.sIcon)); + Icon = new Icon(Path.Combine(Environment.CurrentDirectory, CSettings.Icon)); _Textures = new Dictionary(); _D3DTextures = new Dictionary(); _Queque = new List(); @@ -69,7 +69,7 @@ namespace Vocaluxe.Lib.Draw for (int i = 0; i < 100000; i++) _IDs.Enqueue(i); - _Vertices = new Queue(); + _Vertices = new Queue(); _VerticesTextures = new Queue(); _VerticesRotationMatrices = new Queue(); @@ -82,27 +82,27 @@ namespace Vocaluxe.Lib.Draw { MessageBox.Show("No DirectX runtimes were found, please download and install them " + "from http://www.microsoft.com/download/en/details.aspx?id=8109", - CSettings.sProgramName, MessageBoxButtons.OK, MessageBoxIcon.Error); + CSettings.ProgramName, MessageBoxButtons.OK, MessageBoxIcon.Error); CLog.LogError(e.Message + " - No DirectX runtimes were found, please download and install them from http://www.microsoft.com/download/en/details.aspx?id=8109"); Environment.Exit(Environment.ExitCode); } - Paint += OnPaintEvent; - Closing += OnClosingEvent; - Resize += OnResizeEvent; + Paint += _OnPaintEvent; + Closing += _OnClosingEvent; + Resize += _OnResizeEvent; - KeyDown += OnKeyDown; - PreviewKeyDown += OnPreviewKeyDown; - KeyPress += OnKeyPress; - KeyUp += OnKeyUp; + KeyDown += _OnKeyDown; + PreviewKeyDown += _OnPreviewKeyDown; + KeyPress += _OnKeyPress; + KeyUp += _OnKeyUp; _Mouse = new CMouse(); - MouseMove += OnMouseMove; - MouseWheel += OnMouseWheel; - MouseDown += OnMouseDown; - MouseUp += OnMouseUp; - MouseLeave += OnMouseLeave; - MouseEnter += OnMouseEnter; + MouseMove += _OnMouseMove; + MouseWheel += _OnMouseWheel; + MouseDown += _OnMouseDown; + MouseUp += _OnMouseUp; + MouseLeave += _OnMouseLeave; + MouseEnter += _OnMouseEnter; ClientSize = new Size(CConfig.ScreenW, CConfig.ScreenH); _SizeBeforeMinimize = ClientSize; @@ -122,17 +122,17 @@ namespace Vocaluxe.Lib.Draw MultisampleType msType; switch (CConfig.AAMode) { - case EAntiAliasingModes.x2: + case EAntiAliasingModes.X2: msType = MultisampleType.TwoSamples; break; - case EAntiAliasingModes.x4: + case EAntiAliasingModes.X4: msType = MultisampleType.FourSamples; break; - case EAntiAliasingModes.x8: + case EAntiAliasingModes.X8: msType = MultisampleType.EightSamples; break; - case EAntiAliasingModes.x16: - case EAntiAliasingModes.x32: //x32 is not supported, fallback to x16 + case EAntiAliasingModes.X16: + case EAntiAliasingModes.X32: //x32 is not supported, fallback to x16 msType = MultisampleType.SixteenSamples; break; default: @@ -183,7 +183,7 @@ namespace Vocaluxe.Lib.Draw { MessageBox.Show("Something went wrong during device creating, please check if your DirectX redistributables " + "and graphic card drivers are up to date. You can download the DirectX runtimes at http://www.microsoft.com/download/en/details.aspx?id=8109", - CSettings.sProgramName, MessageBoxButtons.OK, MessageBoxIcon.Error); + CSettings.ProgramName, MessageBoxButtons.OK, MessageBoxIcon.Error); CLog.LogError( "Something went wrong during device creating, please check if your DirectX redistributables and grafic card drivers are up to date. You can download the DirectX runtimes at http://www.microsoft.com/download/en/details.aspx?id=8109"); Environment.Exit(Environment.ExitCode); @@ -194,11 +194,11 @@ namespace Vocaluxe.Lib.Draw } #region form events - private void OnPaintEvent(object sender, PaintEventArgs e) {} + private void _OnPaintEvent(object sender, PaintEventArgs e) {} - private void OnResizeEvent(object sender, EventArgs e) {} + private void _OnResizeEvent(object sender, EventArgs e) {} - private void OnClosingEvent(object sender, CancelEventArgs e) + private void _OnClosingEvent(object sender, CancelEventArgs e) { _Run = false; } @@ -211,7 +211,7 @@ namespace Vocaluxe.Lib.Draw protected override void OnResize(EventArgs e) { base.OnResize(e); - DoResize(); + _DoResize(); } protected override void WndProc(ref Message m) @@ -240,29 +240,29 @@ namespace Vocaluxe.Lib.Draw /// /// Resizes the viewport /// - private void DoResize() + private void _DoResize() { // The window was minimized, so restore it to the last known size if (ClientSize.Width == 0 || ClientSize.Height == 0) ClientSize = _SizeBeforeMinimize; if (_Run) { - h = ClientSize.Height; - w = ClientSize.Width; - y = 0; - x = 0; + _H = ClientSize.Height; + _W = ClientSize.Width; + _Y = 0; + _X = 0; - if (w / (float)h > CSettings.GetRenderAspect()) + if (_W / (float)_H > CSettings.GetRenderAspect()) { //The windows's width is too big - w = (int)Math.Round(h * CSettings.GetRenderAspect()); - x = (ClientSize.Width - w) / 2; + _W = (int)Math.Round(_H * CSettings.GetRenderAspect()); + _X = (ClientSize.Width - _W) / 2; } else { //The windows's height is too big - h = (int)Math.Round(w / CSettings.GetRenderAspect()); - y = (ClientSize.Height - h) / 2; + _H = (int)Math.Round(_W / CSettings.GetRenderAspect()); + _Y = (ClientSize.Height - _H) / 2; } //Apply the new sizes to the PresentParameters @@ -275,7 +275,7 @@ namespace Vocaluxe.Lib.Draw Init(); //Set the new Viewport - _Device.Viewport = new Viewport(x, y, w, h); + _Device.Viewport = new Viewport(_X, _Y, _W, _H); //Store size so it can get restored after the window gets minimized _SizeBeforeMinimize = ClientSize; } @@ -284,35 +284,35 @@ namespace Vocaluxe.Lib.Draw /// /// Triggers the Fullscreen mode /// - private void EnterFullScreen() + private void _EnterFullScreen() { //This currently not using real fullscreen mode but a borderless window //Real fullscreen could be gained setting _PresentParameters.Windowed = true //And calling Reset() and Init() after _OldSize = ClientSize; - int ScreenNr = 0; + int screenNr = 0; for (int i = 0; i < Screen.AllScreens.Length; i++) { Screen scr = Screen.AllScreens[i]; if (scr.Bounds.Top <= Top && scr.Bounds.Left <= Left) - ScreenNr = i; + screenNr = i; } - ClientSize = new Size(Screen.AllScreens[ScreenNr].Bounds.Width, Screen.AllScreens[ScreenNr].Bounds.Height); + ClientSize = new Size(Screen.AllScreens[screenNr].Bounds.Width, Screen.AllScreens[screenNr].Bounds.Height); FormBorderStyle = FormBorderStyle.None; CenterToScreen(); - _fullscreen = true; + _Fullscreen = true; CConfig.FullScreen = EOffOn.TR_CONFIG_ON; if (WindowState == FormWindowState.Maximized) { WindowState = FormWindowState.Normal; - DoResize(); + _DoResize(); WindowState = FormWindowState.Maximized; } else - DoResize(); + _DoResize(); CConfig.SaveConfig(); } @@ -320,12 +320,12 @@ namespace Vocaluxe.Lib.Draw /// /// Triggers the windowed mode /// - private void LeaveFullScreen() + private void _LeaveFullScreen() { ClientSize = _OldSize; FormBorderStyle = FormBorderStyle.Sizable; CenterToScreen(); - _fullscreen = false; + _Fullscreen = false; CConfig.FullScreen = EOffOn.TR_CONFIG_OFF; CConfig.SaveConfig(); @@ -333,33 +333,33 @@ namespace Vocaluxe.Lib.Draw #endregion resize #region mouse event handlers - private void OnMouseMove(object sender, MouseEventArgs e) + private void _OnMouseMove(object sender, MouseEventArgs e) { _Mouse.MouseMove(e); } - private void OnMouseWheel(object sender, MouseEventArgs e) + private void _OnMouseWheel(object sender, MouseEventArgs e) { _Mouse.MouseWheel(e); } - private void OnMouseDown(object sender, MouseEventArgs e) + private void _OnMouseDown(object sender, MouseEventArgs e) { _Mouse.MouseDown(e); } - private void OnMouseUp(object sender, MouseEventArgs e) + private void _OnMouseUp(object sender, MouseEventArgs e) { _Mouse.MouseUp(e); } - private void OnMouseLeave(object sender, EventArgs e) + private void _OnMouseLeave(object sender, EventArgs e) { _Mouse.Visible = false; Cursor.Show(); } - private void OnMouseEnter(object sender, EventArgs e) + private void _OnMouseEnter(object sender, EventArgs e) { Cursor.Hide(); _Mouse.Visible = true; @@ -367,22 +367,22 @@ namespace Vocaluxe.Lib.Draw #endregion #region keyboard event handlers - private void OnPreviewKeyDown(object sender, PreviewKeyDownEventArgs e) + private void _OnPreviewKeyDown(object sender, PreviewKeyDownEventArgs e) { - OnKeyDown(sender, new KeyEventArgs(e.KeyData)); + _OnKeyDown(sender, new KeyEventArgs(e.KeyData)); } - private void OnKeyDown(object sender, KeyEventArgs e) + private void _OnKeyDown(object sender, KeyEventArgs e) { _Keys.KeyDown(e); } - private void OnKeyPress(object sender, KeyPressEventArgs e) + private void _OnKeyPress(object sender, KeyPressEventArgs e) { _Keys.KeyPress(e); } - private void OnKeyUp(object sender, KeyEventArgs e) + private void _OnKeyUp(object sender, KeyEventArgs e) { _Keys.KeyUp(e); } @@ -400,15 +400,15 @@ namespace Vocaluxe.Lib.Draw if (!_Device.Disposed) { Text = CSettings.GetFullVersionText(); - SlimDX.Matrix translate = SlimDX.Matrix.Translation(new Vector3(-CSettings.iRenderW / 2, CSettings.iRenderH / 2, 0)); - SlimDX.Matrix projection = SlimDX.Matrix.OrthoOffCenterLH(-CSettings.iRenderW / 2, CSettings.iRenderW / 2, -CSettings.iRenderH / 2, CSettings.iRenderH / 2, + SlimDX.Matrix translate = SlimDX.Matrix.Translation(new Vector3(-CSettings.RenderW / 2, CSettings.RenderH / 2, 0)); + SlimDX.Matrix projection = SlimDX.Matrix.OrthoOffCenterLH(-CSettings.RenderW / 2, CSettings.RenderW / 2, -CSettings.RenderH / 2, CSettings.RenderH / 2, CSettings.ZNear, CSettings.ZFar); - _VertexBuffer = new VertexBuffer(_Device, CSettings.iVertexBufferElements * (4 * Marshal.SizeOf(typeof(TexturedColoredVertex))), Usage.WriteOnly | Usage.Dynamic, + _VertexBuffer = new VertexBuffer(_Device, CSettings.VertexBufferElements * (4 * Marshal.SizeOf(typeof(STexturedColoredVertex))), Usage.WriteOnly | Usage.Dynamic, VertexFormat.Position | VertexFormat.Texture1 | VertexFormat.Diffuse, Pool.Default); - if (_Device.SetStreamSource(0, _VertexBuffer, 0, Marshal.SizeOf(typeof(TexturedColoredVertex))).IsFailure) + if (_Device.SetStreamSource(0, _VertexBuffer, 0, Marshal.SizeOf(typeof(STexturedColoredVertex))).IsFailure) CLog.LogError("Failed to set stream source"); - _Device.VertexDeclaration = TexturedColoredVertex.GetDeclaration(_Device); + _Device.VertexDeclaration = STexturedColoredVertex.GetDeclaration(_Device); if (_Device.SetTransform(TransformState.Projection, projection).IsFailure) CLog.LogError("Failed to set orthogonal matrix"); if (_Device.SetTransform(TransformState.World, translate).IsFailure) @@ -487,12 +487,12 @@ namespace Vocaluxe.Lib.Draw if (CConfig.FullScreen == EOffOn.TR_CONFIG_ON) { CSettings.IsFullScreen = true; - EnterFullScreen(); + _EnterFullScreen(); } //Resize window if aspect ratio is incorrect - if (w / (float)h != CSettings.GetRenderAspect()) - DoResize(); + if (_W / (float)_H != CSettings.GetRenderAspect()) + _DoResize(); while (_Run) { @@ -505,9 +505,9 @@ namespace Vocaluxe.Lib.Draw //We want to begin drawing if (_Device.BeginScene().IsFailure) CLog.LogError("Failed to begin scene"); - CheckQueque(); + _CheckQueque(); _Run = _Run && CGraphics.Draw(); - RenderVertexBuffer(); + _RenderVertexBuffer(); //We finished drawing the frame if (_Device.EndScene().IsFailure) CLog.LogError("Failed to end scene"); @@ -530,12 +530,12 @@ namespace Vocaluxe.Lib.Draw } } //Apply fullscreen mode - if (CSettings.IsFullScreen != _fullscreen) + if (CSettings.IsFullScreen != _Fullscreen) { - if (!_fullscreen) - EnterFullScreen(); + if (!_Fullscreen) + _EnterFullScreen(); else - LeaveFullScreen(); + _LeaveFullScreen(); } if (CTime.IsRunning()) delay = (int)Math.Floor(CConfig.CalcCycleTime() - CTime.GetMilliseconds()); @@ -556,7 +556,7 @@ namespace Vocaluxe.Lib.Draw public void Reset() { //Dispose all objects in the default pool, those need to be recreated - TexturedColoredVertex.GetDeclaration(_Device).Dispose(); + STexturedColoredVertex.GetDeclaration(_Device).Dispose(); _VertexBuffer.Dispose(); _IndexBuffer.Dispose(); if (_Device.Reset(_PresentParameters).IsFailure) @@ -576,7 +576,7 @@ namespace Vocaluxe.Lib.Draw p.Value.Dispose(); } - TexturedColoredVertex.GetDeclaration(_Device).Dispose(); + STexturedColoredVertex.GetDeclaration(_Device).Dispose(); _VertexBuffer.Dispose(); _IndexBuffer.Dispose(); _Device.Dispose(); @@ -616,11 +616,11 @@ namespace Vocaluxe.Lib.Draw /// Calculates the bounds for a CText object /// /// The CText object of which the bounds should be calculated for - /// The height of the CText object + /// The height of the CText object /// RectangleF object containing the bounds - public RectangleF GetTextBounds(CText text, float Height) + public RectangleF GetTextBounds(CText text, float height) { - CFonts.Height = Height; + CFonts.Height = height; CFonts.SetFont(text.Font); CFonts.Style = text.Style; return new RectangleF(text.X, text.Y, CFonts.GetTextWidth(CLanguage.Translate(text.Text)), CFonts.GetTextHeight(CLanguage.Translate(text.Text))); @@ -632,11 +632,11 @@ namespace Vocaluxe.Lib.Draw /// A TexturedColoredVertex array containg 4 vertices /// The texture the vertex should be textured with /// The vertices' rotation - private void AddToVertexBuffer(TexturedColoredVertex[] vertices, Texture tex, SlimDX.Matrix rotation) + private void _AddToVertexBuffer(STexturedColoredVertex[] vertices, Texture tex, SlimDX.Matrix rotation) { //The vertexbuffer is full, so we need to flush it before we can continue - if (_Vertices.Count >= CSettings.iVertexBufferElements) - RenderVertexBuffer(); + if (_Vertices.Count >= CSettings.VertexBufferElements) + _RenderVertexBuffer(); _Vertices.Enqueue(vertices[0]); _Vertices.Enqueue(vertices[1]); _Vertices.Enqueue(vertices[2]); @@ -648,12 +648,12 @@ namespace Vocaluxe.Lib.Draw /// /// Renders the vertex buffer /// - private void RenderVertexBuffer() + private void _RenderVertexBuffer() { if (_Vertices.Count > 0) { //The vertex buffer locks are slow actions, its better to lock once per frame and write all vertices to the buffer at once - DataStream stream = _VertexBuffer.Lock(0, _Vertices.Count * Marshal.SizeOf(typeof(TexturedColoredVertex)), LockFlags.Discard); + DataStream stream = _VertexBuffer.Lock(0, _Vertices.Count * Marshal.SizeOf(typeof(STexturedColoredVertex)), LockFlags.Discard); stream.WriteRange(_Vertices.ToArray()); _VertexBuffer.Unlock(); stream.Dispose(); @@ -691,6 +691,7 @@ namespace Vocaluxe.Lib.Draw /// /// Copies the current frame into a texture /// A texture holding the current frame + /// public STexture CopyScreen() { STexture texture = new STexture(-1); @@ -700,19 +701,19 @@ namespace Vocaluxe.Lib.Draw Surface textureSurface = tex.GetSurfaceLevel(0); Surface.FromSurface(textureSurface, backbufferSurface, Filter.Default, 0); backbufferSurface.Dispose(); - lock (MutexTexture) + lock (_MutexTexture) { _D3DTextures.Add(_IDs.Peek(), tex); - texture.color = new SColorF(1f, 1f, 1f, 1f); - texture.rect = new SRectF(0f, 0f, texture.width, texture.height, 0f); - texture.width = w; - texture.height = h; - texture.w2 = CheckForNextPowerOf2(texture.width); - texture.h2 = CheckForNextPowerOf2(texture.height); - texture.index = _IDs.Dequeue(); + texture.Color = new SColorF(1f, 1f, 1f, 1f); + texture.Rect = new SRectF(0f, 0f, texture.Width, texture.Height, 0f); + texture.Width = _W; + texture.Height = _H; + texture.W2 = _CheckForNextPowerOf2(texture.Width); + texture.H2 = _CheckForNextPowerOf2(texture.Height); + texture.Index = _IDs.Dequeue(); - _Textures[texture.index] = texture; + _Textures[texture.Index] = texture; } return texture; } @@ -720,18 +721,18 @@ namespace Vocaluxe.Lib.Draw /// /// Copies the current frame into a texture /// - /// The texture in which the frame is copied to - public void CopyScreen(ref STexture Texture) + /// The texture in which the frame is copied to + public void CopyScreen(ref STexture texture) { - if (!_TextureExists(ref Texture) || (Texture.width != GetScreenWidth()) || (Texture.height != GetScreenHeight())) + if (!_TextureExists(ref texture) || (texture.Width != GetScreenWidth()) || (texture.Height != GetScreenHeight())) { - RemoveTexture(ref Texture); - Texture = CopyScreen(); + RemoveTexture(ref texture); + texture = CopyScreen(); } else { Surface backbufferSurface = _Device.GetBackBuffer(0, 0); - Surface textureSurface = _D3DTextures[Texture.index].GetSurfaceLevel(0); + Surface textureSurface = _D3DTextures[texture.Index].GetSurfaceLevel(0); Surface.FromSurface(textureSurface, backbufferSurface, Filter.Default, 0); } } @@ -742,7 +743,7 @@ namespace Vocaluxe.Lib.Draw public void MakeScreenShot() { string file = "Screenshot_"; - string path = Path.Combine(Environment.CurrentDirectory, CSettings.sFolderScreenshots); + string path = Path.Combine(Environment.CurrentDirectory, CSettings.FolderScreenshots); int i = 0; while (File.Exists(Path.Combine(path, file + i.ToString("00000") + ".bmp"))) @@ -780,26 +781,26 @@ namespace Vocaluxe.Lib.Draw /// /// Draws a text string /// - /// The text to be drawn + /// The text to be drawn /// The text's x-position /// The text's y-position /// The text's height - public void DrawText(string Text, int x, int y, int h) + public void DrawText(string text, int x, int y, int h) { - DrawText(Text, x, y, h, 0f); + DrawText(text, x, y, h, 0f); } /// /// Draws a text string /// - /// The text to be drawn + /// The text to be drawn /// The text's x-position /// The text's y-position /// The text's height /// The text's x-position - public void DrawText(string Text, int x, int y, float h, float z) + public void DrawText(string text, int x, int y, float h, float z) { - CFonts.DrawText(Text, h, x, y, z, new SColorF(1f, 1f, 1f, 1f)); + CFonts.DrawText(text, h, x, y, z, new SColorF(1f, 1f, 1f, 1f)); } /// @@ -831,26 +832,26 @@ namespace Vocaluxe.Lib.Draw /// /// Adds a texture and stores it in the VRam /// - /// The texture's filepath + /// The texture's filepath /// A STexture object containing the added texture - public STexture AddTexture(string TexturePath) + public STexture AddTexture(string texturePath) { - if (File.Exists(TexturePath)) + if (File.Exists(texturePath)) { Bitmap bmp; try { - bmp = new Bitmap(TexturePath); + bmp = new Bitmap(texturePath); } catch (Exception) { - CLog.LogError("Error loading Texture: " + TexturePath); + CLog.LogError("Error loading Texture: " + texturePath); return new STexture(-1); } STexture s; try { - s = AddTexture(bmp, TexturePath); + s = AddTexture(bmp, texturePath); } finally { @@ -858,7 +859,7 @@ namespace Vocaluxe.Lib.Draw } return s; } - CLog.LogError("Can't find File: " + TexturePath); + CLog.LogError("Can't find File: " + texturePath); return new STexture(-1); } @@ -866,57 +867,57 @@ namespace Vocaluxe.Lib.Draw /// Adds a texture and stores it in the Vram /// /// The Bitmap of which the texure will be created from - /// The path to the texture + /// The path to the texture /// A STexture object containing the added texture - public STexture AddTexture(Bitmap bmp, string TexturePath) + public STexture AddTexture(Bitmap bmp, string texturePath) { if (bmp.Height == 0 || bmp.Width == 0) return new STexture(-1); - int MaxSize; + int maxSize; //Apply the right max size switch (CConfig.TextureQuality) { case ETextureQuality.TR_CONFIG_TEXTURE_LOWEST: - MaxSize = 128; + maxSize = 128; break; case ETextureQuality.TR_CONFIG_TEXTURE_LOW: - MaxSize = 256; + maxSize = 256; break; case ETextureQuality.TR_CONFIG_TEXTURE_MEDIUM: - MaxSize = 512; + maxSize = 512; break; case ETextureQuality.TR_CONFIG_TEXTURE_HIGH: - MaxSize = 1024; + maxSize = 1024; break; case ETextureQuality.TR_CONFIG_TEXTURE_HIGHEST: - MaxSize = 2048; + maxSize = 2048; break; default: - MaxSize = 512; + maxSize = 512; break; } int w = bmp.Width; int h = bmp.Height; - if (w > MaxSize && w > h) + if (w > maxSize && w > h) { - h = (int)Math.Round((float)MaxSize / bmp.Width * bmp.Height); - w = MaxSize; + h = (int)Math.Round((float)maxSize / bmp.Width * bmp.Height); + w = maxSize; } - if (h > MaxSize) + if (h > maxSize) { - w = (int)Math.Round((float)MaxSize / bmp.Height * bmp.Width); - h = MaxSize; + w = (int)Math.Round((float)maxSize / bmp.Height * bmp.Width); + h = maxSize; } //Older graphics card can only handle textures with sizes being powers of two - w = (int)CheckForNextPowerOf2(w); - h = (int)CheckForNextPowerOf2(h); + w = (int)_CheckForNextPowerOf2(w); + h = (int)_CheckForNextPowerOf2(h); Bitmap bmp2 = null; - byte[] Data; + byte[] data; try { if (w != bmp.Width || h != bmp.Height) @@ -933,10 +934,10 @@ namespace Vocaluxe.Lib.Draw } //Fill the new Bitmap with the texture data - BitmapData bmp_data = bmp.LockBits(new Rectangle(0, 0, w, h), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb); - Data = new byte[4 * w * h]; - Marshal.Copy(bmp_data.Scan0, Data, 0, Data.Length); - bmp.UnlockBits(bmp_data); + BitmapData bmpData = bmp.LockBits(new Rectangle(0, 0, w, h), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb); + data = new byte[4 * w * h]; + Marshal.Copy(bmpData.Scan0, data, 0, data.Length); + bmp.UnlockBits(bmpData); } finally { @@ -944,7 +945,7 @@ namespace Vocaluxe.Lib.Draw bmp2.Dispose(); } - return AddTexture(w, h, ref Data); + return AddTexture(w, h, ref data); } /// @@ -957,56 +958,56 @@ namespace Vocaluxe.Lib.Draw return AddTexture(bmp, String.Empty); } - public STexture AddTexture(int W, int H, IntPtr Data) + public STexture AddTexture(int w, int h, IntPtr data) { - byte[] PointerData = new Byte[4 * W * H]; - Marshal.Copy(Data, PointerData, 0, PointerData.Length); - return AddTexture(W, H, ref PointerData); + byte[] pointerData = new Byte[4 * w * h]; + Marshal.Copy(data, pointerData, 0, pointerData.Length); + return AddTexture(w, h, ref pointerData); } - public STexture AddTexture(int W, int H, ref byte[] Data) + public STexture AddTexture(int w, int h, ref byte[] data) { STexture texture = new STexture(-1); - Texture t = _CreateTexture(W, H, ref Data, ref texture); + Texture t = _CreateTexture(w, h, ref data, ref texture); - lock (MutexTexture) + lock (_MutexTexture) { _D3DTextures.Add(_IDs.Peek(), t); - texture.index = _IDs.Dequeue(); - _Textures[texture.index] = texture; + texture.Index = _IDs.Dequeue(); + _Textures[texture.Index] = texture; } return texture; } - private Texture _CreateTexture(int W, int H, ref byte[] Data, ref STexture sTexture) + private Texture _CreateTexture(int w, int h, ref byte[] data, ref STexture texture) { - sTexture.width = W; - sTexture.height = H; - sTexture.w2 = CheckForNextPowerOf2(W); - sTexture.h2 = CheckForNextPowerOf2(H); - sTexture.width_ratio = W / sTexture.w2; - sTexture.height_ratio = H / sTexture.h2; + texture.Width = w; + texture.Height = h; + texture.W2 = _CheckForNextPowerOf2(w); + texture.H2 = _CheckForNextPowerOf2(h); + texture.WidthRatio = w / texture.W2; + texture.HeightRatio = h / texture.H2; //Create a new texture in the managed pool, which does not need to be recreated on a lost device //because a copy of the texture is hold in the Ram Texture t = null; try { - t = new Texture(_Device, (int)sTexture.w2, (int)sTexture.h2, 0, Usage.AutoGenerateMipMap, Format.A8R8G8B8, Pool.Managed); + t = new Texture(_Device, (int)texture.W2, (int)texture.H2, 0, Usage.AutoGenerateMipMap, Format.A8R8G8B8, Pool.Managed); //Lock the texture and fill it with the data DataRectangle rect = t.LockRectangle(0, LockFlags.Discard); - for (int i = 0; i < Data.Length; i += 4 * W) + for (int i = 0; i < data.Length; i += 4 * w) { - rect.Data.Write(Data, i, 4 * (int)sTexture.w2); - rect.Data.Position = rect.Data.Position - 4 * (int)sTexture.w2; + rect.Data.Write(data, i, 4 * (int)texture.W2); + rect.Data.Position = rect.Data.Position - 4 * (int)texture.W2; rect.Data.Position += rect.Pitch; } t.UnlockRectangle(0); - sTexture.color = new SColorF(1f, 1f, 1f, 1f); - sTexture.rect = new SRectF(0f, 0f, sTexture.width, sTexture.height, 0f); - sTexture.TexturePath = String.Empty; + texture.Color = new SColorF(1f, 1f, 1f, 1f); + texture.Rect = new SRectF(0f, 0f, texture.Width, texture.Height, 0f); + texture.TexturePath = String.Empty; } catch (Exception) { @@ -1017,24 +1018,24 @@ namespace Vocaluxe.Lib.Draw return t; } - public STexture QuequeTexture(int W, int H, ref byte[] Data) + public STexture QuequeTexture(int w, int h, ref byte[] data) { STexture texture = new STexture(-1); STextureQueque queque = new STextureQueque(); - queque.data = Data; - queque.height = H; - queque.width = W; - texture.height = H; - texture.width = W; + queque.Data = data; + queque.Height = h; + queque.Width = w; + texture.Height = h; + texture.Width = w; - lock (MutexTexture) + lock (_MutexTexture) { _D3DTextures.Add(_IDs.Peek(), null); - texture.index = _IDs.Dequeue(); - queque.ID = texture.index; + texture.Index = _IDs.Dequeue(); + queque.ID = texture.Index; _Queque.Add(queque); - _Textures[texture.index] = texture; + _Textures[texture.Index] = texture; } return texture; } @@ -1044,38 +1045,38 @@ namespace Vocaluxe.Lib.Draw /// /// Updates the data of a texture /// - /// The texture to update - /// A Pointer containing the data of which the texture should be updated + /// The texture to update + /// A Pointer containing the data of which the texture should be updated /// True if succeeded - public bool UpdateTexture(ref STexture Texture, IntPtr Data) + public bool UpdateTexture(ref STexture texture, IntPtr data) { - byte[] PointerData = new Byte[4 * (int)Texture.width * (int)Texture.height]; - Marshal.Copy(Data, PointerData, 0, PointerData.Length); + byte[] pointerData = new Byte[4 * (int)texture.Width * (int)texture.Height]; + Marshal.Copy(data, pointerData, 0, pointerData.Length); - return UpdateTexture(ref Texture, ref PointerData); + return UpdateTexture(ref texture, ref pointerData); } /// /// Updates the data of a texture /// - /// The texture to update - /// A byte array containing the new texture's data + /// The texture to update + /// A byte array containing the new texture's data /// True if succeeded - public bool UpdateTexture(ref STexture Texture, ref byte[] Data) + public bool UpdateTexture(ref STexture texture, ref byte[] data) { - if ((Texture.index >= 0) && (_Textures.Count > 0) && _TextureExists(ref Texture)) + if ((texture.Index >= 0) && (_Textures.Count > 0) && _TextureExists(ref texture)) { - lock (MutexTexture) + lock (_MutexTexture) { - DataRectangle rect = _D3DTextures[Texture.index].LockRectangle(0, LockFlags.Discard); - int W = (int)Texture.width; - for (int i = 0; i < Data.Length; i += 4 * W) + DataRectangle rect = _D3DTextures[texture.Index].LockRectangle(0, LockFlags.Discard); + int w = (int)texture.Width; + for (int i = 0; i < data.Length; i += 4 * w) { - rect.Data.Write(Data, i, 4 * W); - rect.Data.Position -= 4 * W; + rect.Data.Write(data, i, 4 * w); + rect.Data.Position -= 4 * w; rect.Data.Position += rect.Pitch; } - _D3DTextures[Texture.index].UnlockRectangle(0); + _D3DTextures[texture.Index].UnlockRectangle(0); } //Flamefire: Unneccesary as height can not be changed by this! (Texture gets copied) @@ -1108,17 +1109,17 @@ namespace Vocaluxe.Lib.Draw /// /// Checks if a texture exists /// - /// The texture to check + /// The texture to check /// True if the texture exists - private bool _TextureExists(ref STexture Texture) + private bool _TextureExists(ref STexture texture) { - lock (MutexTexture) + lock (_MutexTexture) { - if (_Textures.ContainsKey(Texture.index)) + if (_Textures.ContainsKey(texture.Index)) { - if (_Textures[Texture.index].index >= 0) + if (_Textures[texture.Index].Index >= 0) { - Texture = _Textures[Texture.index]; + texture = _Textures[texture.Index]; return true; } } @@ -1129,19 +1130,19 @@ namespace Vocaluxe.Lib.Draw /// /// Removes a texture from the Vram /// - /// The texture to be removed - public void RemoveTexture(ref STexture Texture) + /// The texture to be removed + public void RemoveTexture(ref STexture texture) { - lock (MutexTexture) + lock (_MutexTexture) { - if ((Texture.index >= 0) && (_Textures.Count > 0)) + if ((texture.Index >= 0) && (_Textures.Count > 0)) { - _D3DTextures[Texture.index].Dispose(); - _D3DTextures.Remove(Texture.index); - _Textures.Remove(Texture.index); - _IDs.Enqueue(Texture.index); - Texture.index = -1; - Texture.ID = -1; + _D3DTextures[texture.Index].Dispose(); + _D3DTextures.Remove(texture.Index); + _Textures.Remove(texture.Index); + _IDs.Enqueue(texture.Index); + texture.Index = -1; + texture.ID = -1; } } } @@ -1150,89 +1151,89 @@ namespace Vocaluxe.Lib.Draw /// /// Draws a texture /// - /// The texture to be drawn - public void DrawTexture(STexture Texture) + /// The texture to be drawn + public void DrawTexture(STexture texture) { - DrawTexture(Texture, Texture.rect, Texture.color); + DrawTexture(texture, texture.Rect, texture.Color); } /// /// Draws a texture /// - /// The texture to be drawn + /// The texture to be drawn /// A SRectF struct containing the destination coordinates - public void DrawTexture(STexture Texture, SRectF rect) + public void DrawTexture(STexture texture, SRectF rect) { - DrawTexture(Texture, rect, Texture.color, false); + DrawTexture(texture, rect, texture.Color, false); } /// /// Draws a texture /// - /// The texture to be drawn + /// The texture to be drawn /// A SRectF struct containing the destination coordinates /// A SColorF struct containing a color which the texture will be colored in - public void DrawTexture(STexture Texture, SRectF rect, SColorF color) + public void DrawTexture(STexture texture, SRectF rect, SColorF color) { - DrawTexture(Texture, rect, color, false); + DrawTexture(texture, rect, color, false); } /// /// Draws a texture /// - /// The texture to be drawn + /// The texture to be drawn /// A SRectF struct containing the destination coordinates /// A SColorF struct containing a color which the texture will be colored in /// A SRectF struct containing which part of the texture should be drawn - public void DrawTexture(STexture Texture, SRectF rect, SColorF color, SRectF bounds) + public void DrawTexture(STexture texture, SRectF rect, SColorF color, SRectF bounds) { - DrawTexture(Texture, rect, color, bounds, false); + DrawTexture(texture, rect, color, bounds, false); } /// /// Draws a texture /// - /// The texture to be drawn + /// The texture to be drawn /// A SRectF struct containing the destination coordinates /// A SColorF struct containing a color which the texture will be colored in /// True if the texture should be mirrored - public void DrawTexture(STexture Texture, SRectF rect, SColorF color, bool mirrored) + public void DrawTexture(STexture texture, SRectF rect, SColorF color, bool mirrored) { - DrawTexture(Texture, rect, color, new SRectF(0, 0, CSettings.iRenderW, CSettings.iRenderH, rect.Z), mirrored); + DrawTexture(texture, rect, color, new SRectF(0, 0, CSettings.RenderW, CSettings.RenderH, rect.Z), mirrored); } /// /// Draws a texture /// - /// The texture to be drawn + /// The texture to be drawn /// A SRectF struct containing the destination coordinates /// A SColorF struct containing a color which the texture will be colored in /// A SRectF struct containing which part of the texture should be drawn /// True if the texture should be mirrored - public void DrawTexture(STexture Texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored) + public void DrawTexture(STexture texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored) { - if (_TextureExists(ref Texture)) + if (_TextureExists(ref texture)) { - if (_D3DTextures[Texture.index] == null) + if (_D3DTextures[texture.Index] == null) return; //Calculate the position - float x1 = (bounds.X - rect.X) / rect.W * Texture.width_ratio; - float x2 = (bounds.X + bounds.W - rect.X) / rect.W * Texture.width_ratio; - float y1 = (bounds.Y - rect.Y) / rect.H * Texture.height_ratio; - float y2 = (bounds.Y + bounds.H - rect.Y) / rect.H * Texture.height_ratio; + float x1 = (bounds.X - rect.X) / rect.W * texture.WidthRatio; + float x2 = (bounds.X + bounds.W - rect.X) / rect.W * texture.WidthRatio; + float y1 = (bounds.Y - rect.Y) / rect.H * texture.HeightRatio; + float y2 = (bounds.Y + bounds.H - rect.Y) / rect.H * texture.HeightRatio; if (x1 < 0) x1 = 0f; - if (x2 > Texture.width_ratio) - x2 = Texture.width_ratio; + if (x2 > texture.WidthRatio) + x2 = texture.WidthRatio; if (y1 < 0) y1 = 0f; - if (y2 > Texture.height_ratio) - y2 = Texture.height_ratio; + if (y2 > texture.HeightRatio) + y2 = texture.HeightRatio; //Calculate the size float rx1 = rect.X; @@ -1271,21 +1272,21 @@ namespace Vocaluxe.Lib.Draw if (!mirrored) { - TexturedColoredVertex[] vert = new TexturedColoredVertex[4]; - vert[0] = new TexturedColoredVertex(new Vector3(rx1, -ry1, rect.Z + CGraphics.ZOffset), new Vector2(x1, y1), c.ToArgb()); - vert[1] = new TexturedColoredVertex(new Vector3(rx1, -ry2, rect.Z + CGraphics.ZOffset), new Vector2(x1, y2), c.ToArgb()); - vert[2] = new TexturedColoredVertex(new Vector3(rx2, -ry2, rect.Z + CGraphics.ZOffset), new Vector2(x2, y2), c.ToArgb()); - vert[3] = new TexturedColoredVertex(new Vector3(rx2, -ry1, rect.Z + CGraphics.ZOffset), new Vector2(x2, y1), c.ToArgb()); - AddToVertexBuffer(vert, _D3DTextures[Texture.index], CalculateRotationMatrix(rect.Rotation, rx1, rx2, ry1, ry2)); + STexturedColoredVertex[] vert = new STexturedColoredVertex[4]; + vert[0] = new STexturedColoredVertex(new Vector3(rx1, -ry1, rect.Z + CGraphics.ZOffset), new Vector2(x1, y1), c.ToArgb()); + vert[1] = new STexturedColoredVertex(new Vector3(rx1, -ry2, rect.Z + CGraphics.ZOffset), new Vector2(x1, y2), c.ToArgb()); + vert[2] = new STexturedColoredVertex(new Vector3(rx2, -ry2, rect.Z + CGraphics.ZOffset), new Vector2(x2, y2), c.ToArgb()); + vert[3] = new STexturedColoredVertex(new Vector3(rx2, -ry1, rect.Z + CGraphics.ZOffset), new Vector2(x2, y1), c.ToArgb()); + _AddToVertexBuffer(vert, _D3DTextures[texture.Index], _CalculateRotationMatrix(rect.Rotation, rx1, rx2, ry1, ry2)); } else { - TexturedColoredVertex[] vert = new TexturedColoredVertex[4]; - vert[0] = new TexturedColoredVertex(new Vector3(rx1, -ry1, rect.Z + CGraphics.ZOffset), new Vector2(x1, -y1), c.ToArgb()); - vert[1] = new TexturedColoredVertex(new Vector3(rx1, -ry2, rect.Z + CGraphics.ZOffset), new Vector2(x1, -y2), c.ToArgb()); - vert[2] = new TexturedColoredVertex(new Vector3(rx2, -ry2, rect.Z + CGraphics.ZOffset), new Vector2(x2, -y2), c.ToArgb()); - vert[3] = new TexturedColoredVertex(new Vector3(rx2, -ry1, rect.Z + CGraphics.ZOffset), new Vector2(x2, -y1), c.ToArgb()); - AddToVertexBuffer(vert, _D3DTextures[Texture.index], CalculateRotationMatrix(rect.Rotation, rx1, rx2, ry1, ry2)); + STexturedColoredVertex[] vert = new STexturedColoredVertex[4]; + vert[0] = new STexturedColoredVertex(new Vector3(rx1, -ry1, rect.Z + CGraphics.ZOffset), new Vector2(x1, -y1), c.ToArgb()); + vert[1] = new STexturedColoredVertex(new Vector3(rx1, -ry2, rect.Z + CGraphics.ZOffset), new Vector2(x1, -y2), c.ToArgb()); + vert[2] = new STexturedColoredVertex(new Vector3(rx2, -ry2, rect.Z + CGraphics.ZOffset), new Vector2(x2, -y2), c.ToArgb()); + vert[3] = new STexturedColoredVertex(new Vector3(rx2, -ry1, rect.Z + CGraphics.ZOffset), new Vector2(x2, -y1), c.ToArgb()); + _AddToVertexBuffer(vert, _D3DTextures[texture.Index], _CalculateRotationMatrix(rect.Rotation, rx1, rx2, ry1, ry2)); } } } @@ -1293,22 +1294,22 @@ namespace Vocaluxe.Lib.Draw /// /// Draws a texture /// - /// The texture to be drawn + /// The texture to be drawn /// A SRectF struct containing the destination coordinates /// A SColorF struct containing a color which the texture will be colored in /// A Value ranging from 0 to 1 containing the beginning of the texture /// A Value ranging from 0 to 1 containing the ending of the texture - public void DrawTexture(STexture Texture, SRectF rect, SColorF color, float begin, float end) + public void DrawTexture(STexture texture, SRectF rect, SColorF color, float begin, float end) { - if (_TextureExists(ref Texture)) + if (_TextureExists(ref texture)) { - if (_D3DTextures[Texture.index] == null) + if (_D3DTextures[texture.Index] == null) return; - float x1 = 0f + begin * Texture.width_ratio; - float x2 = Texture.width_ratio * end; + float x1 = 0f + begin * texture.WidthRatio; + float x2 = texture.WidthRatio * end; float y1 = 0f; - float y2 = Texture.height_ratio; + float y2 = texture.HeightRatio; float rx1 = rect.X + begin * rect.W; float rx2 = rect.X + end * rect.W; @@ -1323,29 +1324,29 @@ namespace Vocaluxe.Lib.Draw Color c = Color.FromArgb((int)(color.A * 255 * CGraphics.GlobalAlpha), (int)(color.R * 255), (int)(color.G * 255), (int)(color.B * 255)); - TexturedColoredVertex[] vert = new TexturedColoredVertex[4]; - vert[0] = new TexturedColoredVertex(new Vector3(rx1, -ry1, rect.Z + CGraphics.ZOffset), new Vector2(x1, y1), c.ToArgb()); - vert[1] = new TexturedColoredVertex(new Vector3(rx1, -ry2, rect.Z + CGraphics.ZOffset), new Vector2(x1, y2), c.ToArgb()); - vert[2] = new TexturedColoredVertex(new Vector3(rx2, -ry2, rect.Z + CGraphics.ZOffset), new Vector2(x2, y2), c.ToArgb()); - vert[3] = new TexturedColoredVertex(new Vector3(rx2, -ry1, rect.Z + CGraphics.ZOffset), new Vector2(x2, y1), c.ToArgb()); - AddToVertexBuffer(vert, _D3DTextures[Texture.index], CalculateRotationMatrix(rect.Rotation, rx1, rx2, ry1, ry2)); + STexturedColoredVertex[] vert = new STexturedColoredVertex[4]; + vert[0] = new STexturedColoredVertex(new Vector3(rx1, -ry1, rect.Z + CGraphics.ZOffset), new Vector2(x1, y1), c.ToArgb()); + vert[1] = new STexturedColoredVertex(new Vector3(rx1, -ry2, rect.Z + CGraphics.ZOffset), new Vector2(x1, y2), c.ToArgb()); + vert[2] = new STexturedColoredVertex(new Vector3(rx2, -ry2, rect.Z + CGraphics.ZOffset), new Vector2(x2, y2), c.ToArgb()); + vert[3] = new STexturedColoredVertex(new Vector3(rx2, -ry1, rect.Z + CGraphics.ZOffset), new Vector2(x2, y1), c.ToArgb()); + _AddToVertexBuffer(vert, _D3DTextures[texture.Index], _CalculateRotationMatrix(rect.Rotation, rx1, rx2, ry1, ry2)); } } /// /// Draws a reflection of a texture /// - /// The texture of which a reflection should be drawn + /// The texture of which a reflection should be drawn /// A SRectF struct containing the destination coordinates /// A SColorF struct containing a color which the texture will be colored in /// A SRectF struct containing which part of the texture should be drawn /// The space between the texture and the reflection /// The height of the reflection - public void DrawTextureReflection(STexture Texture, SRectF rect, SColorF color, SRectF bounds, float space, float height) + public void DrawTextureReflection(STexture texture, SRectF rect, SColorF color, SRectF bounds, float space, float height) { - if (_TextureExists(ref Texture)) + if (_TextureExists(ref texture)) { - if (_D3DTextures[Texture.index] == null) + if (_D3DTextures[texture.Index] == null) return; if (rect.W == 0f || rect.H == 0f || bounds.H == 0f || bounds.W == 0f || color.A == 0f || height <= 0f) @@ -1360,24 +1361,24 @@ namespace Vocaluxe.Lib.Draw if (height > bounds.H) height = bounds.H; - if (_TextureExists(ref Texture)) + if (_TextureExists(ref texture)) { - float x1 = (bounds.X - rect.X) / rect.W * Texture.width_ratio; - float x2 = (bounds.X + bounds.W - rect.X) / rect.W * Texture.width_ratio; - float y1 = (bounds.Y - rect.Y + rect.H - height) / rect.H * Texture.height_ratio; - float y2 = (bounds.Y + bounds.H - rect.Y) / rect.H * Texture.height_ratio; + float x1 = (bounds.X - rect.X) / rect.W * texture.WidthRatio; + float x2 = (bounds.X + bounds.W - rect.X) / rect.W * texture.WidthRatio; + float y1 = (bounds.Y - rect.Y + rect.H - height) / rect.H * texture.HeightRatio; + float y2 = (bounds.Y + bounds.H - rect.Y) / rect.H * texture.HeightRatio; if (x1 < 0) x1 = 0f; - if (x2 > Texture.width_ratio) - x2 = Texture.width_ratio; + if (x2 > texture.WidthRatio) + x2 = texture.WidthRatio; if (y1 < 0) y1 = 0f; - if (y2 > Texture.height_ratio) - y2 = Texture.height_ratio; + if (y2 > texture.HeightRatio) + y2 = texture.HeightRatio; float rx1 = rect.X; @@ -1406,20 +1407,20 @@ namespace Vocaluxe.Lib.Draw Color c = Color.FromArgb((int)(color.A * 255 * CGraphics.GlobalAlpha), (int)(color.R * 255), (int)(color.G * 255), (int)(color.B * 255)); Color transparent = Color.FromArgb(0, (int)(color.R * 255), (int)(color.G * 255), (int)(color.B * 255)); - TexturedColoredVertex[] vert = new TexturedColoredVertex[4]; - vert[0] = new TexturedColoredVertex(new Vector3(rx1, -ry1, rect.Z + CGraphics.ZOffset), new Vector2(x1, y2), c.ToArgb()); - vert[1] = new TexturedColoredVertex(new Vector3(rx1, -ry2, rect.Z + CGraphics.ZOffset), new Vector2(x1, y1), transparent.ToArgb()); - vert[2] = new TexturedColoredVertex(new Vector3(rx2, -ry2, rect.Z + CGraphics.ZOffset), new Vector2(x2, y1), transparent.ToArgb()); - vert[3] = new TexturedColoredVertex(new Vector3(rx2, -ry1, rect.Z + CGraphics.ZOffset), new Vector2(x2, y2), c.ToArgb()); - AddToVertexBuffer(vert, _D3DTextures[Texture.index], CalculateRotationMatrix(rect.Rotation, rx1, rx2, ry1, ry2)); + STexturedColoredVertex[] vert = new STexturedColoredVertex[4]; + vert[0] = new STexturedColoredVertex(new Vector3(rx1, -ry1, rect.Z + CGraphics.ZOffset), new Vector2(x1, y2), c.ToArgb()); + vert[1] = new STexturedColoredVertex(new Vector3(rx1, -ry2, rect.Z + CGraphics.ZOffset), new Vector2(x1, y1), transparent.ToArgb()); + vert[2] = new STexturedColoredVertex(new Vector3(rx2, -ry2, rect.Z + CGraphics.ZOffset), new Vector2(x2, y1), transparent.ToArgb()); + vert[3] = new STexturedColoredVertex(new Vector3(rx2, -ry1, rect.Z + CGraphics.ZOffset), new Vector2(x2, y2), c.ToArgb()); + _AddToVertexBuffer(vert, _D3DTextures[texture.Index], _CalculateRotationMatrix(rect.Rotation, rx1, rx2, ry1, ry2)); } } } #endregion drawing - private void CheckQueque() + private void _CheckQueque() { - lock (MutexTexture) + lock (_MutexTexture) { if (_Queque.Count == 0) return; @@ -1431,10 +1432,10 @@ namespace Vocaluxe.Lib.Draw else return; - Texture t = _CreateTexture(q.width, q.height, ref q.data, ref texture); + Texture t = _CreateTexture(q.Width, q.Height, ref q.Data, ref texture); _D3DTextures[q.ID] = t; - _Textures[texture.index] = texture; + _Textures[texture.Index] = texture; _Queque.RemoveAt(0); } } @@ -1457,7 +1458,7 @@ namespace Vocaluxe.Lib.Draw /// /// The value of which the next power of two will be calculated /// The next power of two - private float CheckForNextPowerOf2(float n) + private float _CheckForNextPowerOf2(float n) { if (!_NonPowerOf2TextureSupported) { @@ -1469,9 +1470,9 @@ namespace Vocaluxe.Lib.Draw return n; } - private SlimDX.Matrix CalculateRotationMatrix(float rot, float rx1, float rx2, float ry1, float ry2) + private SlimDX.Matrix _CalculateRotationMatrix(float rot, float rx1, float rx2, float ry1, float ry2) { - SlimDX.Matrix originTranslation = SlimDX.Matrix.Translation(new Vector3(-CSettings.iRenderW / 2, CSettings.iRenderH / 2, 0)); + SlimDX.Matrix originTranslation = SlimDX.Matrix.Translation(new Vector3(-CSettings.RenderW / 2, CSettings.RenderH / 2, 0)); if (rot != 0) { float rotation = rot * (float)Math.PI / 180; @@ -1494,9 +1495,9 @@ namespace Vocaluxe.Lib.Draw #endregion utility #region TexturedColoredVertex - public struct TexturedColoredVertex + public struct STexturedColoredVertex { - private static VertexDeclaration sDeclaration; + private static VertexDeclaration _Declaration; public static VertexElement[] Elements = { new VertexElement(0, 0, DeclarationType.Float3, DeclarationMethod.Default, DeclarationUsage.Position, 0), @@ -1509,7 +1510,7 @@ namespace Vocaluxe.Lib.Draw public Vector2 Texture; public int Color; - public TexturedColoredVertex(Vector3 position, Vector2 texture, int color) + public STexturedColoredVertex(Vector3 position, Vector2 texture, int color) { Position = position; Texture = texture; @@ -1518,10 +1519,10 @@ namespace Vocaluxe.Lib.Draw public static VertexDeclaration GetDeclaration(Device device) { - if (sDeclaration == null || sDeclaration.Disposed) - sDeclaration = new VertexDeclaration(device, Elements); + if (_Declaration == null || _Declaration.Disposed) + _Declaration = new VertexDeclaration(device, Elements); - return sDeclaration; + return _Declaration; } } #endregion TexturedColoredVertex diff --git a/Vocaluxe/Lib/Draw/CDrawWinForm.cs b/Vocaluxe/Lib/Draw/CDrawWinForm.cs index 7090ad30..2c0741b3 100644 --- a/Vocaluxe/Lib/Draw/CDrawWinForm.cs +++ b/Vocaluxe/Lib/Draw/CDrawWinForm.cs @@ -15,25 +15,25 @@ namespace Vocaluxe.Lib.Draw class CDrawWinForm : Form, IDraw { private bool _Run; - private readonly Bitmap _backbuffer; - private readonly Graphics _g; - private bool _fullscreen; + private readonly Bitmap _Backbuffer; + private readonly Graphics _G; + private bool _Fullscreen; private readonly CKeys _Keys; private readonly CMouse _Mouse; - private FormBorderStyle _brdStyle; - private bool _topMost; - private Rectangle _bounds; + private FormBorderStyle _BrdStyle; + private bool _TopMost; + private Rectangle _Bounds; private readonly List _Textures; private readonly List _Bitmaps; - private readonly Color ClearColor = Color.DarkBlue; + private readonly Color _ClearColor = Color.DarkBlue; public CDrawWinForm() { - Icon = new Icon(Path.Combine(Environment.CurrentDirectory, CSettings.sIcon)); + Icon = new Icon(Path.Combine(Environment.CurrentDirectory, CSettings.Icon)); _Textures = new List(); _Bitmaps = new List(); @@ -45,34 +45,34 @@ namespace Vocaluxe.Lib.Draw SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.Opaque, true); // Create the backbuffer - _backbuffer = new Bitmap(CSettings.iRenderW, CSettings.iRenderH); - _g = Graphics.FromImage(_backbuffer); - _g.Clear(Color.DarkBlue); + _Backbuffer = new Bitmap(CSettings.RenderW, CSettings.RenderH); + _G = Graphics.FromImage(_Backbuffer); + _G.Clear(Color.DarkBlue); - Paint += OnPaintEvent; - Closing += OnClosingEvent; - KeyDown += OnKeyDownEvent; - KeyPress += OnKeyPressEvent; - KeyUp += OnKeyUpEvent; - Resize += OnResizeEvent; + Paint += _OnPaintEvent; + Closing += _OnClosingEvent; + KeyDown += _OnKeyDownEvent; + KeyPress += _OnKeyPressEvent; + KeyUp += _OnKeyUpEvent; + Resize += _OnResizeEvent; - MouseMove += OnMouseMove; - MouseDown += OnMouseDown; - MouseUp += OnMouseUp; + MouseMove += _OnMouseMove; + MouseDown += _OnMouseDown; + MouseUp += _OnMouseUp; - FlipBuffer(); + _FlipBuffer(); Cursor.Show(); } - private void FlipBuffer() + private void _FlipBuffer() { - DrawBuffer(); - _g.Clear(ClearColor); + _DrawBuffer(); + _G.Clear(_ClearColor); } - private void DrawBuffer() + private void _DrawBuffer() { - Graphics gFrontBuffer = Graphics.FromHwnd(Handle); + Graphics frontBuffer = Graphics.FromHwnd(Handle); int h = ClientSize.Height; int w = ClientSize.Width; int y = 0; @@ -89,61 +89,61 @@ namespace Vocaluxe.Lib.Draw y = (ClientSize.Height - h) / 2; } - gFrontBuffer.DrawImage(_backbuffer, new Rectangle(x, y, w, h), new Rectangle(0, 0, _backbuffer.Width, _backbuffer.Height), GraphicsUnit.Pixel); + frontBuffer.DrawImage(_Backbuffer, new Rectangle(x, y, w, h), new Rectangle(0, 0, _Backbuffer.Width, _Backbuffer.Height), GraphicsUnit.Pixel); } - private void OnPaintEvent(object sender, PaintEventArgs e) {} + private void _OnPaintEvent(object sender, PaintEventArgs e) {} #region FullScreenStuff - private void ToggleFullScreen() + private void _ToggleFullScreen() { - if (!_fullscreen) - Maximize(this); + if (!_Fullscreen) + _Maximize(this); else - Restore(this); + _Restore(this); } - private void Maximize(Form targetForm) + private void _Maximize(Form targetForm) { - if (!_fullscreen) + if (!_Fullscreen) { - Save(targetForm); + _Save(targetForm); targetForm.FormBorderStyle = FormBorderStyle.None; targetForm.Bounds = Screen.PrimaryScreen.Bounds; targetForm.TopMost = true; - _fullscreen = true; + _Fullscreen = true; CConfig.FullScreen = EOffOn.TR_CONFIG_ON; CConfig.SaveConfig(); } } - private void Save(Form targetForm) + private void _Save(Form targetForm) { - _brdStyle = targetForm.FormBorderStyle; - _topMost = targetForm.TopMost; - _bounds = targetForm.Bounds; + _BrdStyle = targetForm.FormBorderStyle; + _TopMost = targetForm.TopMost; + _Bounds = targetForm.Bounds; } - private void Restore(Form targetForm) + private void _Restore(Form targetForm) { - targetForm.FormBorderStyle = _brdStyle; - targetForm.TopMost = _topMost; - targetForm.Bounds = _bounds; - _fullscreen = false; + targetForm.FormBorderStyle = _BrdStyle; + targetForm.TopMost = _TopMost; + targetForm.Bounds = _Bounds; + _Fullscreen = false; CConfig.FullScreen = EOffOn.TR_CONFIG_OFF; CConfig.SaveConfig(); } #endregion FullScreenStuff - private void OnResizeEvent(object sender, EventArgs e) + private void _OnResizeEvent(object sender, EventArgs e) { - Graphics gFrontBuffer = Graphics.FromHwnd(Handle); - gFrontBuffer.Clear(Color.Black); + Graphics frontBuffer = Graphics.FromHwnd(Handle); + frontBuffer.Clear(Color.Black); } - private void OnClosingEvent(object sender, CancelEventArgs e) + private void _OnClosingEvent(object sender, CancelEventArgs e) { _Run = false; } @@ -169,33 +169,33 @@ namespace Vocaluxe.Lib.Draw } } - private void OnKeyDownEvent(object sender, KeyEventArgs e) + private void _OnKeyDownEvent(object sender, KeyEventArgs e) { _Keys.KeyDown(e); } - private void OnKeyPressEvent(object sender, KeyPressEventArgs e) + private void _OnKeyPressEvent(object sender, KeyPressEventArgs e) { _Keys.KeyPress(e); } - private void OnKeyUpEvent(object sender, KeyEventArgs e) + private void _OnKeyUpEvent(object sender, KeyEventArgs e) { _Keys.KeyUp(e); } #region mouse event handlers - private void OnMouseMove(object sender, MouseEventArgs e) + private void _OnMouseMove(object sender, MouseEventArgs e) { _Mouse.MouseMove(e); } - private void OnMouseDown(object sender, MouseEventArgs e) + private void _OnMouseDown(object sender, MouseEventArgs e) { _Mouse.MouseDown(e); } - private void OnMouseUp(object sender, MouseEventArgs e) + private void _OnMouseUp(object sender, MouseEventArgs e) { _Mouse.MouseUp(e); } @@ -216,7 +216,7 @@ namespace Vocaluxe.Lib.Draw if (CConfig.FullScreen == EOffOn.TR_CONFIG_ON) { CSettings.IsFullScreen = true; - Maximize(this); + _Maximize(this); } while (_Run) @@ -227,10 +227,10 @@ namespace Vocaluxe.Lib.Draw { _Run = _Run && CGraphics.Draw(); _Run = CGraphics.UpdateGameLogic(_Keys, _Mouse); - FlipBuffer(); + _FlipBuffer(); - if ((CSettings.IsFullScreen && !_fullscreen) || (!CSettings.IsFullScreen && _fullscreen)) - ToggleFullScreen(); + if ((CSettings.IsFullScreen && !_Fullscreen) || (!CSettings.IsFullScreen && _Fullscreen)) + _ToggleFullScreen(); if (CTime.IsRunning()) delay = (int)Math.Floor(CConfig.CalcCycleTime() - CTime.GetMilliseconds()); @@ -266,9 +266,9 @@ namespace Vocaluxe.Lib.Draw return GetTextBounds(text, text.Height); } - public RectangleF GetTextBounds(CText text, float Height) + public RectangleF GetTextBounds(CText text, float height) { - CFonts.Height = Height; + CFonts.Height = height; CFonts.SetFont(text.Font); CFonts.Style = text.Style; return new RectangleF(text.X, text.Y, CFonts.GetTextWidth(CLanguage.Translate(text.Text)), CFonts.GetTextHeight(CLanguage.Translate(text.Text))); @@ -276,66 +276,66 @@ namespace Vocaluxe.Lib.Draw public void ClearScreen() { - _g.Clear(ClearColor); + _G.Clear(_ClearColor); } public STexture CopyScreen() { STexture texture = new STexture(0); - Bitmap bmp = new Bitmap(_backbuffer); + Bitmap bmp = new Bitmap(_Backbuffer); _Bitmaps.Add(bmp); - texture.index = _Bitmaps.Count - 1; + texture.Index = _Bitmaps.Count - 1; - texture.width = bmp.Width; - texture.height = bmp.Height; + texture.Width = bmp.Width; + texture.Height = bmp.Height; // Add to Texture List - texture.color = new SColorF(1f, 1f, 1f, 1f); - texture.rect = new SRectF(0f, 0f, texture.width, texture.height, 0f); + texture.Color = new SColorF(1f, 1f, 1f, 1f); + texture.Rect = new SRectF(0f, 0f, texture.Width, texture.Height, 0f); _Textures.Add(texture); return texture; } - public void CopyScreen(ref STexture Texture) + public void CopyScreen(ref STexture texture) { - if ((Texture.index == 0) || (Texture.width != GetScreenWidth()) || (Texture.height != GetScreenHeight())) + if ((texture.Index == 0) || (texture.Width != GetScreenWidth()) || (texture.Height != GetScreenHeight())) { - RemoveTexture(ref Texture); - Texture = CopyScreen(); + RemoveTexture(ref texture); + texture = CopyScreen(); } else - _Bitmaps[Texture.index] = new Bitmap(_backbuffer); + _Bitmaps[texture.Index] = new Bitmap(_Backbuffer); } public void MakeScreenShot() { string file = "Screenshot_"; - string path = Path.Combine(Environment.CurrentDirectory, CSettings.sFolderScreenshots); + string path = Path.Combine(Environment.CurrentDirectory, CSettings.FolderScreenshots); int i = 0; while (File.Exists(Path.Combine(path, file + i.ToString("00000") + ".png"))) i++; - _backbuffer.Save(Path.Combine(path, file + i.ToString("00000") + ".png"), ImageFormat.Png); + _Backbuffer.Save(Path.Combine(path, file + i.ToString("00000") + ".png"), ImageFormat.Png); } public void DrawLine(int a, int r, int g, int b, int w, int x1, int y1, int x2, int y2) { - _g.DrawLine(new Pen(Color.FromArgb(a, r, g, b), w), new Point(x1, y1), new Point(x2, y2)); + _G.DrawLine(new Pen(Color.FromArgb(a, r, g, b), w), new Point(x1, y1), new Point(x2, y2)); } // Draw Basic Text - public void DrawText(string Text, int x, int y, int h) + public void DrawText(string text, int x, int y, int h) { - DrawText(Text, x, y, h, 0f); + DrawText(text, x, y, h, 0f); } // Draw Basic Text - public void DrawText(string Text, int x, int y, float h, float z) + public void DrawText(string text, int x, int y, float h, float z) { - CFonts.DrawText(Text, h, x, y, z, new SColorF(1, 1, 1, 1)); + CFonts.DrawText(text, h, x, y, z, new SColorF(1, 1, 1, 1)); } public void DrawColor(SColorF color, SRectF rect) {} @@ -348,14 +348,14 @@ namespace Vocaluxe.Lib.Draw _Bitmaps.Add(bmp2); STexture texture = new STexture(); - texture.index = _Bitmaps.Count - 1; + texture.Index = _Bitmaps.Count - 1; - texture.width = bmp.Width; - texture.height = bmp.Height; + texture.Width = bmp.Width; + texture.Height = bmp.Height; // Add to Texture List - texture.color = new SColorF(1f, 1f, 1f, 1f); - texture.rect = new SRectF(0f, 0f, texture.width, texture.height, 0f); + texture.Color = new SColorF(1f, 1f, 1f, 1f); + texture.Rect = new SRectF(0f, 0f, texture.Width, texture.Height, 0f); texture.TexturePath = String.Empty; _Textures.Add(texture); @@ -363,15 +363,15 @@ namespace Vocaluxe.Lib.Draw return texture; } - public STexture AddTexture(string TexturePath) + public STexture AddTexture(string texturePath) { STexture texture = new STexture(); - if (File.Exists(TexturePath)) + if (File.Exists(texturePath)) { bool found = false; foreach (STexture tex in _Textures) { - if (tex.TexturePath == TexturePath) + if (tex.TexturePath == texturePath) { texture = tex; found = true; @@ -381,7 +381,7 @@ namespace Vocaluxe.Lib.Draw if (!found) { - using (Bitmap bmp = new Bitmap(TexturePath)) + using (Bitmap bmp = new Bitmap(texturePath)) return AddTexture(bmp); } } @@ -389,104 +389,104 @@ namespace Vocaluxe.Lib.Draw return texture; } - public void RemoveTexture(ref STexture Texture) + public void RemoveTexture(ref STexture texture) { - if ((Texture.index >= 0) && (_Textures.Count > 0)) + if ((texture.Index >= 0) && (_Textures.Count > 0)) { for (int i = 0; i < _Textures.Count; i++) { - if (_Textures[i].index == Texture.index) + if (_Textures[i].Index == texture.Index) { - _Bitmaps[Texture.index].Dispose(); + _Bitmaps[texture.Index].Dispose(); _Textures.RemoveAt(i); - Texture.index = -1; + texture.Index = -1; break; } } } } - public STexture AddTexture(int W, int H, IntPtr Data) + public STexture AddTexture(int w, int h, IntPtr data) { return new STexture(-1); } - public STexture QuequeTexture(int W, int H, ref byte[] Data) + public STexture QuequeTexture(int w, int h, ref byte[] data) { - return AddTexture(W, H, ref Data); + return AddTexture(w, h, ref data); } - public STexture AddTexture(int W, int H, ref byte[] Data) + public STexture AddTexture(int w, int h, ref byte[] data) { - using (Bitmap bmp = new Bitmap(W, H)) + using (Bitmap bmp = new Bitmap(w, h)) { - BitmapData bmp_data = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb); - Marshal.Copy(Data, 0, bmp_data.Scan0, Data.Length); - bmp.UnlockBits(bmp_data); + BitmapData bmpData = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb); + Marshal.Copy(data, 0, bmpData.Scan0, data.Length); + bmp.UnlockBits(bmpData); return AddTexture(bmp); } } - public bool UpdateTexture(ref STexture Texture, IntPtr Data) + public bool UpdateTexture(ref STexture texture, IntPtr data) { return true; } - public bool UpdateTexture(ref STexture Texture, ref byte[] Data) + public bool UpdateTexture(ref STexture texture, ref byte[] data) { - if ((Texture.index >= 0) && (_Textures.Count > 0) && (_Bitmaps.Count > Texture.index)) + if ((texture.Index >= 0) && (_Textures.Count > 0) && (_Bitmaps.Count > texture.Index)) { - BitmapData bmp_data = _Bitmaps[Texture.index].LockBits(new Rectangle(0, 0, _Bitmaps[Texture.index].Width, _Bitmaps[Texture.index].Height), + BitmapData bmpData = _Bitmaps[texture.Index].LockBits(new Rectangle(0, 0, _Bitmaps[texture.Index].Width, _Bitmaps[texture.Index].Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb); - Marshal.Copy(Data, 0, bmp_data.Scan0, Data.Length); - _Bitmaps[Texture.index].UnlockBits(bmp_data); + Marshal.Copy(data, 0, bmpData.Scan0, data.Length); + _Bitmaps[texture.Index].UnlockBits(bmpData); } return true; } - public void DrawTexture(STexture Texture) + public void DrawTexture(STexture texture) { - if ((Texture.index >= 0) && (_Textures.Count > 0) && (_Bitmaps.Count > Texture.index)) - DrawTexture(Texture, Texture.rect, Texture.color); + if ((texture.Index >= 0) && (_Textures.Count > 0) && (_Bitmaps.Count > texture.Index)) + DrawTexture(texture, texture.Rect, texture.Color); } - public void DrawTexture(STexture Texture, SRectF rect) + public void DrawTexture(STexture texture, SRectF rect) { - if ((Texture.index >= 0) && (_Textures.Count > 0) && (_Bitmaps.Count > Texture.index)) - DrawTexture(Texture, rect, Texture.color); + if ((texture.Index >= 0) && (_Textures.Count > 0) && (_Bitmaps.Count > texture.Index)) + DrawTexture(texture, rect, texture.Color); } - public void DrawTexture(STexture Texture, SRectF rect, SColorF color) + public void DrawTexture(STexture texture, SRectF rect, SColorF color) { - if ((Texture.index >= 0) && (_Textures.Count > 0) && (_Bitmaps.Count > Texture.index)) - DrawTexture(Texture, rect, color, rect, false); + if ((texture.Index >= 0) && (_Textures.Count > 0) && (_Bitmaps.Count > texture.Index)) + DrawTexture(texture, rect, color, rect, false); } - public void DrawTexture(STexture Texture, SRectF rect, SColorF color, SRectF bounds) + public void DrawTexture(STexture texture, SRectF rect, SColorF color, SRectF bounds) { - if ((Texture.index >= 0) && (_Textures.Count > 0) && (_Bitmaps.Count > Texture.index)) - DrawTexture(Texture, rect, color, bounds, false); + if ((texture.Index >= 0) && (_Textures.Count > 0) && (_Bitmaps.Count > texture.Index)) + DrawTexture(texture, rect, color, bounds, false); } - public void DrawTexture(STexture Texture, SRectF rect, SColorF color, bool mirrored) + public void DrawTexture(STexture texture, SRectF rect, SColorF color, bool mirrored) { - if ((Texture.index >= 0) && (_Textures.Count > 0) && (_Bitmaps.Count > Texture.index)) - DrawTexture(Texture, rect, color, rect, mirrored); + if ((texture.Index >= 0) && (_Textures.Count > 0) && (_Bitmaps.Count > texture.Index)) + DrawTexture(texture, rect, color, rect, mirrored); } - public void DrawTexture(STexture Texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored) + public void DrawTexture(STexture texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored) { - if ((Texture.index >= 0) && (_Textures.Count > 0) && (_Bitmaps.Count > Texture.index)) + if ((texture.Index >= 0) && (_Textures.Count > 0) && (_Bitmaps.Count > texture.Index)) { - Bitmap ColoredBitmap = ColorizeBitmap(_Bitmaps[Texture.index], color); - _g.DrawImage(ColoredBitmap, new RectangleF(rect.X, rect.Y, rect.W, rect.H)); - ColoredBitmap.Dispose(); + Bitmap coloredBitmap = ColorizeBitmap(_Bitmaps[texture.Index], color); + _G.DrawImage(coloredBitmap, new RectangleF(rect.X, rect.Y, rect.W, rect.H)); + coloredBitmap.Dispose(); } } - public void DrawTexture(STexture Texture, SRectF rect, SColorF color, float begin, float end) {} + public void DrawTexture(STexture texture, SRectF rect, SColorF color, float begin, float end) {} - public void DrawTextureReflection(STexture Texture, SRectF rect, SColorF color, SRectF bounds, float space, float height) {} + public void DrawTextureReflection(STexture texture, SRectF rect, SColorF color, SRectF bounds, float space, float height) {} public int TextureCount() { diff --git a/Vocaluxe/Lib/Draw/COpenGL.cs b/Vocaluxe/Lib/Draw/COpenGL.cs index 534a77a8..1de47f3d 100644 --- a/Vocaluxe/Lib/Draw/COpenGL.cs +++ b/Vocaluxe/Lib/Draw/COpenGL.cs @@ -18,17 +18,17 @@ namespace Vocaluxe.Lib.Draw { struct SClientRect { - public Point location; - public int width; - public int height; + public Point Location; + public int Width; + public int Height; }; struct STextureQueque { public int ID; - public int width; - public int height; - public byte[] data; + public int Width; + public int Height; + public byte[] Data; } class COpenGL : Form, IDraw @@ -38,28 +38,28 @@ namespace Vocaluxe.Lib.Draw private readonly CMouse _Mouse; private bool _Run; - private readonly GLControl control; + private readonly GLControl _Control; - private SClientRect _restore; - private bool _fullscreen; + private SClientRect _Restore; + private bool _Fullscreen; private readonly Dictionary _Textures; private readonly Queue _IDs; private readonly List _Queque; - private readonly Object MutexTexture = new Object(); + private readonly Object _MutexTexture = new Object(); - private int h = 1; - private int w = 1; - private int y; - private int x; + private int _H = 1; + private int _W = 1; + private int _Y; + private int _X; private bool _UsePBO; #endregion private vars public COpenGL() { - Icon = new Icon(Path.Combine(Environment.CurrentDirectory, CSettings.sIcon)); + Icon = new Icon(Path.Combine(Environment.CurrentDirectory, CSettings.Icon)); _Textures = new Dictionary(); _Queque = new List(); @@ -69,7 +69,7 @@ namespace Vocaluxe.Lib.Draw _IDs.Enqueue(i); //Check AA Mode - CConfig.AAMode = (EAntiAliasingModes)CheckAntiAliasingMode((int)CConfig.AAMode); + CConfig.AAMode = (EAntiAliasingModes)_CheckAntiAliasingMode((int)CConfig.AAMode); ColorFormat cf = new ColorFormat(32); GraphicsMode gm; @@ -78,8 +78,8 @@ namespace Vocaluxe.Lib.Draw try { gm = new GraphicsMode(cf, 24, 0, (int)CConfig.AAMode); - control = new GLControl(gm, 2, 1, GraphicsContextFlags.Default); - if (control.GraphicsMode != null) + _Control = new GLControl(gm, 2, 1, GraphicsContextFlags.Default); + if (_Control.GraphicsMode != null) ok = true; } catch (Exception) @@ -88,222 +88,222 @@ namespace Vocaluxe.Lib.Draw } if (!ok) - control = new GLControl(); + _Control = new GLControl(); - control.MakeCurrent(); - control.VSync = CConfig.VSync == EOffOn.TR_CONFIG_ON; + _Control.MakeCurrent(); + _Control.VSync = CConfig.VSync == EOffOn.TR_CONFIG_ON; - Controls.Add(control); + Controls.Add(_Control); _Keys = new CKeys(); - Paint += OnPaintEvent; - Closing += OnClosingEvent; - Resize += OnResizeEvent; + Paint += _OnPaintEvent; + Closing += _OnClosingEvent; + Resize += _OnResizeEvent; - control.KeyDown += OnKeyDownEvent; - control.PreviewKeyDown += OnPreviewKeyDownEvent; - control.KeyPress += OnKeyPressEvent; - control.KeyUp += OnKeyUpEvent; + _Control.KeyDown += _OnKeyDownEvent; + _Control.PreviewKeyDown += _OnPreviewKeyDownEvent; + _Control.KeyPress += _OnKeyPressEvent; + _Control.KeyUp += _OnKeyUpEvent; _Mouse = new CMouse(); - control.MouseMove += OnMouseMove; - control.MouseWheel += OnMouseWheel; - control.MouseDown += OnMouseDown; - control.MouseUp += OnMouseUp; - control.MouseLeave += OnMouseLeave; - control.MouseEnter += OnMouseEnter; + _Control.MouseMove += _OnMouseMove; + _Control.MouseWheel += _OnMouseWheel; + _Control.MouseDown += _OnMouseDown; + _Control.MouseUp += _OnMouseUp; + _Control.MouseLeave += _OnMouseLeave; + _Control.MouseEnter += _OnMouseEnter; ClientSize = new Size(CConfig.ScreenW, CConfig.ScreenH); CenterToScreen(); } #region Helpers - private int CheckAntiAliasingMode(int SetValue) + private int _CheckAntiAliasingMode(int setValue) { - int _Result = 0; - GraphicsMode _mode = null; - bool _done = false; + int result = 0; + GraphicsMode mode = null; + bool done = false; - while (!_done && (_Result <= 32)) + while (!done && (result <= 32)) { try { - _mode = new GraphicsMode(16, 0, 0, _Result); + mode = new GraphicsMode(16, 0, 0, result); } catch (Exception) { - _done = true; - _Result /= 2; - if (_Result == 1) - _Result = 0; + done = true; + result /= 2; + if (result == 1) + result = 0; } - if (_mode != null) + if (mode != null) { try { - if (_mode.Samples == _Result) + if (mode.Samples == result) { - if (_Result == 0) - _Result = 2; + if (result == 0) + result = 2; else - _Result *= 2; + result *= 2; } else { - _done = true; - _Result /= 2; - if (_Result == 1) - _Result = 0; + done = true; + result /= 2; + if (result == 1) + result = 0; } } catch (Exception) { - _done = true; - _Result /= 2; - if (_Result == 1) - _Result = 0; + done = true; + result /= 2; + if (result == 1) + result = 0; } } else { - _done = true; - _Result /= 2; - if (_Result == 1) - _Result = 0; + done = true; + result /= 2; + if (result == 1) + result = 0; } } - if (_Result > 64) - _Result = 32; + if (result > 64) + result = 32; - if (SetValue < _Result) - return SetValue; + if (setValue < result) + return setValue; else - return _Result; + return result; } - private int CheckColorDeep(int SetValue) + private int _CheckColorDeep(int setValue) { - int _Result = 8; - GraphicsMode _mode = null; - bool _done = false; + int result = 8; + GraphicsMode mode = null; + bool done = false; - while (!_done && (_Result <= 32)) + while (!done && (result <= 32)) { try { - _mode = new GraphicsMode(_Result, 0, 0, 0); + mode = new GraphicsMode(result, 0, 0, 0); } catch (Exception) { - _done = true; - _Result -= 8; - if (_Result == 0) - _Result = 8; + done = true; + result -= 8; + if (result == 0) + result = 8; } - if (_mode != null) + if (mode != null) { try { - if (_mode.ColorFormat == _Result) - _Result += 8; + if (mode.ColorFormat == result) + result += 8; else { - _done = true; - _Result -= 8; - if (_Result == 0) - _Result = 8; + done = true; + result -= 8; + if (result == 0) + result = 8; } } catch (Exception) { - _done = true; - _Result -= 8; - if (_Result == 0) - _Result = 8; + done = true; + result -= 8; + if (result == 0) + result = 8; } } else { - _done = true; - _Result -= 8; - if (_Result == 0) - _Result = 8; + done = true; + result -= 8; + if (result == 0) + result = 8; } } - if (_Result > 32) - _Result = 32; + if (result > 32) + result = 32; - if (SetValue < _Result) - return SetValue; + if (setValue < result) + return setValue; else - return _Result; + return result; } - private void ToggleFullScreen() + private void _ToggleFullScreen() { - if (!_fullscreen) - EnterFullScreen(); + if (!_Fullscreen) + _EnterFullScreen(); else - LeaveFullScreen(); + _LeaveFullScreen(); } - private void EnterFullScreen() + private void _EnterFullScreen() { - _fullscreen = true; + _Fullscreen = true; CConfig.FullScreen = EOffOn.TR_CONFIG_ON; - _restore.location = Location; - _restore.width = Width; - _restore.height = Height; + _Restore.Location = Location; + _Restore.Width = Width; + _Restore.Height = Height; FormBorderStyle = FormBorderStyle.None; - int ScreenNr = 0; + int screenNr = 0; for (int i = 0; i < Screen.AllScreens.Length; i++) { Screen scr = Screen.AllScreens[i]; if (scr.Bounds.Top <= Top && scr.Bounds.Left <= Left) - ScreenNr = i; + screenNr = i; } - DesktopBounds = new Rectangle(Screen.AllScreens[ScreenNr].Bounds.Location, - new Size(Screen.AllScreens[ScreenNr].Bounds.Width, Screen.AllScreens[ScreenNr].Bounds.Height)); + DesktopBounds = new Rectangle(Screen.AllScreens[screenNr].Bounds.Location, + new Size(Screen.AllScreens[screenNr].Bounds.Width, Screen.AllScreens[screenNr].Bounds.Height)); if (WindowState == FormWindowState.Maximized) { WindowState = FormWindowState.Normal; - DoResize(); + _DoResize(); WindowState = FormWindowState.Maximized; } else - DoResize(); + _DoResize(); CConfig.SaveConfig(); } - private void LeaveFullScreen() + private void _LeaveFullScreen() { - _fullscreen = false; + _Fullscreen = false; CConfig.FullScreen = EOffOn.TR_CONFIG_OFF; FormBorderStyle = FormBorderStyle.Sizable; - DesktopBounds = new Rectangle(_restore.location, new Size(_restore.width, _restore.height)); + DesktopBounds = new Rectangle(_Restore.Location, new Size(_Restore.Width, _Restore.Height)); CConfig.SaveConfig(); } #endregion Helpers #region form events - private void OnPaintEvent(object sender, PaintEventArgs e) {} + private void _OnPaintEvent(object sender, PaintEventArgs e) {} - private void OnResizeEvent(object sender, EventArgs e) {} + private void _OnResizeEvent(object sender, EventArgs e) {} - private void OnClosingEvent(object sender, CancelEventArgs e) + private void _OnClosingEvent(object sender, CancelEventArgs e) { _Run = false; } @@ -317,8 +317,8 @@ namespace Vocaluxe.Lib.Draw { base.OnResize(e); - control.ClientSize = ClientSize; - DoResize(); + _Control.ClientSize = ClientSize; + _DoResize(); } protected override void WndProc(ref Message m) @@ -344,33 +344,33 @@ namespace Vocaluxe.Lib.Draw #endregion form events #region mouse event handlers - private void OnMouseMove(object sender, MouseEventArgs e) + private void _OnMouseMove(object sender, MouseEventArgs e) { _Mouse.MouseMove(e); } - private void OnMouseWheel(object sender, MouseEventArgs e) + private void _OnMouseWheel(object sender, MouseEventArgs e) { _Mouse.MouseWheel(e); } - private void OnMouseDown(object sender, MouseEventArgs e) + private void _OnMouseDown(object sender, MouseEventArgs e) { _Mouse.MouseDown(e); } - private void OnMouseUp(object sender, MouseEventArgs e) + private void _OnMouseUp(object sender, MouseEventArgs e) { _Mouse.MouseUp(e); } - private void OnMouseLeave(object sender, EventArgs e) + private void _OnMouseLeave(object sender, EventArgs e) { _Mouse.Visible = false; Cursor.Show(); } - private void OnMouseEnter(object sender, EventArgs e) + private void _OnMouseEnter(object sender, EventArgs e) { Cursor.Hide(); _Mouse.Visible = true; @@ -378,50 +378,50 @@ namespace Vocaluxe.Lib.Draw #endregion #region keyboard event handlers - private void OnPreviewKeyDownEvent(object sender, PreviewKeyDownEventArgs e) + private void _OnPreviewKeyDownEvent(object sender, PreviewKeyDownEventArgs e) { - OnKeyDownEvent(sender, new KeyEventArgs(e.KeyData)); + _OnKeyDownEvent(sender, new KeyEventArgs(e.KeyData)); } - private void OnKeyDownEvent(object sender, KeyEventArgs e) + private void _OnKeyDownEvent(object sender, KeyEventArgs e) { _Keys.KeyDown(e); } - private void OnKeyPressEvent(object sender, System.Windows.Forms.KeyPressEventArgs e) + private void _OnKeyPressEvent(object sender, System.Windows.Forms.KeyPressEventArgs e) { _Keys.KeyPress(e); } - private void OnKeyUpEvent(object sender, KeyEventArgs e) + private void _OnKeyUpEvent(object sender, KeyEventArgs e) { _Keys.KeyUp(e); } #endregion keyboard event handlers - private void DoResize() + private void _DoResize() { - h = control.Height; - w = control.Width; - y = 0; - x = 0; + _H = _Control.Height; + _W = _Control.Width; + _Y = 0; + _X = 0; - if (w / (float)h > CSettings.GetRenderAspect()) + if (_W / (float)_H > CSettings.GetRenderAspect()) { - w = (int)Math.Round(h * CSettings.GetRenderAspect()); - x = (control.Width - w) / 2; + _W = (int)Math.Round(_H * CSettings.GetRenderAspect()); + _X = (_Control.Width - _W) / 2; } else { - h = (int)Math.Round(w / CSettings.GetRenderAspect()); - y = (control.Height - h) / 2; + _H = (int)Math.Round(_W / CSettings.GetRenderAspect()); + _Y = (_Control.Height - _H) / 2; } OpenTK.Graphics.OpenGL.GL.MatrixMode(OpenTK.Graphics.OpenGL.MatrixMode.Projection); OpenTK.Graphics.OpenGL.GL.LoadIdentity(); - OpenTK.Graphics.OpenGL.GL.Ortho(0, CSettings.iRenderW, CSettings.iRenderH, 0, CSettings.ZNear, CSettings.ZFar); - OpenTK.Graphics.OpenGL.GL.Viewport(x, y, w, h); + OpenTK.Graphics.OpenGL.GL.Ortho(0, CSettings.RenderW, CSettings.RenderH, 0, CSettings.ZNear, CSettings.ZFar); + OpenTK.Graphics.OpenGL.GL.Viewport(_X, _Y, _W, _H); } #region implementation @@ -453,7 +453,7 @@ namespace Vocaluxe.Lib.Draw if (CConfig.FullScreen == EOffOn.TR_CONFIG_ON) { CSettings.IsFullScreen = true; - EnterFullScreen(); + _EnterFullScreen(); } while (_Run) @@ -466,12 +466,12 @@ namespace Vocaluxe.Lib.Draw _Run = _Run && CGraphics.Draw(); _Run = CGraphics.UpdateGameLogic(_Keys, _Mouse); - control.SwapBuffers(); + _Control.SwapBuffers(); - if ((CSettings.IsFullScreen && !_fullscreen) || (!CSettings.IsFullScreen && _fullscreen)) - ToggleFullScreen(); + if ((CSettings.IsFullScreen && !_Fullscreen) || (!CSettings.IsFullScreen && _Fullscreen)) + _ToggleFullScreen(); - CheckQueque(); + _CheckQueque(); if (CTime.IsRunning()) delay = (int)Math.Floor(CConfig.CalcCycleTime() - CTime.GetMilliseconds()); @@ -498,12 +498,12 @@ namespace Vocaluxe.Lib.Draw public int GetScreenWidth() { - return control.Width; + return _Control.Width; } public int GetScreenHeight() { - return control.Height; + return _Control.Height; } public RectangleF GetTextBounds(CText text) @@ -511,9 +511,9 @@ namespace Vocaluxe.Lib.Draw return GetTextBounds(text, text.Height); } - public RectangleF GetTextBounds(CText text, float Height) + public RectangleF GetTextBounds(CText text, float height) { - CFonts.Height = Height; + CFonts.Height = height; CFonts.SetFont(text.Font); CFonts.Style = text.Style; return new RectangleF(text.X, text.Y, CFonts.GetTextWidth(CLanguage.Translate(text.Text)), CFonts.GetTextHeight(CLanguage.Translate(text.Text))); @@ -534,20 +534,20 @@ namespace Vocaluxe.Lib.Draw OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, id); texture.ID = id; - texture.width = w; - texture.height = h; - texture.w2 = MathHelper.NextPowerOfTwo(texture.width); - texture.h2 = MathHelper.NextPowerOfTwo(texture.height); + texture.Width = _W; + texture.Height = _H; + texture.W2 = MathHelper.NextPowerOfTwo(texture.Width); + texture.H2 = MathHelper.NextPowerOfTwo(texture.Height); - texture.width_ratio = texture.width / texture.w2; - texture.height_ratio = texture.height / texture.h2; + texture.WidthRatio = texture.Width / texture.W2; + texture.HeightRatio = texture.Height / texture.H2; - OpenTK.Graphics.OpenGL.GL.TexImage2D(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0, OpenTK.Graphics.OpenGL.PixelInternalFormat.Rgba, (int)texture.w2, - (int)texture.h2, 0, + OpenTK.Graphics.OpenGL.GL.TexImage2D(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0, OpenTK.Graphics.OpenGL.PixelInternalFormat.Rgba, (int)texture.W2, + (int)texture.H2, 0, OpenTK.Graphics.OpenGL.PixelFormat.Bgra, OpenTK.Graphics.OpenGL.PixelType.UnsignedByte, IntPtr.Zero); - OpenTK.Graphics.OpenGL.GL.CopyTexSubImage2D(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0, 0, 0, x, y, - (int)texture.width, (int)texture.height); + OpenTK.Graphics.OpenGL.GL.CopyTexSubImage2D(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0, 0, 0, _X, _Y, + (int)texture.Width, (int)texture.Height); OpenTK.Graphics.OpenGL.GL.TexParameter(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, OpenTK.Graphics.OpenGL.TextureParameterName.TextureMagFilter, (int)OpenTK.Graphics.OpenGL.TextureMagFilter.Linear); @@ -557,31 +557,31 @@ namespace Vocaluxe.Lib.Draw OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0); // Add to Texture List - texture.color = new SColorF(1f, 1f, 1f, 1f); - texture.rect = new SRectF(0f, 0f, texture.width, texture.height, 0f); + texture.Color = new SColorF(1f, 1f, 1f, 1f); + texture.Rect = new SRectF(0f, 0f, texture.Width, texture.Height, 0f); - lock (MutexTexture) + lock (_MutexTexture) { - texture.index = _IDs.Dequeue(); - _Textures[texture.index] = texture; + texture.Index = _IDs.Dequeue(); + _Textures[texture.Index] = texture; } return texture; } - public void CopyScreen(ref STexture Texture) + public void CopyScreen(ref STexture texture) { - if (!_TextureExists(ref Texture) || (Texture.width != GetScreenWidth()) || (Texture.height != GetScreenHeight())) + if (!_TextureExists(ref texture) || (texture.Width != GetScreenWidth()) || (texture.Height != GetScreenHeight())) { - RemoveTexture(ref Texture); - Texture = CopyScreen(); + RemoveTexture(ref texture); + texture = CopyScreen(); } else { - OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, Texture.ID); + OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, texture.ID); OpenTK.Graphics.OpenGL.GL.CopyTexSubImage2D(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0, 0, 0, 0, 0, - (int)Texture.width, (int)Texture.height); + (int)texture.Width, (int)texture.Height); OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0); } @@ -590,7 +590,7 @@ namespace Vocaluxe.Lib.Draw public void MakeScreenShot() { string file = "Screenshot_"; - string path = Path.Combine(Environment.CurrentDirectory, CSettings.sFolderScreenshots); + string path = Path.Combine(Environment.CurrentDirectory, CSettings.FolderScreenshots); int i = 0; while (File.Exists(Path.Combine(path, file + i.ToString("00000") + ".bmp"))) @@ -601,10 +601,10 @@ namespace Vocaluxe.Lib.Draw using (Bitmap screen = new Bitmap(width, height)) { - BitmapData bmp_data = screen.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb); + BitmapData bmpData = screen.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb); - OpenTK.Graphics.OpenGL.GL.ReadPixels(0, 0, width, height, OpenTK.Graphics.OpenGL.PixelFormat.Bgra, OpenTK.Graphics.OpenGL.PixelType.UnsignedByte, bmp_data.Scan0); - screen.UnlockBits(bmp_data); + OpenTK.Graphics.OpenGL.GL.ReadPixels(0, 0, width, height, OpenTK.Graphics.OpenGL.PixelFormat.Bgra, OpenTK.Graphics.OpenGL.PixelType.UnsignedByte, bmpData.Scan0); + screen.UnlockBits(bmpData); screen.RotateFlip(RotateFlipType.RotateNoneFlipY); screen.Save(Path.Combine(path, file + i.ToString("00000") + ".bmp"), ImageFormat.Bmp); @@ -614,14 +614,14 @@ namespace Vocaluxe.Lib.Draw public void DrawLine(int a, int r, int g, int b, int w, int x1, int y1, int x2, int y2) {} // Draw Basic Text (must be deleted later) - public void DrawText(string Text, int x, int y, int h) + public void DrawText(string text, int x, int y, int h) { - DrawText(Text, x, y, h, 0f); + DrawText(text, x, y, h, 0f); } - public void DrawText(string Text, int x, int y, float h, float z) + public void DrawText(string text, int x, int y, float h, float z) { - CFonts.DrawText(Text, h, x, y, z, new SColorF(1, 1, 1, 1)); + CFonts.DrawText(text, h, x, y, z, new SColorF(1, 1, 1, 1)); } public void DrawColor(SColorF color, SRectF rect) @@ -694,30 +694,30 @@ namespace Vocaluxe.Lib.Draw #region Textures #region adding - public STexture AddTexture(string TexturePath) + public STexture AddTexture(string texturePath) { - if (File.Exists(TexturePath)) + if (File.Exists(texturePath)) { Bitmap bmp; try { - bmp = new Bitmap(TexturePath); + bmp = new Bitmap(texturePath); } catch (Exception) { - CLog.LogError("Error loading Texture: " + TexturePath); + CLog.LogError("Error loading Texture: " + texturePath); return new STexture(-1); } try { - return AddTexture(bmp, TexturePath); + return AddTexture(bmp, texturePath); } finally { bmp.Dispose(); } } - CLog.LogError("Can't find File: " + TexturePath); + CLog.LogError("Can't find File: " + texturePath); return new STexture(-1); } @@ -726,62 +726,62 @@ namespace Vocaluxe.Lib.Draw return AddTexture(bmp, String.Empty); } - public STexture AddTexture(Bitmap bmp, string TexturePath) + public STexture AddTexture(Bitmap bmp, string texturePath) { STexture texture = new STexture(-1); if (bmp.Height == 0 || bmp.Width == 0) return texture; - int MaxSize; + int maxSize; switch (CConfig.TextureQuality) { case ETextureQuality.TR_CONFIG_TEXTURE_LOWEST: - MaxSize = 128; + maxSize = 128; break; case ETextureQuality.TR_CONFIG_TEXTURE_LOW: - MaxSize = 256; + maxSize = 256; break; case ETextureQuality.TR_CONFIG_TEXTURE_MEDIUM: - MaxSize = 512; + maxSize = 512; break; case ETextureQuality.TR_CONFIG_TEXTURE_HIGH: - MaxSize = 1024; + maxSize = 1024; break; case ETextureQuality.TR_CONFIG_TEXTURE_HIGHEST: - MaxSize = 2048; + maxSize = 2048; break; default: - MaxSize = 512; + maxSize = 512; break; } int w = bmp.Width; int h = bmp.Height; - if (w > MaxSize) + if (w > maxSize) { - h = (int)Math.Round((float)MaxSize / bmp.Width * bmp.Height); - w = MaxSize; + h = (int)Math.Round((float)maxSize / bmp.Width * bmp.Height); + w = maxSize; } - if (h > MaxSize) + if (h > maxSize) { - w = (int)Math.Round((float)MaxSize / bmp.Height * bmp.Width); - h = MaxSize; + w = (int)Math.Round((float)maxSize / bmp.Height * bmp.Width); + h = maxSize; } int id = OpenTK.Graphics.OpenGL.GL.GenTexture(); OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, id); texture.ID = id; - texture.width = w; - texture.height = h; + texture.Width = w; + texture.Height = h; - texture.w2 = MathHelper.NextPowerOfTwo(w); - texture.h2 = MathHelper.NextPowerOfTwo(h); + texture.W2 = MathHelper.NextPowerOfTwo(w); + texture.H2 = MathHelper.NextPowerOfTwo(h); - using (Bitmap bmp2 = new Bitmap((int)texture.w2, (int)texture.h2)) + using (Bitmap bmp2 = new Bitmap((int)texture.W2, (int)texture.H2)) { Graphics g = Graphics.FromImage(bmp2); g.InterpolationMode = InterpolationMode.HighQualityBicubic; @@ -789,20 +789,20 @@ namespace Vocaluxe.Lib.Draw g.DrawImage(bmp, new Rectangle(0, 0, bmp2.Width, bmp2.Height)); g.Dispose(); - texture.width_ratio = 1f; - texture.height_ratio = 1f; + texture.WidthRatio = 1f; + texture.HeightRatio = 1f; - BitmapData bmp_data = bmp2.LockBits(new Rectangle(0, 0, bmp2.Width, bmp2.Height), ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb); + BitmapData bmpData = bmp2.LockBits(new Rectangle(0, 0, bmp2.Width, bmp2.Height), ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb); - OpenTK.Graphics.OpenGL.GL.TexImage2D(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0, OpenTK.Graphics.OpenGL.PixelInternalFormat.Rgba, (int)texture.w2, - (int)texture.h2, 0, + OpenTK.Graphics.OpenGL.GL.TexImage2D(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0, OpenTK.Graphics.OpenGL.PixelInternalFormat.Rgba, (int)texture.W2, + (int)texture.H2, 0, OpenTK.Graphics.OpenGL.PixelFormat.Bgra, OpenTK.Graphics.OpenGL.PixelType.UnsignedByte, IntPtr.Zero); - OpenTK.Graphics.OpenGL.GL.TexSubImage2D(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0, 0, 0, bmp_data.Width, bmp_data.Height, - OpenTK.Graphics.OpenGL.PixelFormat.Bgra, OpenTK.Graphics.OpenGL.PixelType.UnsignedByte, bmp_data.Scan0); + OpenTK.Graphics.OpenGL.GL.TexSubImage2D(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0, 0, 0, bmpData.Width, bmpData.Height, + OpenTK.Graphics.OpenGL.PixelFormat.Bgra, OpenTK.Graphics.OpenGL.PixelType.UnsignedByte, bmpData.Scan0); - bmp2.UnlockBits(bmp_data); + bmp2.UnlockBits(bmpData); } OpenTK.Graphics.OpenGL.GL.TexParameter(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, OpenTK.Graphics.OpenGL.TextureParameterName.TextureWrapS, @@ -822,20 +822,20 @@ namespace Vocaluxe.Lib.Draw // Add to Texture List - texture.color = new SColorF(1f, 1f, 1f, 1f); - texture.rect = new SRectF(0f, 0f, texture.width, texture.height, 0f); + texture.Color = new SColorF(1f, 1f, 1f, 1f); + texture.Rect = new SRectF(0f, 0f, texture.Width, texture.Height, 0f); texture.TexturePath = String.Empty; - lock (MutexTexture) + lock (_MutexTexture) { - texture.index = _IDs.Dequeue(); - _Textures[texture.index] = texture; + texture.Index = _IDs.Dequeue(); + _Textures[texture.Index] = texture; } return texture; } - public STexture AddTexture(int W, int H, IntPtr Data) + public STexture AddTexture(int w, int h, IntPtr data) { STexture texture = new STexture(-1); @@ -845,7 +845,7 @@ namespace Vocaluxe.Lib.Draw { OpenTK.Graphics.OpenGL.GL.GenBuffers(1, out texture.PBO); OpenTK.Graphics.OpenGL.GL.BindBuffer(OpenTK.Graphics.OpenGL.BufferTarget.PixelUnpackBuffer, texture.PBO); - OpenTK.Graphics.OpenGL.GL.BufferData(OpenTK.Graphics.OpenGL.BufferTarget.PixelUnpackBuffer, (IntPtr)(W * H * 4), IntPtr.Zero, + OpenTK.Graphics.OpenGL.GL.BufferData(OpenTK.Graphics.OpenGL.BufferTarget.PixelUnpackBuffer, (IntPtr)(w * h * 4), IntPtr.Zero, OpenTK.Graphics.OpenGL.BufferUsageHint.StreamDraw); OpenTK.Graphics.OpenGL.GL.BindBuffer(OpenTK.Graphics.OpenGL.BufferTarget.PixelUnpackBuffer, 0); } @@ -859,20 +859,20 @@ namespace Vocaluxe.Lib.Draw OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, id); texture.ID = id; - texture.width = W; - texture.height = H; - texture.w2 = MathHelper.NextPowerOfTwo(texture.width); - texture.h2 = MathHelper.NextPowerOfTwo(texture.height); + texture.Width = w; + texture.Height = h; + texture.W2 = MathHelper.NextPowerOfTwo(texture.Width); + texture.H2 = MathHelper.NextPowerOfTwo(texture.Height); - texture.width_ratio = texture.width / texture.w2; - texture.height_ratio = texture.height / texture.h2; + texture.WidthRatio = texture.Width / texture.W2; + texture.HeightRatio = texture.Height / texture.H2; - OpenTK.Graphics.OpenGL.GL.TexImage2D(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0, OpenTK.Graphics.OpenGL.PixelInternalFormat.Rgba, (int)texture.w2, - (int)texture.h2, 0, + OpenTK.Graphics.OpenGL.GL.TexImage2D(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0, OpenTK.Graphics.OpenGL.PixelInternalFormat.Rgba, (int)texture.W2, + (int)texture.H2, 0, OpenTK.Graphics.OpenGL.PixelFormat.Bgra, OpenTK.Graphics.OpenGL.PixelType.UnsignedByte, IntPtr.Zero); - OpenTK.Graphics.OpenGL.GL.TexSubImage2D(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0, 0, 0, W, H, - OpenTK.Graphics.OpenGL.PixelFormat.Bgra, OpenTK.Graphics.OpenGL.PixelType.UnsignedByte, Data); + OpenTK.Graphics.OpenGL.GL.TexSubImage2D(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0, 0, 0, w, h, + OpenTK.Graphics.OpenGL.PixelFormat.Bgra, OpenTK.Graphics.OpenGL.PixelType.UnsignedByte, data); //GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)TextureParameterName.ClampToEdge); @@ -888,20 +888,20 @@ namespace Vocaluxe.Lib.Draw OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0); // Add to Texture List - texture.color = new SColorF(1f, 1f, 1f, 1f); - texture.rect = new SRectF(0f, 0f, texture.width, texture.height, 0f); + texture.Color = new SColorF(1f, 1f, 1f, 1f); + texture.Rect = new SRectF(0f, 0f, texture.Width, texture.Height, 0f); texture.TexturePath = String.Empty; - lock (MutexTexture) + lock (_MutexTexture) { - texture.index = _IDs.Dequeue(); - _Textures[texture.index] = texture; + texture.Index = _IDs.Dequeue(); + _Textures[texture.Index] = texture; } return texture; } - public STexture AddTexture(int W, int H, ref byte[] Data) + public STexture AddTexture(int w, int h, ref byte[] data) { STexture texture = new STexture(-1); @@ -911,7 +911,7 @@ namespace Vocaluxe.Lib.Draw { OpenTK.Graphics.OpenGL.GL.GenBuffers(1, out texture.PBO); OpenTK.Graphics.OpenGL.GL.BindBuffer(OpenTK.Graphics.OpenGL.BufferTarget.PixelUnpackBuffer, texture.PBO); - OpenTK.Graphics.OpenGL.GL.BufferData(OpenTK.Graphics.OpenGL.BufferTarget.PixelUnpackBuffer, (IntPtr)Data.Length, IntPtr.Zero, + OpenTK.Graphics.OpenGL.GL.BufferData(OpenTK.Graphics.OpenGL.BufferTarget.PixelUnpackBuffer, (IntPtr)data.Length, IntPtr.Zero, OpenTK.Graphics.OpenGL.BufferUsageHint.StreamDraw); OpenTK.Graphics.OpenGL.GL.BindBuffer(OpenTK.Graphics.OpenGL.BufferTarget.PixelUnpackBuffer, 0); } @@ -926,20 +926,20 @@ namespace Vocaluxe.Lib.Draw OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, id); texture.ID = id; - texture.width = W; - texture.height = H; - texture.w2 = MathHelper.NextPowerOfTwo(texture.width); - texture.h2 = MathHelper.NextPowerOfTwo(texture.height); + texture.Width = w; + texture.Height = h; + texture.W2 = MathHelper.NextPowerOfTwo(texture.Width); + texture.H2 = MathHelper.NextPowerOfTwo(texture.Height); - texture.width_ratio = texture.width / texture.w2; - texture.height_ratio = texture.height / texture.h2; + texture.WidthRatio = texture.Width / texture.W2; + texture.HeightRatio = texture.Height / texture.H2; - OpenTK.Graphics.OpenGL.GL.TexImage2D(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0, OpenTK.Graphics.OpenGL.PixelInternalFormat.Rgba, (int)texture.w2, - (int)texture.h2, 0, + OpenTK.Graphics.OpenGL.GL.TexImage2D(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0, OpenTK.Graphics.OpenGL.PixelInternalFormat.Rgba, (int)texture.W2, + (int)texture.H2, 0, OpenTK.Graphics.OpenGL.PixelFormat.Bgra, OpenTK.Graphics.OpenGL.PixelType.UnsignedByte, IntPtr.Zero); - OpenTK.Graphics.OpenGL.GL.TexSubImage2D(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0, 0, 0, W, H, - OpenTK.Graphics.OpenGL.PixelFormat.Bgra, OpenTK.Graphics.OpenGL.PixelType.UnsignedByte, Data); + OpenTK.Graphics.OpenGL.GL.TexSubImage2D(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0, 0, 0, w, h, + OpenTK.Graphics.OpenGL.PixelFormat.Bgra, OpenTK.Graphics.OpenGL.PixelType.UnsignedByte, data); //GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)TextureParameterName.ClampToEdge); @@ -955,36 +955,36 @@ namespace Vocaluxe.Lib.Draw OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0); // Add to Texture List - texture.color = new SColorF(1f, 1f, 1f, 1f); - texture.rect = new SRectF(0f, 0f, texture.width, texture.height, 0f); + texture.Color = new SColorF(1f, 1f, 1f, 1f); + texture.Rect = new SRectF(0f, 0f, texture.Width, texture.Height, 0f); texture.TexturePath = String.Empty; - lock (MutexTexture) + lock (_MutexTexture) { - texture.index = _IDs.Dequeue(); - _Textures[texture.index] = texture; + texture.Index = _IDs.Dequeue(); + _Textures[texture.Index] = texture; } return texture; } - public STexture QuequeTexture(int W, int H, ref byte[] Data) + public STexture QuequeTexture(int w, int h, ref byte[] data) { STexture texture = new STexture(-1); STextureQueque queque = new STextureQueque(); - queque.data = Data; - queque.height = H; - queque.width = W; - texture.height = H; - texture.width = W; + queque.Data = data; + queque.Height = h; + queque.Width = w; + texture.Height = h; + texture.Width = w; - lock (MutexTexture) + lock (_MutexTexture) { - texture.index = _IDs.Dequeue(); - queque.ID = texture.index; + texture.Index = _IDs.Dequeue(); + queque.ID = texture.Index; _Queque.Add(queque); - _Textures[texture.index] = texture; + _Textures[texture.Index] = texture; } return texture; @@ -992,26 +992,26 @@ namespace Vocaluxe.Lib.Draw #endregion adding #region updating - public bool UpdateTexture(ref STexture Texture, IntPtr Data) + public bool UpdateTexture(ref STexture texture, IntPtr data) { - if (_TextureExists(ref Texture)) + if (_TextureExists(ref texture)) { if (_UsePBO) { try { - OpenTK.Graphics.OpenGL.GL.BindBuffer(OpenTK.Graphics.OpenGL.BufferTarget.PixelUnpackBuffer, Texture.PBO); + OpenTK.Graphics.OpenGL.GL.BindBuffer(OpenTK.Graphics.OpenGL.BufferTarget.PixelUnpackBuffer, texture.PBO); - IntPtr Buffer = OpenTK.Graphics.OpenGL.GL.MapBuffer(OpenTK.Graphics.OpenGL.BufferTarget.PixelUnpackBuffer, OpenTK.Graphics.OpenGL.BufferAccess.WriteOnly); - byte[] d = new byte[(int)Texture.height * (int)Texture.width * 4]; + IntPtr buffer = OpenTK.Graphics.OpenGL.GL.MapBuffer(OpenTK.Graphics.OpenGL.BufferTarget.PixelUnpackBuffer, OpenTK.Graphics.OpenGL.BufferAccess.WriteOnly); + byte[] d = new byte[(int)texture.Height * (int)texture.Width * 4]; - Marshal.Copy(Data, d, 0, (int)Texture.height * (int)Texture.width * 4); - Marshal.Copy(d, 0, Buffer, (int)Texture.height * (int)Texture.width * 4); + Marshal.Copy(data, d, 0, (int)texture.Height * (int)texture.Width * 4); + Marshal.Copy(d, 0, buffer, (int)texture.Height * (int)texture.Width * 4); OpenTK.Graphics.OpenGL.GL.UnmapBuffer(OpenTK.Graphics.OpenGL.BufferTarget.PixelUnpackBuffer); - OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, Texture.ID); - OpenTK.Graphics.OpenGL.GL.TexSubImage2D(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0, 0, 0, (int)Texture.width, (int)Texture.height, + OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, texture.ID); + OpenTK.Graphics.OpenGL.GL.TexSubImage2D(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0, 0, 0, (int)texture.Width, (int)texture.Height, OpenTK.Graphics.OpenGL.PixelFormat.Bgra, OpenTK.Graphics.OpenGL.PixelType.UnsignedByte, IntPtr.Zero); OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0); @@ -1025,10 +1025,10 @@ namespace Vocaluxe.Lib.Draw } } - OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, Texture.ID); + OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, texture.ID); - OpenTK.Graphics.OpenGL.GL.TexSubImage2D(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0, 0, 0, (int)Texture.width, (int)Texture.height, - OpenTK.Graphics.OpenGL.PixelFormat.Bgra, OpenTK.Graphics.OpenGL.PixelType.UnsignedByte, Data); + OpenTK.Graphics.OpenGL.GL.TexSubImage2D(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0, 0, 0, (int)texture.Width, (int)texture.Height, + OpenTK.Graphics.OpenGL.PixelFormat.Bgra, OpenTK.Graphics.OpenGL.PixelType.UnsignedByte, data); OpenTK.Graphics.OpenGL.GL.TexParameter(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, OpenTK.Graphics.OpenGL.TextureParameterName.TextureWrapS, (int)OpenTK.Graphics.OpenGL.TextureParameterName.ClampToEdge); @@ -1051,23 +1051,23 @@ namespace Vocaluxe.Lib.Draw return false; } - public bool UpdateTexture(ref STexture Texture, ref byte[] Data) + public bool UpdateTexture(ref STexture texture, ref byte[] data) { - if (_TextureExists(ref Texture)) + if (_TextureExists(ref texture)) { if (_UsePBO) { try { - OpenTK.Graphics.OpenGL.GL.BindBuffer(OpenTK.Graphics.OpenGL.BufferTarget.PixelUnpackBuffer, Texture.PBO); + OpenTK.Graphics.OpenGL.GL.BindBuffer(OpenTK.Graphics.OpenGL.BufferTarget.PixelUnpackBuffer, texture.PBO); - IntPtr Buffer = OpenTK.Graphics.OpenGL.GL.MapBuffer(OpenTK.Graphics.OpenGL.BufferTarget.PixelUnpackBuffer, OpenTK.Graphics.OpenGL.BufferAccess.WriteOnly); - Marshal.Copy(Data, 0, Buffer, Data.Length); + IntPtr buffer = OpenTK.Graphics.OpenGL.GL.MapBuffer(OpenTK.Graphics.OpenGL.BufferTarget.PixelUnpackBuffer, OpenTK.Graphics.OpenGL.BufferAccess.WriteOnly); + Marshal.Copy(data, 0, buffer, data.Length); OpenTK.Graphics.OpenGL.GL.UnmapBuffer(OpenTK.Graphics.OpenGL.BufferTarget.PixelUnpackBuffer); - OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, Texture.ID); - OpenTK.Graphics.OpenGL.GL.TexSubImage2D(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0, 0, 0, (int)Texture.width, (int)Texture.height, + OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, texture.ID); + OpenTK.Graphics.OpenGL.GL.TexSubImage2D(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0, 0, 0, (int)texture.Width, (int)texture.Height, OpenTK.Graphics.OpenGL.PixelFormat.Bgra, OpenTK.Graphics.OpenGL.PixelType.UnsignedByte, IntPtr.Zero); OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0); @@ -1082,10 +1082,10 @@ namespace Vocaluxe.Lib.Draw } } - OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, Texture.ID); + OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, texture.ID); - OpenTK.Graphics.OpenGL.GL.TexSubImage2D(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0, 0, 0, (int)Texture.width, (int)Texture.height, - OpenTK.Graphics.OpenGL.PixelFormat.Bgra, OpenTK.Graphics.OpenGL.PixelType.UnsignedByte, Data); + OpenTK.Graphics.OpenGL.GL.TexSubImage2D(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0, 0, 0, (int)texture.Width, (int)texture.Height, + OpenTK.Graphics.OpenGL.PixelFormat.Bgra, OpenTK.Graphics.OpenGL.PixelType.UnsignedByte, data); //GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)TextureParameterName.ClampToEdge); //GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)TextureParameterName.ClampToEdge); @@ -1105,32 +1105,32 @@ namespace Vocaluxe.Lib.Draw } #endregion updating - public void RemoveTexture(ref STexture Texture) + public void RemoveTexture(ref STexture texture) { - if ((Texture.index > 0) && (_Textures.Count > 0)) + if ((texture.Index > 0) && (_Textures.Count > 0)) { - lock (MutexTexture) + lock (_MutexTexture) { - _IDs.Enqueue(Texture.index); - OpenTK.Graphics.OpenGL.GL.DeleteTexture(Texture.ID); - if (Texture.PBO > 0) - OpenTK.Graphics.OpenGL.GL.DeleteBuffers(1, ref Texture.PBO); - _Textures.Remove(Texture.index); - Texture.index = -1; - Texture.ID = -1; + _IDs.Enqueue(texture.Index); + OpenTK.Graphics.OpenGL.GL.DeleteTexture(texture.ID); + if (texture.PBO > 0) + OpenTK.Graphics.OpenGL.GL.DeleteBuffers(1, ref texture.PBO); + _Textures.Remove(texture.Index); + texture.Index = -1; + texture.ID = -1; } } } - private bool _TextureExists(ref STexture Texture) + private bool _TextureExists(ref STexture texture) { - lock (MutexTexture) + lock (_MutexTexture) { - if (_Textures.ContainsKey(Texture.index)) + if (_Textures.ContainsKey(texture.Index)) { - if (_Textures[Texture.index].ID > 0) + if (_Textures[texture.Index].ID > 0) { - Texture = _Textures[Texture.index]; + texture = _Textures[texture.Index]; return true; } } @@ -1139,32 +1139,32 @@ namespace Vocaluxe.Lib.Draw } #region drawing - public void DrawTexture(STexture Texture) + public void DrawTexture(STexture texture) { - DrawTexture(Texture, Texture.rect, Texture.color); + DrawTexture(texture, texture.Rect, texture.Color); } - public void DrawTexture(STexture Texture, SRectF rect) + public void DrawTexture(STexture texture, SRectF rect) { - DrawTexture(Texture, rect, Texture.color, false); + DrawTexture(texture, rect, texture.Color, false); } - public void DrawTexture(STexture Texture, SRectF rect, SColorF color) + public void DrawTexture(STexture texture, SRectF rect, SColorF color) { - DrawTexture(Texture, rect, color, false); + DrawTexture(texture, rect, color, false); } - public void DrawTexture(STexture Texture, SRectF rect, SColorF color, SRectF bounds) + public void DrawTexture(STexture texture, SRectF rect, SColorF color, SRectF bounds) { - DrawTexture(Texture, rect, color, bounds, false); + DrawTexture(texture, rect, color, bounds, false); } - public void DrawTexture(STexture Texture, SRectF rect, SColorF color, bool mirrored) + public void DrawTexture(STexture texture, SRectF rect, SColorF color, bool mirrored) { - DrawTexture(Texture, rect, color, new SRectF(0, 0, CSettings.iRenderW, CSettings.iRenderH, rect.Z), mirrored); + DrawTexture(texture, rect, color, new SRectF(0, 0, CSettings.RenderW, CSettings.RenderH, rect.Z), mirrored); } - public void DrawTexture(STexture Texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored) + public void DrawTexture(STexture texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored) { if (rect.W == 0f || rect.H == 0f || bounds.H == 0f || bounds.W == 0f || color.A == 0f) return; @@ -1175,26 +1175,26 @@ namespace Vocaluxe.Lib.Draw if (bounds.Y > rect.Y + rect.H || bounds.Y + bounds.H < rect.Y) return; - if (_TextureExists(ref Texture)) + if (_TextureExists(ref texture)) { - OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, Texture.ID); + OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, texture.ID); - float x1 = (bounds.X - rect.X) / rect.W * Texture.width_ratio; - float x2 = (bounds.X + bounds.W - rect.X) / rect.W * Texture.width_ratio; - float y1 = (bounds.Y - rect.Y) / rect.H * Texture.height_ratio; - float y2 = (bounds.Y + bounds.H - rect.Y) / rect.H * Texture.height_ratio; + float x1 = (bounds.X - rect.X) / rect.W * texture.WidthRatio; + float x2 = (bounds.X + bounds.W - rect.X) / rect.W * texture.WidthRatio; + float y1 = (bounds.Y - rect.Y) / rect.H * texture.HeightRatio; + float y2 = (bounds.Y + bounds.H - rect.Y) / rect.H * texture.HeightRatio; if (x1 < 0) x1 = 0f; - if (x2 > Texture.width_ratio) - x2 = Texture.width_ratio; + if (x2 > texture.WidthRatio) + x2 = texture.WidthRatio; if (y1 < 0) y1 = 0f; - if (y2 > Texture.height_ratio) - y2 = Texture.height_ratio; + if (y2 > texture.HeightRatio) + y2 = texture.HeightRatio; float rx1 = rect.X; @@ -1271,11 +1271,11 @@ namespace Vocaluxe.Lib.Draw } } - public void DrawTexture(STexture Texture, SRectF rect, SColorF color, float begin, float end) + public void DrawTexture(STexture texture, SRectF rect, SColorF color, float begin, float end) { - if (_TextureExists(ref Texture)) + if (_TextureExists(ref texture)) { - OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, Texture.ID); + OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, texture.ID); OpenTK.Graphics.OpenGL.GL.Enable(OpenTK.Graphics.OpenGL.EnableCap.Blend); OpenTK.Graphics.OpenGL.GL.Color4(color.R, color.G, color.B, color.A * CGraphics.GlobalAlpha); @@ -1283,16 +1283,16 @@ namespace Vocaluxe.Lib.Draw OpenTK.Graphics.OpenGL.GL.Begin(OpenTK.Graphics.OpenGL.BeginMode.Quads); - OpenTK.Graphics.OpenGL.GL.TexCoord2(0f + begin * Texture.width_ratio, 0f); + OpenTK.Graphics.OpenGL.GL.TexCoord2(0f + begin * texture.WidthRatio, 0f); OpenTK.Graphics.OpenGL.GL.Vertex3(rect.X + begin * rect.W, rect.Y, rect.Z + CGraphics.ZOffset); - OpenTK.Graphics.OpenGL.GL.TexCoord2(0f + begin * Texture.width_ratio, Texture.height_ratio); + OpenTK.Graphics.OpenGL.GL.TexCoord2(0f + begin * texture.WidthRatio, texture.HeightRatio); OpenTK.Graphics.OpenGL.GL.Vertex3(rect.X + begin * rect.W, rect.Y + rect.H, rect.Z + CGraphics.ZOffset); - OpenTK.Graphics.OpenGL.GL.TexCoord2(Texture.width_ratio * end, Texture.height_ratio); + OpenTK.Graphics.OpenGL.GL.TexCoord2(texture.WidthRatio * end, texture.HeightRatio); OpenTK.Graphics.OpenGL.GL.Vertex3(rect.X + end * rect.W, rect.Y + rect.H, rect.Z + CGraphics.ZOffset); - OpenTK.Graphics.OpenGL.GL.TexCoord2(Texture.width_ratio * end, 0f); + OpenTK.Graphics.OpenGL.GL.TexCoord2(texture.WidthRatio * end, 0f); OpenTK.Graphics.OpenGL.GL.Vertex3(rect.X + end * rect.W, rect.Y, rect.Z + CGraphics.ZOffset); OpenTK.Graphics.OpenGL.GL.End(); @@ -1303,7 +1303,7 @@ namespace Vocaluxe.Lib.Draw } } - public void DrawTextureReflection(STexture Texture, SRectF rect, SColorF color, SRectF bounds, float space, float height) + public void DrawTextureReflection(STexture texture, SRectF rect, SColorF color, SRectF bounds, float space, float height) { if (rect.W == 0f || rect.H == 0f || bounds.H == 0f || bounds.W == 0f || color.A == 0f || height <= 0f) return; @@ -1317,26 +1317,26 @@ namespace Vocaluxe.Lib.Draw if (height > bounds.H) height = bounds.H; - if (_TextureExists(ref Texture)) + if (_TextureExists(ref texture)) { - OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, Texture.ID); + OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, texture.ID); - float x1 = (bounds.X - rect.X) / rect.W * Texture.width_ratio; - float x2 = (bounds.X + bounds.W - rect.X) / rect.W * Texture.width_ratio; - float y1 = (bounds.Y - rect.Y + rect.H - height) / rect.H * Texture.height_ratio; - float y2 = (bounds.Y + bounds.H - rect.Y) / rect.H * Texture.height_ratio; + float x1 = (bounds.X - rect.X) / rect.W * texture.WidthRatio; + float x2 = (bounds.X + bounds.W - rect.X) / rect.W * texture.WidthRatio; + float y1 = (bounds.Y - rect.Y + rect.H - height) / rect.H * texture.HeightRatio; + float y2 = (bounds.Y + bounds.H - rect.Y) / rect.H * texture.HeightRatio; if (x1 < 0) x1 = 0f; - if (x2 > Texture.width_ratio) - x2 = Texture.width_ratio; + if (x2 > texture.WidthRatio) + x2 = texture.WidthRatio; if (y1 < 0) y1 = 0f; - if (y2 > Texture.height_ratio) - y2 = Texture.height_ratio; + if (y2 > texture.HeightRatio) + y2 = texture.HeightRatio; float rx1 = rect.X; @@ -1403,9 +1403,9 @@ namespace Vocaluxe.Lib.Draw return _Textures.Count; } - private void CheckQueque() + private void _CheckQueque() { - lock (MutexTexture) + lock (_MutexTexture) { if (_Queque.Count == 0) return; @@ -1415,7 +1415,7 @@ namespace Vocaluxe.Lib.Draw if (_Textures.ContainsKey(q.ID)) texture = _Textures[q.ID]; - if (texture.index < 1) + if (texture.Index < 1) return; if (_UsePBO) @@ -1424,7 +1424,7 @@ namespace Vocaluxe.Lib.Draw { OpenTK.Graphics.OpenGL.GL.GenBuffers(1, out texture.PBO); OpenTK.Graphics.OpenGL.GL.BindBuffer(OpenTK.Graphics.OpenGL.BufferTarget.PixelUnpackBuffer, texture.PBO); - OpenTK.Graphics.OpenGL.GL.BufferData(OpenTK.Graphics.OpenGL.BufferTarget.PixelUnpackBuffer, (IntPtr)q.data.Length, IntPtr.Zero, + OpenTK.Graphics.OpenGL.GL.BufferData(OpenTK.Graphics.OpenGL.BufferTarget.PixelUnpackBuffer, (IntPtr)q.Data.Length, IntPtr.Zero, OpenTK.Graphics.OpenGL.BufferUsageHint.StreamDraw); OpenTK.Graphics.OpenGL.GL.BindBuffer(OpenTK.Graphics.OpenGL.BufferTarget.PixelUnpackBuffer, 0); } @@ -1439,20 +1439,20 @@ namespace Vocaluxe.Lib.Draw OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, id); texture.ID = id; - texture.width = q.width; - texture.height = q.height; - texture.w2 = MathHelper.NextPowerOfTwo(texture.width); - texture.h2 = MathHelper.NextPowerOfTwo(texture.height); + texture.Width = q.Width; + texture.Height = q.Height; + texture.W2 = MathHelper.NextPowerOfTwo(texture.Width); + texture.H2 = MathHelper.NextPowerOfTwo(texture.Height); - texture.width_ratio = texture.width / texture.w2; - texture.height_ratio = texture.height / texture.h2; + texture.WidthRatio = texture.Width / texture.W2; + texture.HeightRatio = texture.Height / texture.H2; - OpenTK.Graphics.OpenGL.GL.TexImage2D(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0, OpenTK.Graphics.OpenGL.PixelInternalFormat.Rgba, (int)texture.w2, - (int)texture.h2, 0, + OpenTK.Graphics.OpenGL.GL.TexImage2D(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0, OpenTK.Graphics.OpenGL.PixelInternalFormat.Rgba, (int)texture.W2, + (int)texture.H2, 0, OpenTK.Graphics.OpenGL.PixelFormat.Bgra, OpenTK.Graphics.OpenGL.PixelType.UnsignedByte, IntPtr.Zero); - OpenTK.Graphics.OpenGL.GL.TexSubImage2D(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0, 0, 0, q.width, q.height, - OpenTK.Graphics.OpenGL.PixelFormat.Bgra, OpenTK.Graphics.OpenGL.PixelType.UnsignedByte, q.data); + OpenTK.Graphics.OpenGL.GL.TexSubImage2D(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0, 0, 0, q.Width, q.Height, + OpenTK.Graphics.OpenGL.PixelFormat.Bgra, OpenTK.Graphics.OpenGL.PixelType.UnsignedByte, q.Data); OpenTK.Graphics.OpenGL.GL.TexParameter(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, OpenTK.Graphics.OpenGL.TextureParameterName.TextureWrapS, (int)OpenTK.Graphics.OpenGL.TextureParameterName.ClampToEdge); @@ -1471,12 +1471,12 @@ namespace Vocaluxe.Lib.Draw OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0); // Add to Texture List - texture.color = new SColorF(1f, 1f, 1f, 1f); - texture.rect = new SRectF(0f, 0f, texture.width, texture.height, 0f); + texture.Color = new SColorF(1f, 1f, 1f, 1f); + texture.Rect = new SRectF(0f, 0f, texture.Width, texture.Height, 0f); texture.TexturePath = String.Empty; - _Textures[texture.index] = texture; - q.data = null; + _Textures[texture.Index] = texture; + q.Data = null; _Queque.RemoveAt(0); } } diff --git a/Vocaluxe/Lib/Draw/IDraw.cs b/Vocaluxe/Lib/Draw/IDraw.cs index 1a0d6cb9..6b55cbb1 100644 --- a/Vocaluxe/Lib/Draw/IDraw.cs +++ b/Vocaluxe/Lib/Draw/IDraw.cs @@ -14,7 +14,7 @@ namespace Vocaluxe.Lib.Draw int GetScreenHeight(); RectangleF GetTextBounds(CText text); - RectangleF GetTextBounds(CText text, float Height); + RectangleF GetTextBounds(CText text, float height); // Basic Draw Methods void DrawLine(int a, int r, int g, int b, int w, int x1, int y1, int x2, int y2); @@ -23,31 +23,31 @@ namespace Vocaluxe.Lib.Draw void ClearScreen(); STexture CopyScreen(); - void CopyScreen(ref STexture Texture); + void CopyScreen(ref STexture texture); void MakeScreenShot(); // Draw Basic Text (must be deleted later) - void DrawText(string Text, int x, int y, int h); + void DrawText(string text, int x, int y, int h); - STexture AddTexture(string TexturePath); - 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); - bool UpdateTexture(ref STexture Texture, ref byte[] Data); - bool UpdateTexture(ref STexture Texture, IntPtr Data); + STexture AddTexture(string texturePath); + 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); + bool UpdateTexture(ref STexture texture, ref byte[] data); + bool UpdateTexture(ref STexture texture, IntPtr data); - void RemoveTexture(ref STexture Texture); - void DrawTexture(STexture Texture); - void DrawTexture(STexture Texture, SRectF rect); - void DrawTexture(STexture Texture, SRectF rect, SColorF color); - void DrawTexture(STexture Texture, SRectF rect, SColorF color, SRectF bounds); + void RemoveTexture(ref STexture texture); + void DrawTexture(STexture texture); + void DrawTexture(STexture texture, SRectF rect); + void DrawTexture(STexture texture, SRectF rect, SColorF color); + void DrawTexture(STexture texture, SRectF rect, SColorF color, SRectF bounds); - void DrawTexture(STexture Texture, SRectF rect, SColorF color, bool mirrored); - void DrawTexture(STexture Texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored); - void DrawTexture(STexture Texture, SRectF rect, SColorF color, float begin, float end); + void DrawTexture(STexture texture, SRectF rect, SColorF color, bool mirrored); + void DrawTexture(STexture texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored); + void DrawTexture(STexture texture, SRectF rect, SColorF color, float begin, float end); - void DrawTextureReflection(STexture Texture, SRectF rect, SColorF color, SRectF bounds, float space, float height); + void DrawTextureReflection(STexture texture, SRectF rect, SColorF color, SRectF bounds, float space, float height); int TextureCount(); } diff --git a/Vocaluxe/Lib/Input/CHIDAPI.cs b/Vocaluxe/Lib/Input/CHIDAPI.cs index 1906041c..4f7b39c4 100644 --- a/Vocaluxe/Lib/Input/CHIDAPI.cs +++ b/Vocaluxe/Lib/Input/CHIDAPI.cs @@ -5,7 +5,7 @@ using Vocaluxe.Base; namespace Vocaluxe.Lib.Input { [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] - public struct HIDDeviceInfo + public struct SHIDDeviceInfo { [MarshalAs(UnmanagedType.LPTStr)] public String Path; public ushort VendorString; @@ -20,7 +20,7 @@ namespace Vocaluxe.Lib.Input internal IntPtr Next; } - public static class CHIDAPI + public static class CHIDApi { #if ARCH_X86 #if WIN @@ -34,15 +34,15 @@ namespace Vocaluxe.Lib.Input #if ARCH_X64 #if WIN - private const string HIDapiDll = "x64\\hidapi.dll"; + private const string _HIDApiDll = "x64\\hidapi.dll"; #endif #if LINUX - private const string HIDapiDll = "libhidapi.so"; + private const string HIDaApiDll = "libhidapi.so"; #endif #endif - [DllImport(HIDapiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_init", CharSet = CharSet.Unicode)] + [DllImport(_HIDApiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_init", CharSet = CharSet.Unicode)] private static extern int hid_init(); public static bool Init() @@ -64,7 +64,7 @@ namespace Vocaluxe.Lib.Input return false; } - [DllImport(HIDapiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_exit", CharSet = CharSet.Unicode)] + [DllImport(_HIDApiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_exit", CharSet = CharSet.Unicode)] private static extern int hid_exit(); public static bool Exit() @@ -86,33 +86,33 @@ namespace Vocaluxe.Lib.Input return false; } - [DllImport(HIDapiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_enumerate", CharSet = CharSet.Ansi)] - private static extern IntPtr hid_enumerate(ushort VendorID, ushort ProductID); + [DllImport(_HIDApiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_enumerate", CharSet = CharSet.Ansi)] + private static extern IntPtr hid_enumerate(ushort vendorID, ushort productID); //HIDDeviceInfo - public static IntPtr Enumerate(ushort VendorID, ushort ProductID) + public static IntPtr Enumerate(ushort vendorID, ushort productID) { //HIDDeviceInfo - return hid_enumerate(VendorID, ProductID); + return hid_enumerate(vendorID, productID); } - [DllImport(HIDapiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_free_enumeration", CharSet = CharSet.Unicode)] - private static extern void hid_free_enumeration(HIDDeviceInfo devs); + [DllImport(_HIDApiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_free_enumeration", CharSet = CharSet.Unicode)] + private static extern void hid_free_enumeration(SHIDDeviceInfo devs); - public static void FreeEnumeration(HIDDeviceInfo devs) + public static void FreeEnumeration(SHIDDeviceInfo devs) { hid_free_enumeration(devs); } - [DllImport(HIDapiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_open", CharSet = CharSet.Unicode)] - private static extern IntPtr hid_open(ushort VendorID, ushort ProductID, IntPtr SerialNumber); + [DllImport(_HIDApiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_open", CharSet = CharSet.Unicode)] + private static extern IntPtr hid_open(ushort vendorID, ushort productID, IntPtr serialNumber); - public static bool Open(ushort VendorID, ushort ProductID, out IntPtr Handle) + public static bool Open(ushort vendorID, ushort productID, out IntPtr handle) { - Handle = IntPtr.Zero; + handle = IntPtr.Zero; try { - Handle = hid_open(VendorID, ProductID, IntPtr.Zero); + handle = hid_open(vendorID, productID, IntPtr.Zero); } catch (Exception e) { @@ -120,40 +120,40 @@ namespace Vocaluxe.Lib.Input return false; } - if (Handle != IntPtr.Zero) + if (handle != IntPtr.Zero) return true; return false; } - [DllImport(HIDapiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_open_path", CharSet = CharSet.Unicode)] - private static extern IntPtr hid_open_path(string Path); + [DllImport(_HIDApiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_open_path", CharSet = CharSet.Unicode)] + private static extern IntPtr hid_open_path(string path); - public static IntPtr OpenPath(string Path) + public static IntPtr OpenPath(string path) { - return hid_open_path(Path); + return hid_open_path(path); } - [DllImport(HIDapiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_write", CharSet = CharSet.Unicode)] + [DllImport(_HIDApiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_write", CharSet = CharSet.Unicode)] private static extern int hid_write(IntPtr device, byte[] data, int length); - public static int Write(IntPtr Device, byte[] Data) + public static int Write(IntPtr device, byte[] data) { - return hid_write(Device, Data, Data.Length); + return hid_write(device, data, data.Length); } - [DllImport(HIDapiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_read_timeout", CharSet = CharSet.Unicode)] + [DllImport(_HIDApiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_read_timeout", CharSet = CharSet.Unicode)] private static extern int hid_read_timeout(IntPtr device, IntPtr data, int length, int milliseconds); - public static int ReadTimeout(IntPtr Device, out byte[] Data, int length, int milliseconds) + public static int ReadTimeout(IntPtr device, out byte[] data, int length, int milliseconds) { - Data = new byte[length]; + data = new byte[length]; IntPtr dataPtr = Marshal.AllocHGlobal(length); int result = -1; try { - result = hid_read_timeout(Device, dataPtr, length, milliseconds); + result = hid_read_timeout(device, dataPtr, length, milliseconds); } catch (Exception e) { @@ -162,26 +162,26 @@ namespace Vocaluxe.Lib.Input } if (result != -1) - Marshal.Copy(dataPtr, Data, 0, result); + Marshal.Copy(dataPtr, data, 0, result); else - Data = null; + data = null; Marshal.FreeHGlobal(dataPtr); return result; } - [DllImport(HIDapiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_read", CharSet = CharSet.Unicode)] + [DllImport(_HIDApiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_read", CharSet = CharSet.Unicode)] private static extern int hid_read(IntPtr device, IntPtr data, int length); - public static int Read(IntPtr Device, out byte[] Data, int length) + public static int Read(IntPtr device, out byte[] data, int length) { - Data = new byte[length]; + data = new byte[length]; IntPtr dataPtr = Marshal.AllocHGlobal(length); int result = -1; try { - result = hid_read(Device, dataPtr, length); + result = hid_read(device, dataPtr, length); } catch (Exception e) { @@ -190,46 +190,46 @@ namespace Vocaluxe.Lib.Input } if (result != -1) - Marshal.Copy(dataPtr, Data, 0, result); + Marshal.Copy(dataPtr, data, 0, result); else - Data = null; + data = null; Marshal.FreeHGlobal(dataPtr); return result; } - [DllImport(HIDapiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_set_nonblocking", CharSet = CharSet.Unicode)] + [DllImport(_HIDApiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_set_nonblocking", CharSet = CharSet.Unicode)] private static extern int hid_set_nonblocking(IntPtr device, bool nonblock); - public static int Read(IntPtr Device, bool Nonblocking) + public static int Read(IntPtr device, bool nonblocking) { - return hid_set_nonblocking(Device, Nonblocking); + return hid_set_nonblocking(device, nonblocking); } - [DllImport(HIDapiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_send_feature_report", CharSet = CharSet.Unicode)] + [DllImport(_HIDApiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_send_feature_report", CharSet = CharSet.Unicode)] private static extern int hid_send_feature_report(IntPtr device, string data, int length); - public static int SendFeatureReport(IntPtr Device, string Data) + public static int SendFeatureReport(IntPtr device, string data) { - return hid_send_feature_report(Device, Data, Data.Length); + return hid_send_feature_report(device, data, data.Length); } - [DllImport(HIDapiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_get_feature_report", CharSet = CharSet.Unicode)] - private static extern int hid_get_feature_report(IntPtr device, string Data, int length); + [DllImport(_HIDApiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_get_feature_report", CharSet = CharSet.Unicode)] + private static extern int hid_get_feature_report(IntPtr device, string data, int length); - public static int GetFeatureReport(IntPtr Device, string Data) + public static int GetFeatureReport(IntPtr device, string data) { - return hid_get_feature_report(Device, Data, Data.Length); + return hid_get_feature_report(device, data, data.Length); } - [DllImport(HIDapiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_close", CharSet = CharSet.Unicode)] + [DllImport(_HIDApiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_close", CharSet = CharSet.Unicode)] private static extern void hid_close(IntPtr device); - public static bool Close(IntPtr Device) + public static bool Close(IntPtr device) { try { - hid_close(Device); + hid_close(device); } catch (Exception e) { @@ -239,44 +239,44 @@ namespace Vocaluxe.Lib.Input return true; } - [DllImport(HIDapiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_get_manufacturer_string", CharSet = CharSet.Unicode)] - private static extern int hid_get_manufacturer_string(IntPtr device, string Data, int maxlength); + [DllImport(_HIDApiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_get_manufacturer_string", CharSet = CharSet.Unicode)] + private static extern int hid_get_manufacturer_string(IntPtr device, string data, int maxlength); - public static int GetManufacturerString(IntPtr Device, string Data, int MaxLength) + public static int GetManufacturerString(IntPtr device, string data, int maxLength) { - return hid_get_manufacturer_string(Device, Data, MaxLength); + return hid_get_manufacturer_string(device, data, maxLength); } - [DllImport(HIDapiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_get_product_string", CharSet = CharSet.Unicode)] - private static extern int hid_get_product_string(IntPtr device, string Data, int maxlength); + [DllImport(_HIDApiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_get_product_string", CharSet = CharSet.Unicode)] + private static extern int hid_get_product_string(IntPtr device, string data, int maxlength); - public static int GetProductString(IntPtr Device, string Data, int MaxLength) + public static int GetProductString(IntPtr device, string data, int maxLength) { - return hid_get_product_string(Device, Data, MaxLength); + return hid_get_product_string(device, data, maxLength); } - [DllImport(HIDapiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_get_serial_number_string", CharSet = CharSet.Unicode)] - private static extern int hid_get_serial_number_string(IntPtr device, string Data, int maxlength); + [DllImport(_HIDApiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_get_serial_number_string", CharSet = CharSet.Unicode)] + private static extern int hid_get_serial_number_string(IntPtr device, string data, int maxlength); - public static int GetSerialNumberString(IntPtr Device, string Data, int MaxLength) + public static int GetSerialNumberString(IntPtr device, string data, int maxLength) { - return hid_get_serial_number_string(Device, Data, MaxLength); + return hid_get_serial_number_string(device, data, maxLength); } - [DllImport(HIDapiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_get_indexed_string", CharSet = CharSet.Unicode)] - private static extern int hid_get_indexed_string(IntPtr device, string Data, int maxlength); + [DllImport(_HIDApiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_get_indexed_string", CharSet = CharSet.Unicode)] + private static extern int hid_get_indexed_string(IntPtr device, string data, int maxlength); - public static int GetIndexedString(IntPtr Device, string Data, int MaxLength) + public static int GetIndexedString(IntPtr device, string data, int maxLength) { - return hid_get_indexed_string(Device, Data, MaxLength); + return hid_get_indexed_string(device, data, maxLength); } - [DllImport(HIDapiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_error", CharSet = CharSet.Unicode)] + [DllImport(_HIDApiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_error", CharSet = CharSet.Unicode)] private static extern string hid_error(IntPtr device); - public static string Error(IntPtr Device) + public static string Error(IntPtr device) { - return hid_error(Device); + return hid_error(device); } } } \ No newline at end of file diff --git a/Vocaluxe/Lib/Input/IInput.cs b/Vocaluxe/Lib/Input/IInput.cs index f725c4fd..e81c0509 100644 --- a/Vocaluxe/Lib/Input/IInput.cs +++ b/Vocaluxe/Lib/Input/IInput.cs @@ -23,24 +23,24 @@ namespace Vocaluxe.Lib.Input bool IsConnected(); void Update(); - bool PollKeyEvent(ref KeyEvent KeyEvent); - bool PollMouseEvent(ref MouseEvent MouseEvent); + bool PollKeyEvent(ref SKeyEvent keyEvent); + bool PollMouseEvent(ref SMouseEvent mouseEvent); - void SetRumble(float Duration); + void SetRumble(float duration); } - class RumbleTimer + class CRumbleTimer { - private readonly Stopwatch _timer; - private float _duration; + private readonly Stopwatch _Timer; + private float _Duration; public bool ShouldStart { get { - if (!_timer.IsRunning && _duration != 0f) + if (!_Timer.IsRunning && _Duration != 0f) { - _timer.Start(); + _Timer.Start(); return true; } @@ -52,10 +52,10 @@ namespace Vocaluxe.Lib.Input { get { - if (_timer.IsRunning && _timer.ElapsedMilliseconds / 1000f >= _duration) + if (_Timer.IsRunning && _Timer.ElapsedMilliseconds / 1000f >= _Duration) { - _timer.Reset(); - _duration = 0f; + _Timer.Reset(); + _Duration = 0f; return true; } @@ -63,76 +63,76 @@ namespace Vocaluxe.Lib.Input } } - public RumbleTimer() + public CRumbleTimer() { - _timer = new Stopwatch(); - _duration = 0f; + _Timer = new Stopwatch(); + _Duration = 0f; } - public void Set(float Duration) + public void Set(float duration) { - if (!_timer.IsRunning) + if (!_Timer.IsRunning) { - _duration = Duration; - _timer.Reset(); + _Duration = duration; + _Timer.Reset(); } } public void Reset() { - _duration = 0f; + _Duration = 0f; } } class CGesture { private Point _Begin; - private bool _locked; + private bool _Locked; public CGesture() { - _locked = false; + _Locked = false; } - public void SetLockPosition(Point Position) + public void SetLockPosition(Point position) { - _locked = true; - _Begin = new Point(Position.X, Position.Y); + _Locked = true; + _Begin = new Point(position.X, position.Y); } public void Reset() { - _locked = false; + _Locked = false; } - public EGesture GetGesture(Point NewPosition) + public EGesture GetGesture(Point newPosition) { - if (!_locked) + if (!_Locked) return EGesture.None; - int dx = NewPosition.X - _Begin.X; - int dy = NewPosition.Y - _Begin.Y; + int dx = newPosition.X - _Begin.X; + int dy = newPosition.Y - _Begin.Y; //Back/Escape if (dx < -150 && Math.Abs(dy) < 150) { - _locked = false; + _Locked = false; return EGesture.Back; } //ScrollDown if (Math.Abs(dx) < 150 && dy > 30) { - _Begin.Y = NewPosition.Y; - _Begin.X = NewPosition.X; + _Begin.Y = newPosition.Y; + _Begin.X = newPosition.X; return EGesture.ScrollDown; } //ScrollUp if (Math.Abs(dx) < 150 && dy < -30) { - _Begin.Y = NewPosition.Y; - _Begin.X = NewPosition.X; + _Begin.Y = newPosition.Y; + _Begin.X = newPosition.X; return EGesture.ScrollUp; } diff --git a/Vocaluxe/Lib/Input/WiiMote/CWiiMote.cs b/Vocaluxe/Lib/Input/WiiMote/CWiiMote.cs index 13e29141..f93b0c46 100644 --- a/Vocaluxe/Lib/Input/WiiMote/CWiiMote.cs +++ b/Vocaluxe/Lib/Input/WiiMote/CWiiMote.cs @@ -10,14 +10,14 @@ namespace Vocaluxe.Lib.Input.WiiMote { class CWiiMote : IInput, IDisposable { - private WiiMoteLib _WiiMote; + private CWiiMoteLib _WiiMote; - private List _KeysPool; - private List _CurrentKeysPool; + private List _KeysPool; + private List _CurrentKeysPool; private readonly Object _KeyCopyLock = new Object(); - private List _MousePool; - private List _CurrentMousePool; + private List _MousePool; + private List _CurrentMousePool; private readonly Object _MouseCopyLock = new Object(); private bool[] _ButtonStates; @@ -27,25 +27,25 @@ namespace Vocaluxe.Lib.Input.WiiMote private Thread _HandlerThread; private Object _Sync; private bool _Active; - private RumbleTimer _RumbleTimer; + private CRumbleTimer _RumbleTimer; private CGesture _Gesture; public bool Init() { _Sync = new Object(); - _RumbleTimer = new RumbleTimer(); + _RumbleTimer = new CRumbleTimer(); _Gesture = new CGesture(); _Active = true; - _HandlerThread = new Thread(MainLoop); + _HandlerThread = new Thread(_MainLoop); _HandlerThread.Priority = ThreadPriority.BelowNormal; - _KeysPool = new List(); - _CurrentKeysPool = new List(); + _KeysPool = new List(); + _CurrentKeysPool = new List(); - _MousePool = new List(); - _CurrentMousePool = new List(); + _MousePool = new List(); + _CurrentMousePool = new List(); _ButtonStates = new bool[11]; _OldPosition = new Point(); @@ -83,14 +83,14 @@ namespace Vocaluxe.Lib.Input.WiiMote public void Update() { - CopyEvents(); + _CopyEvents(); } - public bool PollKeyEvent(ref KeyEvent KeyEvent) + public bool PollKeyEvent(ref SKeyEvent keyEvent) { if (_CurrentKeysPool.Count > 0) { - KeyEvent = _CurrentKeysPool[0]; + keyEvent = _CurrentKeysPool[0]; _CurrentKeysPool.RemoveAt(0); return true; } @@ -98,11 +98,11 @@ namespace Vocaluxe.Lib.Input.WiiMote return false; } - public bool PollMouseEvent(ref MouseEvent MouseEvent) + public bool PollMouseEvent(ref SMouseEvent mouseEvent) { if (_CurrentMousePool.Count > 0) { - MouseEvent = _CurrentMousePool[0]; + mouseEvent = _CurrentMousePool[0]; _CurrentMousePool.RemoveAt(0); return true; } @@ -110,18 +110,18 @@ namespace Vocaluxe.Lib.Input.WiiMote return false; } - public void SetRumble(float Duration) + public void SetRumble(float duration) { lock (_Sync) { - _RumbleTimer.Set(Duration); + _RumbleTimer.Set(duration); } } - private void MainLoop() + private void _MainLoop() { - _WiiMote = new WiiMoteLib(); - _WiiMote.WiiMoteChanged += wm_WiiMoteChanged; + _WiiMote = new CWiiMoteLib(); + _WiiMote.WiiMoteChanged += _WmWiiMoteChanged; while (_Active) { @@ -129,23 +129,23 @@ namespace Vocaluxe.Lib.Input.WiiMote if (!_WiiMote.Connected) { - if (!DoConnect()) + if (!_DoConnect()) Thread.Sleep(1000); } else { - bool StartRumble = false; - bool StopRumble = false; + bool startRumble = false; + bool stopRumble = false; lock (_Sync) { - StartRumble = _RumbleTimer.ShouldStart; - StopRumble = _RumbleTimer.ShouldStop; + startRumble = _RumbleTimer.ShouldStart; + stopRumble = _RumbleTimer.ShouldStop; } - if (StartRumble) + if (startRumble) _WiiMote.SetRumble(true); - if (StopRumble) + if (stopRumble) _WiiMote.SetRumble(false); } } @@ -155,7 +155,7 @@ namespace Vocaluxe.Lib.Input.WiiMote _Connected = false; } - private bool DoConnect() + private bool _DoConnect() { try { @@ -167,7 +167,7 @@ namespace Vocaluxe.Lib.Input.WiiMote return false; } - _WiiMote.SetReportType(InputReport.IRAccel, IRSensitivity.Max, false); + _WiiMote.SetReportType(EInputReport.IRAccel, EIRSensitivity.Max, false); _WiiMote.SetLEDs(false, false, true, false); _WiiMote.SetRumble(true); @@ -182,12 +182,12 @@ namespace Vocaluxe.Lib.Input.WiiMote return true; } - private void wm_WiiMoteChanged(object sender, WiiMoteChangedEventArgs args) + private void _WmWiiMoteChanged(object sender, CWiiMoteChangedEventArgs args) { if (!_Active) return; - WiiMoteStatus ws = args.WiiMoteState; + CWiiMoteStatus ws = args.WiiMoteState; Point p = ws.IRState.Position; p.X = 1023 - p.X; @@ -245,7 +245,7 @@ namespace Vocaluxe.Lib.Input.WiiMote if (alt || shift || ctrl || pressed || unicode != char.MinValue || key != Keys.None) { - KeyEvent pool = new KeyEvent(ESender.WiiMote, alt, shift, ctrl, pressed, unicode, key); + SKeyEvent pool = new SKeyEvent(ESender.WiiMote, alt, shift, ctrl, pressed, unicode, key); lock (_KeyCopyLock) { @@ -259,8 +259,8 @@ namespace Vocaluxe.Lib.Input.WiiMote float rx = ((p.X / 1024f) - reducing) * factor; float ry = ((p.Y / 768f) - reducing) * factor; - int x = (int)(rx * CSettings.iRenderW); - int y = (int)(ry * CSettings.iRenderH); + int x = (int)(rx * CSettings.RenderW); + int y = (int)(ry * CSettings.RenderH); bool ld = false; @@ -275,17 +275,17 @@ namespace Vocaluxe.Lib.Input.WiiMote if (gesture == EGesture.ScrollDown) wheel = 1; - MouseEvent mpool = new MouseEvent(); + SMouseEvent mpool = new SMouseEvent(); bool trigger = false; if (!lb && !rb && (p.X != _OldPosition.X || p.Y != _OldPosition.Y)) { - mpool = new MouseEvent(ESender.WiiMote, alt, shift, ctrl, x, y, false, false, false, wheel, lbh, rbh, false, mbh); + mpool = new SMouseEvent(ESender.WiiMote, alt, shift, ctrl, x, y, false, false, false, wheel, lbh, rbh, false, mbh); trigger = true; } else if (lb || rb) { - mpool = new MouseEvent(ESender.WiiMote, alt, shift, ctrl, x, y, lb, ld, rb, wheel, false, false, mb, false); + mpool = new SMouseEvent(ESender.WiiMote, alt, shift, ctrl, x, y, lb, ld, rb, wheel, false, false, mb, false); trigger = true; } @@ -302,18 +302,18 @@ namespace Vocaluxe.Lib.Input.WiiMote _OldPosition.Y = p.Y; } - private void CopyEvents() + private void _CopyEvents() { lock (_KeyCopyLock) { - foreach (KeyEvent e in _KeysPool) + foreach (SKeyEvent e in _KeysPool) _CurrentKeysPool.Add(e); _KeysPool.Clear(); } lock (_MouseCopyLock) { - foreach (MouseEvent e in _MousePool) + foreach (SMouseEvent e in _MousePool) _CurrentMousePool.Add(e); _MousePool.Clear(); } diff --git a/Vocaluxe/Lib/Input/WiiMote/WiiMoteLib.cs b/Vocaluxe/Lib/Input/WiiMote/WiiMoteLib.cs index fcb2347e..9ac7d4d6 100644 --- a/Vocaluxe/Lib/Input/WiiMote/WiiMoteLib.cs +++ b/Vocaluxe/Lib/Input/WiiMote/WiiMoteLib.cs @@ -8,29 +8,29 @@ namespace Vocaluxe.Lib.Input.WiiMote { #region DataTypes - public class WiiMoteStatus + public class CWiiMoteStatus { - public AccelCalibrationInfo AccelCalibrationInfo = new AccelCalibrationInfo(); + public SAccelCalibrationInfo AccelCalibrationInfo = new SAccelCalibrationInfo(); - public AccelStatus AccelState = new AccelStatus(); + public SAccelStatus AccelState = new SAccelStatus(); - public Buttons ButtonState = new Buttons(); + public SButtons ButtonState = new SButtons(); - public IRState IRState = new IRState(); + public SIRState IRState = new SIRState(); public byte Battery; public bool Rumble; - public LEDStatus LEDState; + public SLEDStatus LEDState; - public WiiMoteStatus() + public CWiiMoteStatus() { - IRState.Sensors = new IR[4]; + IRState.Sensors = new SIR[4]; } } - public struct LEDStatus + public struct SLEDStatus { public bool LED1; public bool LED2; @@ -38,46 +38,46 @@ namespace Vocaluxe.Lib.Input.WiiMote public bool LED4; } - public enum IRMode : byte + public enum EIRMode : byte { Off = 0x00, Basic = 0x01, // 10 bytes Extended = 0x03 // 12 bytes }; - public struct IR + public struct SIR { public bool Active; public Point Position; // X: 0-1023; Y: 0-767 public int Width; // 0-15 } - public struct IRState + public struct SIRState { - public IRMode Mode; - public IR[] Sensors; + public EIRMode Mode; + public SIR[] Sensors; public Point Position; //0..1023, 0..767 public Point Distance; //between Point 0 and Point 1 } - public struct AccelStatus + public struct SAccelStatus { public SPoint3 RawValues; //0-255 - public SPoint3f Values; //0-3 + public SPoint3F Values; //0-3 } - public struct AccelCalibrationInfo + public struct SAccelCalibrationInfo { public byte X0, Y0, Z0; //zero point public byte GravityX, GravityY, GravityZ; //gravity } - public struct Buttons + public struct SButtons { public bool Up, Down, Left, Right, A, B, Plus, Minus, One, Two, Home; } - public enum InputReport : byte + public enum EInputReport : byte { Status = 0x20, ReadData = 0x21, @@ -91,7 +91,7 @@ namespace Vocaluxe.Lib.Input.WiiMote IRExtensionAccel = 0x37, }; - public enum IRSensitivity + public enum EIRSensitivity { Level1, Level2, @@ -103,35 +103,39 @@ namespace Vocaluxe.Lib.Input.WiiMote #endregion DataTypes #region Events - public class WiiMoteChangedEventArgs : EventArgs + public class CWiiMoteChangedEventArgs : EventArgs { - public WiiMoteStatus WiiMoteState; + public CWiiMoteStatus WiiMoteState; - public WiiMoteChangedEventArgs(WiiMoteStatus ws) + public CWiiMoteChangedEventArgs(CWiiMoteStatus ws) { WiiMoteState = ws; } } #endregion Events - public class WiiMoteLib : IDisposable + public class CWiiMoteLib : IDisposable { - private const ushort VID = 0x057e; - private const ushort PID = 0x0306; //Wiimotion - private const ushort PIDPlus = 0x0330; //Wiimotion Plus +// ReSharper disable InconsistentNaming + private const ushort _VID = 0x057e; +// ReSharper restore InconsistentNaming + private const ushort _PID = 0x0306; //Wiimotion + private const ushort _PIDPlus = 0x0330; //Wiimotion Plus // registers - private const int REGISTER_IR = 0x04b00030; - private const int REGISTER_IR_SENSITIVITY_1 = 0x04b00000; - private const int REGISTER_IR_SENSITIVITY_2 = 0x04b0001a; - private const int REGISTER_IR_MODE = 0x04b00033; + private const int _RegisterIR = 0x04b00030; + private const int _RegisterIRSensitivity1 = 0x04b00000; + private const int _RegisterIRSensitivity2 = 0x04b0001a; + private const int _RegisterIRMode = 0x04b00033; - private const int REPORT_LENGTH = 22; + private const int _ReportLength = 22; // output commands - private enum OutputReport : byte + private enum EOutputReport : byte { +// ReSharper disable InconsistentNaming LEDs = 0x11, +// ReSharper restore InconsistentNaming Type = 0x12, IR = 0x13, Status = 0x15, @@ -144,7 +148,7 @@ namespace Vocaluxe.Lib.Input.WiiMote // data handling private IntPtr _Handle; - private readonly byte[] _Buff = new byte[REPORT_LENGTH]; + private readonly byte[] _Buff = new byte[_ReportLength]; private byte[] _ReadBuff; private int _Address; private short _Size; @@ -159,20 +163,32 @@ namespace Vocaluxe.Lib.Input.WiiMote get { return _Connected; } } - private readonly WiiMoteStatus _WiiMoteState = new WiiMoteStatus(); + private readonly CWiiMoteStatus _WiiMoteState = new CWiiMoteStatus(); private readonly AutoResetEvent _ReadDone = new AutoResetEvent(false); - public event EventHandler WiiMoteChanged; + public event EventHandler WiiMoteChanged; #region Interface - public WiiMoteLib() + public CWiiMoteLib() { _Connected = false; _Active = true; _Error = false; - _Reader = new Thread(ReaderLoop); + _Reader = new Thread(_ReaderLoop); _Reader.Start(); } + private bool _TryConnect(ushort pid) + { + bool connected = CHIDApi.Open(_VID, pid, out _Handle); + if (connected) + { + connected = _ReadCalibration(); + if (!connected) + CHIDApi.Close(_Handle); + } + return connected; + } + public bool Connect() { _Connected = false; @@ -180,9 +196,9 @@ namespace Vocaluxe.Lib.Input.WiiMote if (_Error) return false; - CHIDAPI.Exit(); + CHIDApi.Exit(); - if (!CHIDAPI.Init()) + if (!CHIDApi.Init()) { CLog.LogError("WiiMoteLib: Can't initialize HID API"); string msg = "Please install the Visual C++ Redistributable Packages 2008!"; @@ -194,21 +210,11 @@ namespace Vocaluxe.Lib.Input.WiiMote } //Try WiiMotion - if (_Connected = CHIDAPI.Open(VID, PID, out _Handle)) - { - if (!(_Connected = ReadCalibration())) - CHIDAPI.Close(_Handle); - } - - if (_Connected) - return true; + _Connected = _TryConnect(_PID); //Try WiiMotion Plus - if (_Connected = CHIDAPI.Open(VID, PIDPlus, out _Handle)) - { - if (!(_Connected = ReadCalibration())) - CHIDAPI.Close(_Handle); - } + if (!_Connected) + _Connected = _TryConnect(_PIDPlus); return _Connected; } @@ -217,30 +223,30 @@ namespace Vocaluxe.Lib.Input.WiiMote { _Connected = false; _Active = false; - CHIDAPI.Exit(); + CHIDApi.Exit(); } - public void SetReportType(InputReport type, IRSensitivity irSensitivity, bool continuous) + public void SetReportType(EInputReport type, EIRSensitivity irSensitivity, bool continuous) { if (!_Connected) return; switch (type) { - case InputReport.IRAccel: - EnableIR(IRMode.Extended, irSensitivity); + case EInputReport.IRAccel: + _EnableIR(EIRMode.Extended, irSensitivity); break; default: - DisableIR(); + _DisableIR(); break; } - ClearReport(); - _Buff[0] = (byte)OutputReport.Type; + _ClearReport(); + _Buff[0] = (byte)EOutputReport.Type; _Buff[1] = (byte)((continuous ? 0x04 : 0x00) | (byte)(_WiiMoteState.Rumble ? 0x01 : 0x00)); _Buff[2] = (byte)type; - CHIDAPI.Write(_Handle, _Buff); + CHIDApi.Write(_Handle, _Buff); } public void SetLEDs(bool led1, bool led2, bool led3, bool led4) @@ -253,17 +259,17 @@ namespace Vocaluxe.Lib.Input.WiiMote if (!_Connected) return; - ClearReport(); + _ClearReport(); - _Buff[0] = (byte)OutputReport.LEDs; + _Buff[0] = (byte)EOutputReport.LEDs; _Buff[1] = (byte)( (led1 ? 0x10 : 0x00) | (led2 ? 0x20 : 0x00) | (led3 ? 0x40 : 0x00) | (led4 ? 0x80 : 0x00) | - RumbleBit); + _RumbleBit); - CHIDAPI.Write(_Handle, _Buff); + CHIDApi.Write(_Handle, _Buff); } public void SetRumble(bool on) @@ -277,14 +283,14 @@ namespace Vocaluxe.Lib.Input.WiiMote _WiiMoteState.LEDState.LED4); } - public WiiMoteStatus WiiMoteState + public CWiiMoteStatus WiiMoteState { get { return _WiiMoteState; } } #endregion Interface #region Private stuff - private void ReaderLoop() + private void _ReaderLoop() { while (_Active) { @@ -292,27 +298,27 @@ namespace Vocaluxe.Lib.Input.WiiMote if (_Handle != IntPtr.Zero && _Connected) { - byte[] buff = new byte[REPORT_LENGTH]; + byte[] buff = new byte[_ReportLength]; try { - CHIDAPI.ReadTimeout(_Handle, out buff, REPORT_LENGTH, 100); + CHIDApi.ReadTimeout(_Handle, out buff, _ReportLength, 100); } catch (Exception e) { CLog.LogError("(WiiMoteLib) Error reading from device: " + e); } - if (ParseInputReport(buff)) + if (_ParseInputReport(buff)) { if (WiiMoteChanged != null) - WiiMoteChanged(this, new WiiMoteChangedEventArgs(_WiiMoteState)); + WiiMoteChanged(this, new CWiiMoteChangedEventArgs(_WiiMoteState)); } } } } - private bool ParseInputReport(byte[] buff) + private bool _ParseInputReport(byte[] buff) { if (buff == null) { @@ -320,42 +326,42 @@ namespace Vocaluxe.Lib.Input.WiiMote return false; } - InputReport type = (InputReport)buff[0]; + EInputReport type = (EInputReport)buff[0]; switch (type) { - case InputReport.Buttons: - ParseButtons(buff); + case EInputReport.Buttons: + _ParseButtons(buff); break; - case InputReport.ButtonsAccel: - ParseButtons(buff); - ParseAccel(buff); + case EInputReport.ButtonsAccel: + _ParseButtons(buff); + _ParseAccel(buff); break; - case InputReport.IRAccel: - ParseButtons(buff); - ParseAccel(buff); - ParseIR(buff); + case EInputReport.IRAccel: + _ParseButtons(buff); + _ParseAccel(buff); + _ParseIR(buff); break; - case InputReport.ButtonsExtension: - ParseButtons(buff); + case EInputReport.ButtonsExtension: + _ParseButtons(buff); break; - case InputReport.ExtensionAccel: - ParseButtons(buff); - ParseAccel(buff); + case EInputReport.ExtensionAccel: + _ParseButtons(buff); + _ParseAccel(buff); break; - case InputReport.IRExtensionAccel: - ParseButtons(buff); - ParseAccel(buff); - ParseIR(buff); + case EInputReport.IRExtensionAccel: + _ParseButtons(buff); + _ParseAccel(buff); + _ParseIR(buff); break; - case InputReport.Status: - ParseButtons(buff); + case EInputReport.Status: + _ParseButtons(buff); _WiiMoteState.Battery = buff[6]; _WiiMoteState.LEDState.LED1 = (buff[3] & 0x10) != 0; @@ -364,15 +370,15 @@ namespace Vocaluxe.Lib.Input.WiiMote _WiiMoteState.LEDState.LED4 = (buff[3] & 0x80) != 0; break; - case InputReport.ReadData: - ParseButtons(buff); - ParseReadData(buff); + case EInputReport.ReadData: + _ParseButtons(buff); + _ParseReadData(buff); break; - case InputReport.Ack: + case EInputReport.Ack: return false; - case InputReport.Buttons8Bytes: + case EInputReport.Buttons8Bytes: break; default: @@ -383,7 +389,7 @@ namespace Vocaluxe.Lib.Input.WiiMote return true; } - private byte[] DecryptBuffer(byte[] buff) + private byte[] _DecryptBuffer(byte[] buff) { for (int i = 0; i < buff.Length; i++) buff[i] = (byte)(((buff[i] ^ 0x17) + 0x17) & 0xff); @@ -391,7 +397,7 @@ namespace Vocaluxe.Lib.Input.WiiMote return buff; } - private void ParseButtons(byte[] buff) + private void _ParseButtons(byte[] buff) { _WiiMoteState.ButtonState.A = (buff[2] & 0x08) != 0; _WiiMoteState.ButtonState.B = (buff[2] & 0x04) != 0; @@ -406,7 +412,7 @@ namespace Vocaluxe.Lib.Input.WiiMote _WiiMoteState.ButtonState.Right = (buff[1] & 0x02) != 0; } - private void ParseAccel(byte[] buff) + private void _ParseAccel(byte[] buff) { _WiiMoteState.AccelState.RawValues.X = buff[3]; _WiiMoteState.AccelState.RawValues.Y = buff[4]; @@ -420,11 +426,11 @@ namespace Vocaluxe.Lib.Input.WiiMote ((float)_WiiMoteState.AccelCalibrationInfo.GravityZ - _WiiMoteState.AccelCalibrationInfo.Z0); } - private void ParseIR(byte[] buff) + private void _ParseIR(byte[] buff) { switch (_WiiMoteState.IRState.Mode) { - case IRMode.Basic: + case EIRMode.Basic: if (_WiiMoteState.IRState.Sensors[0].Active = !(buff[6] == 0xff && buff[7] == 0xff)) { _WiiMoteState.IRState.Sensors[0].Position.X = buff[6] | ((buff[8] >> 4) & 0x03) << 8; @@ -439,7 +445,7 @@ namespace Vocaluxe.Lib.Input.WiiMote _WiiMoteState.IRState.Sensors[1].Width = 0; } break; - case IRMode.Extended: + case EIRMode.Extended: for (int i = 0; i < 4; i++) { if (_WiiMoteState.IRState.Sensors[i].Active = !(buff[6 + i * 3] == 0xff && buff[7 + i * 3] == 0xff && buff[8 + i * 3] == 0xff)) @@ -474,7 +480,7 @@ namespace Vocaluxe.Lib.Input.WiiMote } } - private void ParseReadData(byte[] buff) + private void _ParseReadData(byte[] buff) { if ((buff[3] & 0x08) != 0) { @@ -497,7 +503,7 @@ namespace Vocaluxe.Lib.Input.WiiMote _ReadDone.Set(); } - private byte RumbleBit + private byte _RumbleBit { get { @@ -507,10 +513,10 @@ namespace Vocaluxe.Lib.Input.WiiMote } } - private bool ReadCalibration() + private bool _ReadCalibration() { // this appears to change the report type to 0x31 - byte[] buff = ReadData(0x0016, 7); + byte[] buff = _ReadData(0x0016, 7); if (buff == null) return false; @@ -524,95 +530,95 @@ namespace Vocaluxe.Lib.Input.WiiMote return true; } - private void EnableIR(IRMode mode, IRSensitivity Sensitivity) + private void _EnableIR(EIRMode mode, EIRSensitivity sensitivity) { _WiiMoteState.IRState.Mode = mode; - ClearReport(); - _Buff[0] = (byte)OutputReport.IR; - _Buff[1] = (byte)(0x04 | RumbleBit); - CHIDAPI.Write(_Handle, _Buff); + _ClearReport(); + _Buff[0] = (byte)EOutputReport.IR; + _Buff[1] = (byte)(0x04 | _RumbleBit); + CHIDApi.Write(_Handle, _Buff); Thread.Sleep(50); - ClearReport(); - _Buff[0] = (byte)OutputReport.IR2; - _Buff[1] = (byte)(0x04 | RumbleBit); - CHIDAPI.Write(_Handle, _Buff); + _ClearReport(); + _Buff[0] = (byte)EOutputReport.IR2; + _Buff[1] = (byte)(0x04 | _RumbleBit); + CHIDApi.Write(_Handle, _Buff); Thread.Sleep(50); - WriteData(REGISTER_IR, 0x08); + _WriteData(_RegisterIR, 0x08); Thread.Sleep(50); - switch (Sensitivity) + switch (sensitivity) { - case IRSensitivity.Level1: - WriteData(REGISTER_IR_SENSITIVITY_1, 9, new byte[] {0x02, 0x00, 0x00, 0x71, 0x01, 0x00, 0x64, 0x00, 0xfe}); + case EIRSensitivity.Level1: + _WriteData(_RegisterIRSensitivity1, 9, new byte[] {0x02, 0x00, 0x00, 0x71, 0x01, 0x00, 0x64, 0x00, 0xfe}); Thread.Sleep(50); - WriteData(REGISTER_IR_SENSITIVITY_2, 2, new byte[] {0xfd, 0x05}); + _WriteData(_RegisterIRSensitivity2, 2, new byte[] {0xfd, 0x05}); break; - case IRSensitivity.Level2: - WriteData(REGISTER_IR_SENSITIVITY_1, 9, new byte[] {0x02, 0x00, 0x00, 0x71, 0x01, 0x00, 0x96, 0x00, 0xb4}); + case EIRSensitivity.Level2: + _WriteData(_RegisterIRSensitivity1, 9, new byte[] {0x02, 0x00, 0x00, 0x71, 0x01, 0x00, 0x96, 0x00, 0xb4}); Thread.Sleep(50); - WriteData(REGISTER_IR_SENSITIVITY_2, 2, new byte[] {0xb3, 0x04}); + _WriteData(_RegisterIRSensitivity2, 2, new byte[] {0xb3, 0x04}); break; - case IRSensitivity.Level3: - WriteData(REGISTER_IR_SENSITIVITY_1, 9, new byte[] {0x02, 0x00, 0x00, 0x71, 0x01, 0x00, 0xaa, 0x00, 0x64}); + case EIRSensitivity.Level3: + _WriteData(_RegisterIRSensitivity1, 9, new byte[] {0x02, 0x00, 0x00, 0x71, 0x01, 0x00, 0xaa, 0x00, 0x64}); Thread.Sleep(50); - WriteData(REGISTER_IR_SENSITIVITY_2, 2, new byte[] {0x63, 0x03}); + _WriteData(_RegisterIRSensitivity2, 2, new byte[] {0x63, 0x03}); break; - case IRSensitivity.Level4: - WriteData(REGISTER_IR_SENSITIVITY_1, 9, new byte[] {0x02, 0x00, 0x00, 0x71, 0x01, 0x00, 0xc8, 0x00, 0x36}); + case EIRSensitivity.Level4: + _WriteData(_RegisterIRSensitivity1, 9, new byte[] {0x02, 0x00, 0x00, 0x71, 0x01, 0x00, 0xc8, 0x00, 0x36}); Thread.Sleep(50); - WriteData(REGISTER_IR_SENSITIVITY_2, 2, new byte[] {0x35, 0x03}); + _WriteData(_RegisterIRSensitivity2, 2, new byte[] {0x35, 0x03}); break; - case IRSensitivity.Level5: - WriteData(REGISTER_IR_SENSITIVITY_1, 9, new byte[] {0x07, 0x00, 0x00, 0x71, 0x01, 0x00, 0x72, 0x00, 0x20}); + case EIRSensitivity.Level5: + _WriteData(_RegisterIRSensitivity1, 9, new byte[] {0x07, 0x00, 0x00, 0x71, 0x01, 0x00, 0x72, 0x00, 0x20}); Thread.Sleep(50); - WriteData(REGISTER_IR_SENSITIVITY_2, 2, new byte[] {0x1, 0x03}); + _WriteData(_RegisterIRSensitivity2, 2, new byte[] {0x1, 0x03}); break; - case IRSensitivity.Max: - WriteData(REGISTER_IR_SENSITIVITY_1, 9, new byte[] {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x00, 0x41}); + case EIRSensitivity.Max: + _WriteData(_RegisterIRSensitivity1, 9, new byte[] {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x00, 0x41}); Thread.Sleep(50); - WriteData(REGISTER_IR_SENSITIVITY_2, 2, new byte[] {0x40, 0x00}); + _WriteData(_RegisterIRSensitivity2, 2, new byte[] {0x40, 0x00}); break; } Thread.Sleep(50); - WriteData(REGISTER_IR_MODE, (byte)mode); + _WriteData(_RegisterIRMode, (byte)mode); Thread.Sleep(50); - WriteData(REGISTER_IR, 0x08); + _WriteData(_RegisterIR, 0x08); Thread.Sleep(50); } - private void DisableIR() + private void _DisableIR() { - _WiiMoteState.IRState.Mode = IRMode.Off; + _WiiMoteState.IRState.Mode = EIRMode.Off; - ClearReport(); - _Buff[0] = (byte)OutputReport.IR; - _Buff[1] = RumbleBit; - CHIDAPI.Write(_Handle, _Buff); + _ClearReport(); + _Buff[0] = (byte)EOutputReport.IR; + _Buff[1] = _RumbleBit; + CHIDApi.Write(_Handle, _Buff); - ClearReport(); - _Buff[0] = (byte)OutputReport.IR2; - _Buff[1] = RumbleBit; - CHIDAPI.Write(_Handle, _Buff); + _ClearReport(); + _Buff[0] = (byte)EOutputReport.IR2; + _Buff[1] = _RumbleBit; + CHIDApi.Write(_Handle, _Buff); } - private void ClearReport() + private void _ClearReport() { - Array.Clear(_Buff, 0, REPORT_LENGTH); + Array.Clear(_Buff, 0, _ReportLength); } - private byte[] ReadData(int address, short size) + private byte[] _ReadData(int address, short size) { - ClearReport(); + _ClearReport(); _ReadBuff = new byte[size]; _Address = address & 0xffff; _Size = size; - _Buff[0] = (byte)OutputReport.ReadMemory; - _Buff[1] = (byte)(((address & 0xff000000) >> 24) | RumbleBit); + _Buff[0] = (byte)EOutputReport.ReadMemory; + _Buff[1] = (byte)(((address & 0xff000000) >> 24) | _RumbleBit); _Buff[2] = (byte)((address & 0x00ff0000) >> 16); _Buff[3] = (byte)((address & 0x0000ff00) >> 8); _Buff[4] = (byte)(address & 0x000000ff); @@ -620,7 +626,7 @@ namespace Vocaluxe.Lib.Input.WiiMote _Buff[5] = (byte)((size & 0xff00) >> 8); _Buff[6] = (byte)(size & 0xff); - CHIDAPI.Write(_Handle, _Buff); + CHIDApi.Write(_Handle, _Buff); if (!_ReadDone.WaitOne(1000, false)) { @@ -631,24 +637,24 @@ namespace Vocaluxe.Lib.Input.WiiMote return _ReadBuff; } - private void WriteData(int address, byte data) + private void _WriteData(int address, byte data) { - WriteData(address, 1, new byte[] {data}); + _WriteData(address, 1, new byte[] {data}); } - private void WriteData(int address, byte size, byte[] buff) + private void _WriteData(int address, byte size, byte[] buff) { - ClearReport(); + _ClearReport(); - _Buff[0] = (byte)OutputReport.WriteMemory; - _Buff[1] = (byte)(((address & 0xff000000) >> 24) | RumbleBit); + _Buff[0] = (byte)EOutputReport.WriteMemory; + _Buff[1] = (byte)(((address & 0xff000000) >> 24) | _RumbleBit); _Buff[2] = (byte)((address & 0x00ff0000) >> 16); _Buff[3] = (byte)((address & 0x0000ff00) >> 8); _Buff[4] = (byte)(address & 0x000000ff); _Buff[5] = size; Array.Copy(buff, 0, _Buff, 6, size); - CHIDAPI.Write(_Handle, _Buff); + CHIDApi.Write(_Handle, _Buff); Thread.Sleep(100); } @@ -661,7 +667,9 @@ namespace Vocaluxe.Lib.Input.WiiMote GC.SuppressFinalize(this); } +// ReSharper disable InconsistentNaming protected virtual void Dispose(bool disposing) +// ReSharper restore InconsistentNaming { if (disposing) { diff --git a/Vocaluxe/Lib/Playlist/CPlaylistFile.cs b/Vocaluxe/Lib/Playlist/CPlaylistFile.cs index 218bd83b..6959db3b 100644 --- a/Vocaluxe/Lib/Playlist/CPlaylistFile.cs +++ b/Vocaluxe/Lib/Playlist/CPlaylistFile.cs @@ -11,7 +11,7 @@ namespace Vocaluxe.Lib.Playlist { public class CPlaylistFile { - private static readonly XmlWriterSettings _settings = new XmlWriterSettings(); + private static readonly XmlWriterSettings _Settings = new XmlWriterSettings(); public string PlaylistName; public string PlaylistFile; @@ -19,23 +19,23 @@ namespace Vocaluxe.Lib.Playlist public CPlaylistFile() { - Init(); + _Init(); PlaylistName = string.Empty; PlaylistFile = string.Empty; } public CPlaylistFile(string file) { - Init(); + _Init(); PlaylistFile = file; - LoadPlaylist(); + _LoadPlaylist(); } - private void Init() + private void _Init() { - _settings.Indent = true; - _settings.Encoding = Encoding.UTF8; - _settings.ConformanceLevel = ConformanceLevel.Document; + _Settings.Indent = true; + _Settings.Encoding = Encoding.UTF8; + _Settings.ConformanceLevel = ConformanceLevel.Document; } public void SavePlaylist() @@ -53,20 +53,20 @@ namespace Vocaluxe.Lib.Playlist filename = "1"; int i = 0; - while (File.Exists(Path.Combine(CSettings.sFolderPlaylists, filename + ".xml"))) + while (File.Exists(Path.Combine(CSettings.FolderPlaylists, filename + ".xml"))) { i++; - if (!File.Exists(Path.Combine(CSettings.sFolderPlaylists, filename + i + ".xml"))) + if (!File.Exists(Path.Combine(CSettings.FolderPlaylists, filename + i + ".xml"))) filename += i; } - PlaylistFile = Path.Combine(CSettings.sFolderPlaylists, filename + ".xml"); + PlaylistFile = Path.Combine(CSettings.FolderPlaylists, filename + ".xml"); } XmlWriter writer; try { - writer = XmlWriter.Create(PlaylistFile, _settings); + writer = XmlWriter.Create(PlaylistFile, _Settings); } catch (Exception e) { @@ -117,7 +117,7 @@ namespace Vocaluxe.Lib.Playlist } } - private void LoadPlaylist() + private void _LoadPlaylist() { CXMLReader xmlReader = CXMLReader.OpenFile(PlaylistFile); if (xmlReader == null) @@ -143,13 +143,13 @@ namespace Vocaluxe.Lib.Playlist CPlaylistSong song = new CPlaylistSong(); song.SongID = -1; - CSong[] AllSongs = CSongs.AllSongs; + CSong[] allSongs = CSongs.AllSongs; - for (int s = 0; s < AllSongs.Length; s++) + for (int s = 0; s < allSongs.Length; s++) { - if (AllSongs[s].Artist == artist && AllSongs[s].Title == title) + if (allSongs[s].Artist == artist && allSongs[s].Title == title) { - song.SongID = AllSongs[s].ID; + song.SongID = allSongs[s].ID; break; } } @@ -167,11 +167,11 @@ namespace Vocaluxe.Lib.Playlist CLog.LogError("Can't find PlaylistName in Playlist File: " + PlaylistFile); } - public void AddSong(int SongID) + public void AddSong(int songID) { CPlaylistSong song = new CPlaylistSong(); - song.SongID = SongID; - if (CSongs.GetSong(SongID).IsDuet) + song.SongID = songID; + if (CSongs.GetSong(songID).IsDuet) song.GameMode = EGameMode.TR_GAMEMODE_DUET; else song.GameMode = EGameMode.TR_GAMEMODE_NORMAL; @@ -179,49 +179,49 @@ namespace Vocaluxe.Lib.Playlist Songs.Add(song); } - public void AddSong(int SongID, EGameMode gm) + public void AddSong(int songID, EGameMode gm) { CPlaylistSong song = new CPlaylistSong(); - song.SongID = SongID; + song.SongID = songID; song.GameMode = gm; Songs.Add(song); } - public void DeleteSong(int SongNr) + public void DeleteSong(int songNr) { - Songs.RemoveAt(SongNr); + Songs.RemoveAt(songNr); } - public void SongUp(int SongNr) + public void SongUp(int songNr) { - if (SongNr < Songs.Count - 1 && SongNr > 0) - Songs.Reverse(SongNr - 1, 2); + if (songNr < Songs.Count - 1 && songNr > 0) + Songs.Reverse(songNr - 1, 2); } - public void SongDown(int SongNr) + public void SongDown(int songNr) { - if (SongNr < Songs.Count - 1 && SongNr >= 0) - Songs.Reverse(SongNr, 2); + if (songNr < Songs.Count - 1 && songNr >= 0) + Songs.Reverse(songNr, 2); } - public void SongMove(int SourceNr, int DestNr) + public void SongMove(int sourceNr, int destNr) { - if (SourceNr < 0 || DestNr < 0 || SourceNr == DestNr || SourceNr > Songs.Count - 1 || DestNr > Songs.Count - 1) + if (sourceNr < 0 || destNr < 0 || sourceNr == destNr || sourceNr > Songs.Count - 1 || destNr > Songs.Count - 1) return; - CPlaylistSong ps = new CPlaylistSong(Songs[SourceNr]); - Songs.RemoveAt(SourceNr); - Songs.Insert(DestNr, ps); + CPlaylistSong ps = new CPlaylistSong(Songs[sourceNr]); + Songs.RemoveAt(sourceNr); + Songs.Insert(destNr, ps); } - public void SongInsert(int DestNr, int SongID, EGameMode gm) + public void SongInsert(int destNr, int songID, EGameMode gm) { - if (DestNr < 0 || DestNr > Songs.Count - 1) + if (destNr < 0 || destNr > Songs.Count - 1) return; - CPlaylistSong ps = new CPlaylistSong(SongID, gm); - Songs.Insert(DestNr, ps); + CPlaylistSong ps = new CPlaylistSong(songID, gm); + Songs.Insert(destNr, ps); } } } \ No newline at end of file diff --git a/Vocaluxe/Lib/Sound/CDirectSoundRecord.cs b/Vocaluxe/Lib/Sound/CDirectSoundRecord.cs index e689d8fb..6ef21510 100644 --- a/Vocaluxe/Lib/Sound/CDirectSoundRecord.cs +++ b/Vocaluxe/Lib/Sound/CDirectSoundRecord.cs @@ -9,10 +9,10 @@ namespace Vocaluxe.Lib.Sound { class CDirectSoundRecord : IRecord { - private bool _initialized; + private bool _Initialized; private List _Devices; private SRecordDevice[] _DeviceConfig; - private List _Sources; + private List _Sources; private readonly CBuffer[] _Buffer; @@ -29,7 +29,7 @@ namespace Vocaluxe.Lib.Sound { DeviceCollection devices = DirectSoundCapture.GetDevices(); _Devices = new List(); - _Sources = new List(); + _Sources = new List(); int id = 0; foreach (DeviceInformation dev in devices) @@ -57,43 +57,43 @@ namespace Vocaluxe.Lib.Sound } _DeviceConfig = _Devices.ToArray(); - _initialized = true; + _Initialized = true; return true; } public void CloseAll() { - if (_initialized) + if (_Initialized) { Stop(); - _initialized = false; + _Initialized = false; } //System.IO.File.WriteAllBytes("test0.raw", _Buffer[0].Buffer); } - public bool Start(SRecordDevice[] DeviceConfig) + public bool Start(SRecordDevice[] deviceConfig) { - if (!_initialized) + if (!_Initialized) return false; for (int i = 0; i < _Buffer.Length; i++) _Buffer[i].Reset(); - _DeviceConfig = DeviceConfig; - bool[] active = new bool[DeviceConfig.Length]; - Guid[] guid = new Guid[DeviceConfig.Length]; - short[] channels = new short[DeviceConfig.Length]; - for (int dev = 0; dev < DeviceConfig.Length; dev++) + _DeviceConfig = deviceConfig; + bool[] active = new bool[deviceConfig.Length]; + Guid[] guid = new Guid[deviceConfig.Length]; + short[] channels = new short[deviceConfig.Length]; + for (int dev = 0; dev < deviceConfig.Length; dev++) { active[dev] = false; - for (int inp = 0; inp < DeviceConfig[dev].Inputs.Count; inp++) + for (int inp = 0; inp < deviceConfig[dev].Inputs.Count; inp++) { - if (DeviceConfig[dev].Inputs[inp].PlayerChannel1 > 0 || - DeviceConfig[dev].Inputs[inp].PlayerChannel2 > 0) + if (deviceConfig[dev].Inputs[inp].PlayerChannel1 > 0 || + deviceConfig[dev].Inputs[inp].PlayerChannel2 > 0) active[dev] = true; - guid[dev] = new Guid(DeviceConfig[dev].Driver); - channels[dev] = (short)DeviceConfig[dev].Inputs[0].Channels; + guid[dev] = new Guid(deviceConfig[dev].Driver); + channels[dev] = (short)deviceConfig[dev].Inputs[0].Channels; } } @@ -101,25 +101,25 @@ namespace Vocaluxe.Lib.Sound { if (active[i]) { - SoundCardSource source = new SoundCardSource(guid[i], channels[i]); - source.SampleRateKHz = 44.1; - source.SampleDataReady += OnDataReady; + CSoundCardSource source = new CSoundCardSource(guid[i], channels[i]); + source.SampleRateKhz = 44.1; + source.SampleDataReady += _OnDataReady; source.Start(); _Sources.Add(source); } } - _DeviceConfig = DeviceConfig; + _DeviceConfig = deviceConfig; return true; } public bool Stop() { - if (!_initialized) + if (!_Initialized) return false; - foreach (SoundCardSource source in _Sources) + foreach (CSoundCardSource source in _Sources) { source.Stop(); source.Dispose(); @@ -129,57 +129,57 @@ namespace Vocaluxe.Lib.Sound return true; } - public void AnalyzeBuffer(int Player) + public void AnalyzeBuffer(int player) { - if (!_initialized) + if (!_Initialized) return; - _Buffer[Player].AnalyzeBuffer(); + _Buffer[player].AnalyzeBuffer(); } - public int GetToneAbs(int Player) + public int GetToneAbs(int player) { - if (!_initialized) + if (!_Initialized) return 0; - return _Buffer[Player].ToneAbs; + return _Buffer[player].ToneAbs; } - public int GetTone(int Player) + public int GetTone(int player) { - if (!_initialized) + if (!_Initialized) return 0; - return _Buffer[Player].Tone; + return _Buffer[player].Tone; } - public void SetTone(int Player, int Tone) + public void SetTone(int player, int tone) { - if (!_initialized) + if (!_Initialized) return; - _Buffer[Player].Tone = Tone; + _Buffer[player].Tone = tone; } - public float GetMaxVolume(int Player) + public float GetMaxVolume(int player) { - if (!_initialized) + if (!_Initialized) return 0f; - return _Buffer[Player].MaxVolume; + return _Buffer[player].MaxVolume; } - public bool ToneValid(int Player) + public bool ToneValid(int player) { - if (!_initialized) + if (!_Initialized) return false; - return _Buffer[Player].ToneValid; + return _Buffer[player].ToneValid; } public SRecordDevice[] RecordDevices() { - if (!_initialized) + if (!_Initialized) return null; if (_Devices.Count == 0) @@ -188,36 +188,36 @@ namespace Vocaluxe.Lib.Sound return _Devices.ToArray(); } - public int NumHalfTones(int Player) + public int NumHalfTones(int player) { - if (!_initialized) + if (!_Initialized) return 0; - return _Buffer[Player].NumHalfTones; + return _Buffer[player].NumHalfTones; } - public float[] ToneWeigth(int Player) + public float[] ToneWeigth(int player) { - if (!_initialized) + if (!_Initialized) return null; - return _Buffer[Player].ToneWeigth; + return _Buffer[player].ToneWeigth; } - private void OnDataReady(object sender, SampleDataEventArgs e) + private void _OnDataReady(object sender, CSampleDataEventArgs e) { - if (_initialized) + if (_Initialized) { - byte[] _leftBuffer = new byte[e.Data.Length / 2]; - byte[] _rightBuffer = new byte[e.Data.Length / 2]; + byte[] leftBuffer = new byte[e.Data.Length / 2]; + byte[] rightBuffer = new byte[e.Data.Length / 2]; //[]: Sample, L: Left channel R: Right channel //[LR][LR][LR][LR][LR][LR] //The data is interleaved and needs to be demultiplexed for (int i = 0; i < e.Data.Length / 2; i++) { - _leftBuffer[i] = e.Data[i * 2 - (i % 2)]; - _rightBuffer[i] = e.Data[i * 2 - (i % 2) + 2]; + leftBuffer[i] = e.Data[i * 2 - (i % 2)]; + rightBuffer[i] = e.Data[i * 2 - (i % 2) + 2]; } for (int i = 0; i < _DeviceConfig.Length; i++) @@ -225,18 +225,18 @@ namespace Vocaluxe.Lib.Sound if (_DeviceConfig[i].Driver == e.Guid.ToString()) { if (_DeviceConfig[i].Inputs[0].PlayerChannel1 > 0) - _Buffer[_DeviceConfig[i].Inputs[0].PlayerChannel1 - 1].ProcessNewBuffer(_leftBuffer); + _Buffer[_DeviceConfig[i].Inputs[0].PlayerChannel1 - 1].ProcessNewBuffer(leftBuffer); if (_DeviceConfig[i].Inputs[0].PlayerChannel2 > 0) - _Buffer[_DeviceConfig[i].Inputs[0].PlayerChannel2 - 1].ProcessNewBuffer(_rightBuffer); + _Buffer[_DeviceConfig[i].Inputs[0].PlayerChannel2 - 1].ProcessNewBuffer(rightBuffer); } } } } - public class SampleDataEventArgs : EventArgs + public class CSampleDataEventArgs : EventArgs { - public SampleDataEventArgs(byte[] data, Guid guid) + public CSampleDataEventArgs(byte[] data, Guid guid) { Data = data; Guid = guid; @@ -246,119 +246,119 @@ namespace Vocaluxe.Lib.Sound public Guid Guid { get; private set; } } - public class SoundCardSource : IDisposable + public class CSoundCardSource : IDisposable { - private volatile bool running; - private readonly int bufferSize; - private CaptureBuffer CaptureBuffer; - private CaptureBufferDescription bufferDescription; - private DirectSoundCapture captureDevice; - private readonly WaveFormat waveFormat; - private Thread captureThread; - private List notifications; - private int bufferPortionCount; - private int bufferPortionSize; - private WaitHandle[] waitHandles; - private double sampleRate; - private readonly Guid guid; - private readonly short channels; + private volatile bool _Running; + private readonly int _BufferSize; + private CaptureBuffer _CaptureBuffer; + private CaptureBufferDescription _BufferDescription; + private DirectSoundCapture _CaptureDevice; + private readonly WaveFormat _WaveFormat; + private Thread _CaptureThread; + private List _Notifications; + private int _BufferPortionCount; + private int _BufferPortionSize; + private WaitHandle[] _WaitHandles; + private double _SampleRate; + private readonly Guid _Guid; + private readonly short _Channels; - public SoundCardSource(Guid guid, short channels) + public CSoundCardSource(Guid guid, short channels) { - this.guid = guid; - this.channels = channels; - waveFormat = new WaveFormat(); - SampleRateKHz = 44.1; - bufferSize = 2048; + this._Guid = guid; + this._Channels = channels; + _WaveFormat = new WaveFormat(); + SampleRateKhz = 44.1; + _BufferSize = 2048; } - public event EventHandler SampleDataReady = delegate { }; + public event EventHandler SampleDataReady = delegate { }; - public double SampleRateKHz + public double SampleRateKhz { - get { return sampleRate; } + get { return _SampleRate; } set { - sampleRate = value; + _SampleRate = value; - if (running) + if (_Running) Restart(); } } public void Start() { - if (running) + if (_Running) throw new InvalidOperationException(); - if (captureDevice == null) - captureDevice = new DirectSoundCapture(guid); + if (_CaptureDevice == null) + _CaptureDevice = new DirectSoundCapture(_Guid); - waveFormat.FormatTag = WaveFormatTag.Pcm; // Change to WaveFormatTag.IeeeFloat for float - waveFormat.BitsPerSample = 16; // Set this to 32 for float - waveFormat.BlockAlignment = (short)(channels * (waveFormat.BitsPerSample / 8)); - waveFormat.Channels = channels; - waveFormat.SamplesPerSecond = (int)(SampleRateKHz * 1000D); - waveFormat.AverageBytesPerSecond = - waveFormat.SamplesPerSecond * - waveFormat.BlockAlignment; + _WaveFormat.FormatTag = WaveFormatTag.Pcm; // Change to WaveFormatTag.IeeeFloat for float + _WaveFormat.BitsPerSample = 16; // Set this to 32 for float + _WaveFormat.BlockAlignment = (short)(_Channels * (_WaveFormat.BitsPerSample / 8)); + _WaveFormat.Channels = _Channels; + _WaveFormat.SamplesPerSecond = (int)(SampleRateKhz * 1000D); + _WaveFormat.AverageBytesPerSecond = + _WaveFormat.SamplesPerSecond * + _WaveFormat.BlockAlignment; - bufferPortionCount = 2; + _BufferPortionCount = 2; - bufferDescription.BufferBytes = bufferSize * sizeof(short) * bufferPortionCount * channels; - bufferDescription.Format = waveFormat; - bufferDescription.WaveMapped = false; + _BufferDescription.BufferBytes = _BufferSize * sizeof(short) * _BufferPortionCount * _Channels; + _BufferDescription.Format = _WaveFormat; + _BufferDescription.WaveMapped = false; - CaptureBuffer = new CaptureBuffer(captureDevice, bufferDescription); + _CaptureBuffer = new CaptureBuffer(_CaptureDevice, _BufferDescription); - bufferPortionSize = CaptureBuffer.SizeInBytes / bufferPortionCount; - notifications = new List(); + _BufferPortionSize = _CaptureBuffer.SizeInBytes / _BufferPortionCount; + _Notifications = new List(); - for (int i = 0; i < bufferPortionCount; i++) + for (int i = 0; i < _BufferPortionCount; i++) { NotificationPosition notification = new NotificationPosition(); - notification.Offset = bufferPortionCount - 1 + (bufferPortionSize * i); + notification.Offset = _BufferPortionCount - 1 + (_BufferPortionSize * i); notification.Event = new AutoResetEvent(false); - notifications.Add(notification); + _Notifications.Add(notification); } - CaptureBuffer.SetNotificationPositions(notifications.ToArray()); - waitHandles = new WaitHandle[notifications.Count]; + _CaptureBuffer.SetNotificationPositions(_Notifications.ToArray()); + _WaitHandles = new WaitHandle[_Notifications.Count]; - for (int i = 0; i < notifications.Count; i++) - waitHandles[i] = notifications[i].Event; + for (int i = 0; i < _Notifications.Count; i++) + _WaitHandles[i] = _Notifications[i].Event; - captureThread = new Thread(DoCapture); - captureThread.IsBackground = true; + _CaptureThread = new Thread(_DoCapture); + _CaptureThread.IsBackground = true; - running = true; - captureThread.Start(); + _Running = true; + _CaptureThread.Start(); } public void Stop() { - running = false; + _Running = false; - if (captureThread != null) + if (_CaptureThread != null) { - captureThread.Join(); - captureThread = null; + _CaptureThread.Join(); + _CaptureThread = null; } - if (CaptureBuffer != null) + if (_CaptureBuffer != null) { - CaptureBuffer.Dispose(); - CaptureBuffer = null; + _CaptureBuffer.Dispose(); + _CaptureBuffer = null; } - if (notifications != null) + if (_Notifications != null) { - for (int i = 0; i < notifications.Count; i++) - notifications[i].Event.Close(); + for (int i = 0; i < _Notifications.Count; i++) + _Notifications[i].Event.Close(); - notifications.Clear(); - notifications = null; + _Notifications.Clear(); + _Notifications = null; } } @@ -368,30 +368,30 @@ namespace Vocaluxe.Lib.Sound Start(); } - private void DoCapture() + private void _DoCapture() { - int bufferPortionSamples = bufferPortionSize / sizeof(byte); + int bufferPortionSamples = _BufferPortionSize / sizeof(byte); // Buffer type must match this.waveFormat.FormatTag and this.waveFormat.BitsPerSample byte[] bufferPortion = new byte[bufferPortionSamples]; int bufferPortionIndex; - CaptureBuffer.Start(true); + _CaptureBuffer.Start(true); - while (running) + while (_Running) { - bufferPortionIndex = WaitHandle.WaitAny(waitHandles); + bufferPortionIndex = WaitHandle.WaitAny(_WaitHandles); - CaptureBuffer.Read( + _CaptureBuffer.Read( bufferPortion, 0, bufferPortionSamples, - bufferPortionSize * Math.Abs((bufferPortionIndex - 1) % bufferPortionCount)); + _BufferPortionSize * Math.Abs((bufferPortionIndex - 1) % _BufferPortionCount)); - SampleDataReady(this, new SampleDataEventArgs(bufferPortion, guid)); + SampleDataReady(this, new CSampleDataEventArgs(bufferPortion, _Guid)); } - CaptureBuffer.Stop(); + _CaptureBuffer.Stop(); } public void Dispose() @@ -400,16 +400,18 @@ namespace Vocaluxe.Lib.Sound GC.SuppressFinalize(this); } +// ReSharper disable InconsistentNaming protected virtual void Dispose(bool disposing) +// ReSharper restore InconsistentNaming { if (disposing) { Stop(); - if (captureDevice != null) + if (_CaptureDevice != null) { - captureDevice.Dispose(); - captureDevice = null; + _CaptureDevice.Dispose(); + _CaptureDevice = null; } } } diff --git a/Vocaluxe/Lib/Sound/CGstreamerAudio.cs b/Vocaluxe/Lib/Sound/CGstreamerAudio.cs index 289e1211..e2b180a0 100644 --- a/Vocaluxe/Lib/Sound/CGstreamerAudio.cs +++ b/Vocaluxe/Lib/Sound/CGstreamerAudio.cs @@ -10,7 +10,7 @@ namespace Vocaluxe.Lib.Sound #region log public CGstreamerAudioWrapper.LogCallback Log; - private void LogHandler(string text) + private void _LogHandler(string text) { CLog.LogError(text); } @@ -19,7 +19,7 @@ namespace Vocaluxe.Lib.Sound public CGstreamerAudio() { Init(); - Log = LogHandler; + Log = _LogHandler; //Is this really needed? CodaAnalyzer complains about it... //GC.SuppressFinalize(Log); CGstreamerAudioWrapper.SetLogCallback(Log); @@ -30,9 +30,9 @@ namespace Vocaluxe.Lib.Sound return CGstreamerAudioWrapper.Init(); } - public void SetGlobalVolume(float Volume) + public void SetGlobalVolume(float volume) { - CGstreamerAudioWrapper.SetGlobalVolume(Volume); + CGstreamerAudioWrapper.SetGlobalVolume(volume); } public int GetStreamCount() @@ -45,98 +45,98 @@ namespace Vocaluxe.Lib.Sound CGstreamerAudioWrapper.CloseAll(); } - public int Load(string Media) + public int Load(string media) { - Uri u = new Uri(Media); + Uri u = new Uri(media); int i = CGstreamerAudioWrapper.Load(u.AbsoluteUri); return i; } - public int Load(string Media, bool Prescan) + public int Load(string media, bool prescan) { - Uri u = new Uri(Media); - int i = CGstreamerAudioWrapper.Load(u.AbsoluteUri, Prescan); + Uri u = new Uri(media); + int i = CGstreamerAudioWrapper.Load(u.AbsoluteUri, prescan); return i; } - public void Close(int Stream) + public void Close(int stream) { - CGstreamerAudioWrapper.Close(Stream); + CGstreamerAudioWrapper.Close(stream); } - public void Play(int Stream) + public void Play(int stream) { - CGstreamerAudioWrapper.Play(Stream); + CGstreamerAudioWrapper.Play(stream); } - public void Play(int Stream, bool Loop) + public void Play(int stream, bool loop) { - CGstreamerAudioWrapper.Play(Stream, Loop); + CGstreamerAudioWrapper.Play(stream, loop); } - public void Pause(int Stream) + public void Pause(int stream) { - CGstreamerAudioWrapper.Pause(Stream); + CGstreamerAudioWrapper.Pause(stream); } - public void Stop(int Stream) + public void Stop(int stream) { - CGstreamerAudioWrapper.Stop(Stream); + CGstreamerAudioWrapper.Stop(stream); } - public void Fade(int Stream, float TargetVolume, float Seconds) + public void Fade(int stream, float targetVolume, float seconds) { - CGstreamerAudioWrapper.Fade(Stream, TargetVolume, Seconds); + CGstreamerAudioWrapper.Fade(stream, targetVolume, seconds); } - public void FadeAndPause(int Stream, float TargetVolume, float Seconds) + public void FadeAndPause(int stream, float targetVolume, float seconds) { - CGstreamerAudioWrapper.FadeAndPause(Stream, TargetVolume, Seconds); + CGstreamerAudioWrapper.FadeAndPause(stream, targetVolume, seconds); } - public void FadeAndStop(int Stream, float TargetVolume, float Seconds) + public void FadeAndStop(int stream, float targetVolume, float seconds) { - CGstreamerAudioWrapper.FadeAndStop(Stream, TargetVolume, Seconds); + CGstreamerAudioWrapper.FadeAndStop(stream, targetVolume, seconds); } - public void SetStreamVolume(int Stream, float Volume) + public void SetStreamVolume(int stream, float volume) { - CGstreamerAudioWrapper.SetStreamVolume(Stream, Volume); + CGstreamerAudioWrapper.SetStreamVolume(stream, volume); } - public void SetStreamVolumeMax(int Stream, float Volume) + public void SetStreamVolumeMax(int stream, float volume) { - CGstreamerAudioWrapper.SetStreamVolumeMax(Stream, Volume); + CGstreamerAudioWrapper.SetStreamVolumeMax(stream, volume); } - public float GetLength(int Stream) + public float GetLength(int stream) { - return CGstreamerAudioWrapper.GetLength(Stream); + return CGstreamerAudioWrapper.GetLength(stream); } - public float GetPosition(int Stream) + public float GetPosition(int stream) { - return CGstreamerAudioWrapper.GetPosition(Stream); + return CGstreamerAudioWrapper.GetPosition(stream); } - public bool IsPlaying(int Stream) + public bool IsPlaying(int stream) { - return CGstreamerAudioWrapper.IsPlaying(Stream); + return CGstreamerAudioWrapper.IsPlaying(stream); } - public bool IsPaused(int Stream) + public bool IsPaused(int stream) { - return CGstreamerAudioWrapper.IsPaused(Stream); + return CGstreamerAudioWrapper.IsPaused(stream); } - public bool IsFinished(int Stream) + public bool IsFinished(int stream) { - return CGstreamerAudioWrapper.IsFinished(Stream); + return CGstreamerAudioWrapper.IsFinished(stream); } - public void SetPosition(int Stream, float Position) + public void SetPosition(int stream, float position) { - CGstreamerAudioWrapper.SetPosition(Stream, Position); + CGstreamerAudioWrapper.SetPosition(stream, position); } public void Update() diff --git a/Vocaluxe/Lib/Sound/COpenALPlay.cs b/Vocaluxe/Lib/Sound/COpenALPlay.cs index 2885ab34..18518cac 100644 --- a/Vocaluxe/Lib/Sound/COpenALPlay.cs +++ b/Vocaluxe/Lib/Sound/COpenALPlay.cs @@ -12,14 +12,14 @@ namespace Vocaluxe.Lib.Sound class COpenALPlay : IPlayback, IDisposable { private bool _Initialized; - private readonly List _Decoder = new List(); - private CLOSEPROC closeproc; + private readonly List _Decoder = new List(); + private Closeproc _Closeproc; private int _Count = 1; private AudioContext _Context; - private readonly Object MutexDecoder = new Object(); + private readonly Object _MutexDecoder = new Object(); - private List _Streams; + private List _Streams; public COpenALPlay() { @@ -36,23 +36,23 @@ namespace Vocaluxe.Lib.Sound _Context.MakeCurrent(); - closeproc = close_proc; + _Closeproc = _CloseProc; _Initialized = true; - _Streams = new List(); + _Streams = new List(); return true; } public void CloseAll() { - lock (MutexDecoder) + lock (_MutexDecoder) { for (int i = 0; i < _Decoder.Count; i++) - _Decoder[i].Free(closeproc, i + 1, MutexDecoder); + _Decoder[i].Free(_Closeproc, i + 1, _MutexDecoder); } } - public void SetGlobalVolume(float Volume) + public void SetGlobalVolume(float volume) { if (_Initialized) { @@ -65,7 +65,7 @@ namespace Vocaluxe.Lib.Sound if (!_Initialized) return 0; - lock (MutexDecoder) + lock (_MutexDecoder) { return _Streams.Count; } @@ -75,169 +75,169 @@ namespace Vocaluxe.Lib.Sound { if (_Initialized) { - lock (MutexDecoder) + lock (_MutexDecoder) { - foreach (OpenAlStream stream in _Decoder) + foreach (COpenAlStream stream in _Decoder) stream.UploadData(); } } } #region Stream Handling - public int Load(string Media) + public int Load(string media) { - return Load(Media, false); + return Load(media, false); } - public int Load(string Media, bool Prescan) + public int Load(string media, bool prescan) { - AudioStreams stream = new AudioStreams(0); - OpenAlStream decoder = new OpenAlStream(); + SAudioStreams stream = new SAudioStreams(0); + COpenAlStream decoder = new COpenAlStream(); - if (decoder.Open(Media) > -1) + if (decoder.Open(media) > -1) { - lock (MutexDecoder) + lock (_MutexDecoder) { _Decoder.Add(decoder); - stream.handle = _Count++; - stream.file = Media; + stream.Handle = _Count++; + stream.File = media; _Streams.Add(stream); - return stream.handle; + return stream.Handle; } } return 0; } - public void Close(int Stream) + public void Close(int stream) { if (_Initialized) { - lock (MutexDecoder) + lock (_MutexDecoder) { - if (AlreadyAdded(Stream)) - _Decoder[GetStreamIndex(Stream)].Free(closeproc, Stream, MutexDecoder); + if (_AlreadyAdded(stream)) + _Decoder[_GetStreamIndex(stream)].Free(_Closeproc, stream, _MutexDecoder); } } } - public void Play(int Stream) + public void Play(int stream) { - Play(Stream, false); + Play(stream, false); } - public void Play(int Stream, bool Loop) + public void Play(int stream, bool loop) { if (_Initialized) { - lock (MutexDecoder) + lock (_MutexDecoder) { - if (AlreadyAdded(Stream)) + if (_AlreadyAdded(stream)) { - _Decoder[GetStreamIndex(Stream)].Loop = Loop; - _Decoder[GetStreamIndex(Stream)].Play(); + _Decoder[_GetStreamIndex(stream)].Loop = loop; + _Decoder[_GetStreamIndex(stream)].Play(); } } } } - public void Pause(int Stream) + public void Pause(int stream) { if (_Initialized) { - lock (MutexDecoder) + lock (_MutexDecoder) { - if (AlreadyAdded(Stream)) - _Decoder[GetStreamIndex(Stream)].Paused = true; + if (_AlreadyAdded(stream)) + _Decoder[_GetStreamIndex(stream)].Paused = true; } } } - public void Stop(int Stream) + public void Stop(int stream) { - Pause(Stream); + Pause(stream); } - public void Fade(int Stream, float TargetVolume, float Seconds) + public void Fade(int stream, float targetVolume, float seconds) { if (_Initialized) { - lock (MutexDecoder) + lock (_MutexDecoder) { - if (AlreadyAdded(Stream)) - _Decoder[GetStreamIndex(Stream)].Fade(TargetVolume, Seconds); + if (_AlreadyAdded(stream)) + _Decoder[_GetStreamIndex(stream)].Fade(targetVolume, seconds); } } } - public void FadeAndPause(int Stream, float TargetVolume, float Seconds) + public void FadeAndPause(int stream, float targetVolume, float seconds) { if (_Initialized) { - lock (MutexDecoder) + lock (_MutexDecoder) { - if (AlreadyAdded(Stream)) - _Decoder[GetStreamIndex(Stream)].FadeAndPause(TargetVolume, Seconds); + if (_AlreadyAdded(stream)) + _Decoder[_GetStreamIndex(stream)].FadeAndPause(targetVolume, seconds); } } } - public void FadeAndStop(int Stream, float TargetVolume, float Seconds) + public void FadeAndStop(int stream, float targetVolume, float seconds) { if (_Initialized) { - lock (MutexDecoder) + lock (_MutexDecoder) { - if (AlreadyAdded(Stream)) - _Decoder[GetStreamIndex(Stream)].FadeAndStop(TargetVolume, Seconds, closeproc, Stream); + if (_AlreadyAdded(stream)) + _Decoder[_GetStreamIndex(stream)].FadeAndStop(targetVolume, seconds, _Closeproc, stream); } } } - public void SetStreamVolume(int Stream, float Volume) + public void SetStreamVolume(int stream, float volume) { if (_Initialized) { - lock (MutexDecoder) + lock (_MutexDecoder) { - if (AlreadyAdded(Stream)) - _Decoder[GetStreamIndex(Stream)].Volume = Volume; + if (_AlreadyAdded(stream)) + _Decoder[_GetStreamIndex(stream)].Volume = volume; } } } - public void SetStreamVolumeMax(int Stream, float Volume) + public void SetStreamVolumeMax(int stream, float volume) { if (_Initialized) { - lock (MutexDecoder) + lock (_MutexDecoder) { - if (AlreadyAdded(Stream)) - _Decoder[GetStreamIndex(Stream)].VolumeMax = Volume; + if (_AlreadyAdded(stream)) + _Decoder[_GetStreamIndex(stream)].VolumeMax = volume; } } } - public float GetLength(int Stream) + public float GetLength(int stream) { if (_Initialized) { - lock (MutexDecoder) + lock (_MutexDecoder) { - if (AlreadyAdded(Stream)) - return _Decoder[GetStreamIndex(Stream)].Length; + if (_AlreadyAdded(stream)) + return _Decoder[_GetStreamIndex(stream)].Length; } } return 0f; } - public float GetPosition(int Stream) + public float GetPosition(int stream) { if (_Initialized) { - lock (MutexDecoder) + lock (_MutexDecoder) { - if (AlreadyAdded(Stream)) - return _Decoder[GetStreamIndex(Stream)].Position; + if (_AlreadyAdded(stream)) + return _Decoder[_GetStreamIndex(stream)].Position; } return 0f; @@ -245,98 +245,98 @@ namespace Vocaluxe.Lib.Sound return 0f; } - public bool IsPlaying(int Stream) + public bool IsPlaying(int stream) { if (_Initialized) { - lock (MutexDecoder) + lock (_MutexDecoder) { - if (AlreadyAdded(Stream)) - return !_Decoder[GetStreamIndex(Stream)].Paused && !_Decoder[GetStreamIndex(Stream)].Finished; + if (_AlreadyAdded(stream)) + return !_Decoder[_GetStreamIndex(stream)].Paused && !_Decoder[_GetStreamIndex(stream)].Finished; } } return false; } - public bool IsPaused(int Stream) + public bool IsPaused(int stream) { if (_Initialized) { - lock (MutexDecoder) + lock (_MutexDecoder) { - if (AlreadyAdded(Stream)) - return _Decoder[GetStreamIndex(Stream)].Paused; + if (_AlreadyAdded(stream)) + return _Decoder[_GetStreamIndex(stream)].Paused; } } return false; } - public bool IsFinished(int Stream) + public bool IsFinished(int stream) { if (_Initialized) { - lock (MutexDecoder) + lock (_MutexDecoder) { - if (AlreadyAdded(Stream)) - return _Decoder[GetStreamIndex(Stream)].Finished; + if (_AlreadyAdded(stream)) + return _Decoder[_GetStreamIndex(stream)].Finished; } } return true; } - public void SetPosition(int Stream, float Position) + public void SetPosition(int stream, float position) { if (_Initialized) { - lock (MutexDecoder) + lock (_MutexDecoder) { - if (AlreadyAdded(Stream)) - _Decoder[GetStreamIndex(Stream)].Skip(Position); + if (_AlreadyAdded(stream)) + _Decoder[_GetStreamIndex(stream)].Skip(position); } } } #endregion Stream Handling - private bool AlreadyAdded(int Stream) + private bool _AlreadyAdded(int stream) { - foreach (AudioStreams st in _Streams) + foreach (SAudioStreams st in _Streams) { - if (st.handle == Stream) + if (st.Handle == stream) return true; } return false; } - private int GetStreamIndex(int Stream) + private int _GetStreamIndex(int stream) { for (int i = 0; i < _Streams.Count; i++) { - if (_Streams[i].handle == Stream) + if (_Streams[i].Handle == stream) return i; } return -1; } - private void EndSync(int handle, int Stream, int data, IntPtr user) + private void _EndSync(int handle, int stream, int data, IntPtr user) { if (_Initialized) { - if (AlreadyAdded(Stream)) - Close(Stream); + if (_AlreadyAdded(stream)) + Close(stream); } } - private void close_proc(int StreamID) + private void _CloseProc(int streamID) { if (_Initialized) { - lock (MutexDecoder) + lock (_MutexDecoder) { - if (AlreadyAdded(StreamID)) + if (_AlreadyAdded(streamID)) { - int Index = GetStreamIndex(StreamID); - _Decoder.RemoveAt(Index); - _Streams.RemoveAt(Index); + int index = _GetStreamIndex(streamID); + _Decoder.RemoveAt(index); + _Streams.RemoveAt(index); } } } @@ -349,36 +349,36 @@ namespace Vocaluxe.Lib.Sound } } - class OpenAlStream : IDisposable + class COpenAlStream : IDisposable { - private const int buffer_size = 2048; - private const int buffer_count = 5; - private const long BUFSIZE = 50000L; + private const int _BufferSize = 2048; + private const int _BufferCount = 5; + private const long _Bufsize = 50000L; - private Object CloseMutex; + private Object _CloseMutex; - private int[] _buffers; - private int _state; - private int _source; - private FormatInfo _format; + private int[] _Buffers; + private int _State; + private int _Source; + private SFormatInfo _Format; private bool _Initialized; private int _ByteCount = 4; private float _Volume = 1f; private float _VolumeMax = 1f; - private readonly Stopwatch _fadeTimer = new Stopwatch(); + private readonly Stopwatch _FadeTimer = new Stopwatch(); - private float _fadeTime; - private float _targetVolume = 1f; - private float _startVolume = 1f; - private bool _closeStreamAfterFade; - private bool _pauseStreamAfterFade; - private bool _fading; + private float _FadeTime; + private float _TargetVolume = 1f; + private float _StartVolume = 1f; + private bool _CloseStreamAfterFade; + private bool _PauseStreamAfterFade; + private bool _Fading; private readonly Stopwatch _Timer = new Stopwatch(); - private CLOSEPROC _Closeproc; + private Closeproc _Closeproc; private int _StreamID; private string _FileName; private IAudioDecoder _Decoder; @@ -387,8 +387,8 @@ namespace Vocaluxe.Lib.Sound private bool _FileOpened; - private bool _waiting; - private bool _skip; + private bool _Waiting; + private bool _Skip; private bool _Loop; private float _Duration; @@ -397,32 +397,32 @@ namespace Vocaluxe.Lib.Sound private bool _Paused; - private RingBuffer _data; + private CRingBuffer _Data; private float _SetStart; private float _Start; private bool _SetLoop; private bool _SetSkip; - private bool _terminated; + private bool _Terminated; private readonly Thread _DecoderThread; - private AutoResetEvent EventDecode = new AutoResetEvent(false); + private AutoResetEvent _EventDecode = new AutoResetEvent(false); - private readonly Object MutexData = new Object(); - private readonly Object MutexSyncSignals = new Object(); + private readonly Object _MutexData = new Object(); + private readonly Object _MutexSyncSignals = new Object(); - public OpenAlStream() + public COpenAlStream() { _Initialized = false; - _DecoderThread = new Thread(Execute); + _DecoderThread = new Thread(_Execute); } - public void Free(CLOSEPROC close_proc, int StreamID, Object CloseMutex) + public void Free(Closeproc closeProc, int streamID, Object closeMutex) { - _Closeproc = close_proc; - _StreamID = StreamID; - _terminated = true; - this.CloseMutex = CloseMutex; + _Closeproc = closeProc; + _StreamID = streamID; + _Terminated = true; + this._CloseMutex = closeMutex; } public float Length @@ -440,9 +440,9 @@ namespace Vocaluxe.Lib.Sound { get { - lock (MutexData) + lock (_MutexData) { - return _NoMoreData && _data.BytesNotRead == 0L; + return _NoMoreData && _Data.BytesNotRead == 0L; } } } @@ -452,7 +452,7 @@ namespace Vocaluxe.Lib.Sound get { return _Volume * 100f; } set { - lock (MutexData) + lock (_MutexData) { _Volume = value / 100f; if (_Volume < 0f) @@ -469,7 +469,7 @@ namespace Vocaluxe.Lib.Sound get { return _VolumeMax * 100f; } set { - lock (MutexData) + lock (_MutexData) { _VolumeMax = value / 100f; if (_VolumeMax < 0f) @@ -498,58 +498,58 @@ namespace Vocaluxe.Lib.Sound set { _Paused = value; - lock (MutexSyncSignals) + lock (_MutexSyncSignals) { if (_Paused) { _Timer.Stop(); - AL.SourceStop(_source); + AL.SourceStop(_Source); } else { _Timer.Start(); - EventDecode.Set(); - AL.SourcePlay(_source); + _EventDecode.Set(); + AL.SourcePlay(_Source); } } } } - public void Fade(float TargetVolume, float FadeTime) + public void Fade(float targetVolume, float fadeTime) { - _fading = true; - _fadeTimer.Stop(); - _fadeTimer.Reset(); - _startVolume = _Volume; - _targetVolume = TargetVolume / 100f; - _fadeTime = FadeTime; - _fadeTimer.Start(); + _Fading = true; + _FadeTimer.Stop(); + _FadeTimer.Reset(); + _StartVolume = _Volume; + _TargetVolume = targetVolume / 100f; + _FadeTime = fadeTime; + _FadeTimer.Start(); } - public void FadeAndPause(float TargetVolume, float FadeTime) + public void FadeAndPause(float targetVolume, float fadeTime) { - _pauseStreamAfterFade = true; - Fade(TargetVolume, FadeTime); + _PauseStreamAfterFade = true; + Fade(targetVolume, fadeTime); } - public void FadeAndStop(float TargetVolume, float FadeTime, CLOSEPROC close_proc, int StreamID) + public void FadeAndStop(float targetVolume, float fadeTime, Closeproc closeProc, int streamID) { - _Closeproc = close_proc; - _StreamID = StreamID; - _closeStreamAfterFade = true; - Fade(TargetVolume, FadeTime); + _Closeproc = closeProc; + _StreamID = streamID; + _CloseStreamAfterFade = true; + Fade(targetVolume, fadeTime); } public void Play() { Paused = false; - _pauseStreamAfterFade = false; - AL.SourcePlay(_source); + _PauseStreamAfterFade = false; + AL.SourcePlay(_Source); } public void Stop() { - AL.SourceStop(_source); + AL.SourceStop(_Source); Skip(0f); } @@ -559,12 +559,12 @@ namespace Vocaluxe.Lib.Sound set { _SetLoop = value; } } - public int Open(string FileName) + public int Open(string fileName) { if (_FileOpened) return -1; - if (!File.Exists(FileName)) + if (!File.Exists(fileName)) return -1; if (_FileOpened) @@ -575,12 +575,12 @@ namespace Vocaluxe.Lib.Sound try { - _source = AL.GenSource(); - _buffers = new int[buffer_count]; - for (int i = 0; i < buffer_count; i++) - _buffers[i] = AL.GenBuffer(); + _Source = AL.GenSource(); + _Buffers = new int[_BufferCount]; + for (int i = 0; i < _BufferCount; i++) + _Buffers[i] = AL.GenBuffer(); - _state = 0; + _State = 0; //AL.SourceQueueBuffers(_source, _buffers.Length, _buffers); } catch (Exception) @@ -590,83 +590,83 @@ namespace Vocaluxe.Lib.Sound return -1; } - _FileName = FileName; - _Decoder.Open(FileName); + _FileName = fileName; + _Decoder.Open(fileName); _Duration = _Decoder.GetLength(); - _format = _Decoder.GetFormatInfo(); - _ByteCount = 2 * _format.ChannelCount; - _BytesPerSecond = _format.SamplesPerSecond * _ByteCount; + _Format = _Decoder.GetFormatInfo(); + _ByteCount = 2 * _Format.ChannelCount; + _BytesPerSecond = _Format.SamplesPerSecond * _ByteCount; _CurrentTime = 0f; _Timer.Reset(); - AudioStreams stream = new AudioStreams(0); + SAudioStreams stream = new SAudioStreams(0); - stream.handle = _buffers[0]; + stream.Handle = _Buffers[0]; - if (stream.handle != 0) + if (stream.Handle != 0) { _FileOpened = true; - _data = new RingBuffer(BUFSIZE); + _Data = new CRingBuffer(_Bufsize); _NoMoreData = false; _DecoderThread.Priority = ThreadPriority.Normal; - _DecoderThread.Name = Path.GetFileName(FileName); + _DecoderThread.Name = Path.GetFileName(fileName); _DecoderThread.Start(); - return stream.handle; + return stream.Handle; } return -1; } - public bool Skip(float Time) + public bool Skip(float time) { - lock (MutexSyncSignals) + lock (_MutexSyncSignals) { - _SetStart = Time; + _SetStart = time; _SetSkip = true; } - EventDecode.Set(); + _EventDecode.Set(); return true; } #region Threading - private void DoSkip() + private void _DoSkip() { _Decoder.SetPosition(_Start); _CurrentTime = _Start; _TimeCode = _Start; _Timer.Reset(); - _waiting = false; + _Waiting = false; - lock (MutexData) + lock (_MutexData) { - _data = new RingBuffer(BUFSIZE); + _Data = new CRingBuffer(_Bufsize); _NoMoreData = false; } } - private void Execute() + private void _Execute() { - while (!_terminated) + while (!_Terminated) { - _waiting = false; - if (EventDecode.WaitOne(1) || !_waiting) + _Waiting = false; + if (_EventDecode.WaitOne(1) || !_Waiting) { - if (_skip) + if (_Skip) { - DoSkip(); - _skip = false; + _DoSkip(); + _Skip = false; } - DoDecode(); + _DoDecode(); } - if (!_terminated) + if (!_Terminated) { - lock (MutexSyncSignals) + lock (_MutexSyncSignals) { if (_SetSkip) - _skip = true; + _Skip = true; _SetSkip = false; @@ -676,10 +676,10 @@ namespace Vocaluxe.Lib.Sound } } - DoFree(); + _DoFree(); } - private void DoDecode() + private void _DoDecode() { if (!_FileOpened) return; @@ -687,57 +687,57 @@ namespace Vocaluxe.Lib.Sound if (_Paused) return; - if (_terminated) + if (_Terminated) return; - float Timecode; - byte[] Buffer; + float timecode; + byte[] buffer; - bool DoIt = false; - lock (MutexData) + bool doIt = false; + lock (_MutexData) { - if (BUFSIZE - 10000L > _data.BytesNotRead) - DoIt = true; + if (_Bufsize - 10000L > _Data.BytesNotRead) + doIt = true; } - if (!DoIt) + if (!doIt) return; - _Decoder.Decode(out Buffer, out Timecode); + _Decoder.Decode(out buffer, out timecode); - if (Buffer == null) + if (buffer == null) { if (_Loop) { - lock (MutexSyncSignals) + lock (_MutexSyncSignals) { _CurrentTime = 0f; _Start = 0f; } - DoSkip(); + _DoSkip(); } else _NoMoreData = true; return; } - lock (MutexData) + lock (_MutexData) { - _data.Write(Buffer); - _TimeCode = Timecode; + _Data.Write(buffer); + _TimeCode = timecode; } } - private void DoFree() + private void _DoFree() { if (_Initialized) { - lock (CloseMutex) + lock (_CloseMutex) { Stop(); - AL.DeleteSource(_source); - AL.DeleteBuffers(_buffers); + AL.DeleteSource(_Source); + AL.DeleteBuffers(_Buffers); } } @@ -745,22 +745,22 @@ namespace Vocaluxe.Lib.Sound } #endregion Threading - private void Update() + private void _Update() { - if (_fading) + if (_Fading) { - if (_fadeTimer.ElapsedMilliseconds / 1000f < _fadeTime) - _Volume = _startVolume + (_targetVolume - _startVolume) * ((_fadeTimer.ElapsedMilliseconds / 1000f) / _fadeTime); + if (_FadeTimer.ElapsedMilliseconds / 1000f < _FadeTime) + _Volume = _StartVolume + (_TargetVolume - _StartVolume) * ((_FadeTimer.ElapsedMilliseconds / 1000f) / _FadeTime); else { - _Volume = _targetVolume; - _fadeTimer.Stop(); - _fading = false; + _Volume = _TargetVolume; + _FadeTimer.Stop(); + _Fading = false; - if (_closeStreamAfterFade) - _terminated = true; + if (_CloseStreamAfterFade) + _Terminated = true; - if (_pauseStreamAfterFade) + if (_PauseStreamAfterFade) Paused = true; } } @@ -768,34 +768,34 @@ namespace Vocaluxe.Lib.Sound public void UploadData() { - Update(); + _Update(); if (_Paused) return; - int queued_count = 0; + int queuedCount = 0; bool doit = true; - AL.GetSource(_source, ALGetSourcei.BuffersQueued, out queued_count); + AL.GetSource(_Source, ALGetSourcei.BuffersQueued, out queuedCount); - int processed_count = buffer_count; - if (queued_count > 0) + int processedCount = _BufferCount; + if (queuedCount > 0) { - AL.GetSource(_source, ALGetSourcei.BuffersProcessed, out processed_count); + AL.GetSource(_Source, ALGetSourcei.BuffersProcessed, out processedCount); doit = false; - Console.WriteLine("Buffers Processed on Stream " + _source.ToString() + " = " + processed_count.ToString()); - if (processed_count < 1) + Console.WriteLine("Buffers Processed on Stream " + _Source.ToString() + " = " + processedCount.ToString()); + if (processedCount < 1) return; } - byte[] buf = new byte[buffer_size]; + byte[] buf = new byte[_BufferSize]; - lock (MutexData) + lock (_MutexData) { - while (processed_count > 0) + while (processedCount > 0) { - if (_data.BytesNotRead >= buf.Length) + if (_Data.BytesNotRead >= buf.Length) { - _data.Read(ref buf); + _Data.Read(ref buf); byte[] b = new byte[2]; @@ -822,39 +822,39 @@ namespace Vocaluxe.Lib.Sound int buffer = 0; if (!doit) - buffer = AL.SourceUnqueueBuffer(_source); + buffer = AL.SourceUnqueueBuffer(_Source); else { - buffer = _buffers[queued_count]; - queued_count++; + buffer = _Buffers[queuedCount]; + queuedCount++; } if (buffer != 0) { - if (_format.ChannelCount == 2) - AL.BufferData(buffer, ALFormat.Stereo16, buf, buf.Length, _format.SamplesPerSecond); + if (_Format.ChannelCount == 2) + AL.BufferData(buffer, ALFormat.Stereo16, buf, buf.Length, _Format.SamplesPerSecond); else - AL.BufferData(buffer, ALFormat.Mono16, buf, buf.Length, _format.SamplesPerSecond); + AL.BufferData(buffer, ALFormat.Mono16, buf, buf.Length, _Format.SamplesPerSecond); Console.WriteLine("Write to Buffer: " + buffer.ToString()); - AL.SourceQueueBuffer(_source, buffer); + AL.SourceQueueBuffer(_Source, buffer); } } - processed_count--; + processedCount--; } - AL.GetSource(_source, ALGetSourcei.SourceState, out _state); - if ((ALSourceState)_state != ALSourceState.Playing) - AL.SourcePlay(_source); + AL.GetSource(_Source, ALGetSourcei.SourceState, out _State); + if ((ALSourceState)_State != ALSourceState.Playing) + AL.SourcePlay(_Source); } - _CurrentTime = _TimeCode - _data.BytesNotRead / _BytesPerSecond - 0.1f; + _CurrentTime = _TimeCode - _Data.BytesNotRead / _BytesPerSecond - 0.1f; _Timer.Reset(); _Timer.Start(); } public void Dispose() { - EventDecode.Close(); - EventDecode = null; + _EventDecode.Close(); + _EventDecode = null; } } } \ No newline at end of file diff --git a/Vocaluxe/Lib/Sound/CPortAudioPlay.cs b/Vocaluxe/Lib/Sound/CPortAudioPlay.cs index ebb587e7..1c498b0a 100644 --- a/Vocaluxe/Lib/Sound/CPortAudioPlay.cs +++ b/Vocaluxe/Lib/Sound/CPortAudioPlay.cs @@ -13,13 +13,13 @@ namespace Vocaluxe.Lib.Sound class CPortAudioPlay : IPlayback { private bool _Initialized; - private readonly List _Decoder = new List(); - private CLOSEPROC closeproc; + private readonly List _Decoder = new List(); + private Closeproc _Closeproc; private int _Count = 1; - private readonly Object MutexDecoder = new Object(); + private readonly Object _MutexDecoder = new Object(); - private List _Streams; + private List _Streams; public CPortAudioPlay() { @@ -31,23 +31,23 @@ namespace Vocaluxe.Lib.Sound if (_Initialized) CloseAll(); - closeproc = close_proc; + _Closeproc = _CloseProc; _Initialized = true; - _Streams = new List(); + _Streams = new List(); return true; } public void CloseAll() { - lock (MutexDecoder) + lock (_MutexDecoder) { for (int i = 0; i < _Decoder.Count; i++) - _Decoder[i].Free(closeproc, i + 1); + _Decoder[i].Free(_Closeproc, i + 1); } } - public void SetGlobalVolume(float Volume) + public void SetGlobalVolume(float volume) { if (_Initialized) { @@ -60,7 +60,7 @@ namespace Vocaluxe.Lib.Sound if (!_Initialized) return 0; - lock (MutexDecoder) + lock (_MutexDecoder) { return _Streams.Count; } @@ -69,160 +69,160 @@ namespace Vocaluxe.Lib.Sound public void Update() {} #region Stream Handling - public int Load(string Media) + public int Load(string media) { - return Load(Media, false); + return Load(media, false); } - public int Load(string Media, bool Prescan) + public int Load(string media, bool prescan) { - AudioStreams stream = new AudioStreams(0); - PortAudioStream decoder = new PortAudioStream(); + SAudioStreams stream = new SAudioStreams(0); + CPortAudioStream decoder = new CPortAudioStream(); - if (decoder.Open(Media) > -1) + if (decoder.Open(media) > -1) { - lock (MutexDecoder) + lock (_MutexDecoder) { _Decoder.Add(decoder); - stream.handle = _Count++; - stream.file = Media; + stream.Handle = _Count++; + stream.File = media; _Streams.Add(stream); - return stream.handle; + return stream.Handle; } } return 0; } - public void Close(int Stream) + public void Close(int stream) { if (_Initialized) { - lock (MutexDecoder) + lock (_MutexDecoder) { - if (AlreadyAdded(Stream)) - _Decoder[GetStreamIndex(Stream)].Free(closeproc, Stream); + if (_AlreadyAdded(stream)) + _Decoder[_GetStreamIndex(stream)].Free(_Closeproc, stream); } } } - public void Play(int Stream) + public void Play(int stream) { - Play(Stream, false); + Play(stream, false); } - public void Play(int Stream, bool Loop) + public void Play(int stream, bool loop) { if (_Initialized) { - lock (MutexDecoder) + lock (_MutexDecoder) { - if (AlreadyAdded(Stream)) + if (_AlreadyAdded(stream)) { - _Decoder[GetStreamIndex(Stream)].Loop = Loop; - _Decoder[GetStreamIndex(Stream)].Play(); + _Decoder[_GetStreamIndex(stream)].Loop = loop; + _Decoder[_GetStreamIndex(stream)].Play(); } } } } - public void Pause(int Stream) + public void Pause(int stream) { if (_Initialized) { - lock (MutexDecoder) + lock (_MutexDecoder) { - if (AlreadyAdded(Stream)) - _Decoder[GetStreamIndex(Stream)].Paused = true; + if (_AlreadyAdded(stream)) + _Decoder[_GetStreamIndex(stream)].Paused = true; } } } - public void Stop(int Stream) + public void Stop(int stream) { - Pause(Stream); + Pause(stream); } - public void Fade(int Stream, float TargetVolume, float Seconds) + public void Fade(int stream, float targetVolume, float seconds) { if (_Initialized) { - lock (MutexDecoder) + lock (_MutexDecoder) { - if (AlreadyAdded(Stream)) - _Decoder[GetStreamIndex(Stream)].Fade(TargetVolume, Seconds); + if (_AlreadyAdded(stream)) + _Decoder[_GetStreamIndex(stream)].Fade(targetVolume, seconds); } } } - public void FadeAndPause(int Stream, float TargetVolume, float Seconds) + public void FadeAndPause(int stream, float targetVolume, float seconds) { if (_Initialized) { - lock (MutexDecoder) + lock (_MutexDecoder) { - if (AlreadyAdded(Stream)) - _Decoder[GetStreamIndex(Stream)].FadeAndPause(TargetVolume, Seconds); + if (_AlreadyAdded(stream)) + _Decoder[_GetStreamIndex(stream)].FadeAndPause(targetVolume, seconds); } } } - public void FadeAndStop(int Stream, float TargetVolume, float Seconds) + public void FadeAndStop(int stream, float targetVolume, float seconds) { if (_Initialized) { - lock (MutexDecoder) + lock (_MutexDecoder) { - if (AlreadyAdded(Stream)) - _Decoder[GetStreamIndex(Stream)].FadeAndStop(TargetVolume, Seconds, closeproc, Stream); + if (_AlreadyAdded(stream)) + _Decoder[_GetStreamIndex(stream)].FadeAndStop(targetVolume, seconds, _Closeproc, stream); } } } - public void SetStreamVolume(int Stream, float Volume) + public void SetStreamVolume(int stream, float volume) { if (_Initialized) { - lock (MutexDecoder) + lock (_MutexDecoder) { - if (AlreadyAdded(Stream)) - _Decoder[GetStreamIndex(Stream)].Volume = Volume; + if (_AlreadyAdded(stream)) + _Decoder[_GetStreamIndex(stream)].Volume = volume; } } } - public void SetStreamVolumeMax(int Stream, float Volume) + public void SetStreamVolumeMax(int stream, float volume) { if (_Initialized) { - lock (MutexDecoder) + lock (_MutexDecoder) { - if (AlreadyAdded(Stream)) - _Decoder[GetStreamIndex(Stream)].VolumeMax = Volume; + if (_AlreadyAdded(stream)) + _Decoder[_GetStreamIndex(stream)].VolumeMax = volume; } } } - public float GetLength(int Stream) + public float GetLength(int stream) { if (_Initialized) { - lock (MutexDecoder) + lock (_MutexDecoder) { - if (AlreadyAdded(Stream)) - return _Decoder[GetStreamIndex(Stream)].Length; + if (_AlreadyAdded(stream)) + return _Decoder[_GetStreamIndex(stream)].Length; } } return 0f; } - public float GetPosition(int Stream) + public float GetPosition(int stream) { if (_Initialized) { - lock (MutexDecoder) + lock (_MutexDecoder) { - if (AlreadyAdded(Stream)) - return _Decoder[GetStreamIndex(Stream)].Position; + if (_AlreadyAdded(stream)) + return _Decoder[_GetStreamIndex(stream)].Position; } return 0f; @@ -230,108 +230,108 @@ namespace Vocaluxe.Lib.Sound return 0f; } - public bool IsPlaying(int Stream) + public bool IsPlaying(int stream) { if (_Initialized) { - lock (MutexDecoder) + lock (_MutexDecoder) { - if (AlreadyAdded(Stream)) - return !_Decoder[GetStreamIndex(Stream)].Paused && !_Decoder[GetStreamIndex(Stream)].Finished; + if (_AlreadyAdded(stream)) + return !_Decoder[_GetStreamIndex(stream)].Paused && !_Decoder[_GetStreamIndex(stream)].Finished; } } return false; } - public bool IsPaused(int Stream) + public bool IsPaused(int stream) { if (_Initialized) { - lock (MutexDecoder) + lock (_MutexDecoder) { - if (AlreadyAdded(Stream)) - return _Decoder[GetStreamIndex(Stream)].Paused; + if (_AlreadyAdded(stream)) + return _Decoder[_GetStreamIndex(stream)].Paused; } } return false; } - public bool IsFinished(int Stream) + public bool IsFinished(int stream) { if (_Initialized) { - lock (MutexDecoder) + lock (_MutexDecoder) { - if (AlreadyAdded(Stream)) - return _Decoder[GetStreamIndex(Stream)].Finished; + if (_AlreadyAdded(stream)) + return _Decoder[_GetStreamIndex(stream)].Finished; } } return true; } - public void SetPosition(int Stream, float Position) + public void SetPosition(int stream, float position) { if (_Initialized) { - lock (MutexDecoder) + lock (_MutexDecoder) { - if (AlreadyAdded(Stream)) - _Decoder[GetStreamIndex(Stream)].Skip(Position); + if (_AlreadyAdded(stream)) + _Decoder[_GetStreamIndex(stream)].Skip(position); } } } #endregion Stream Handling - private bool AlreadyAdded(int Stream) + private bool _AlreadyAdded(int stream) { - foreach (AudioStreams st in _Streams) + foreach (SAudioStreams st in _Streams) { - if (st.handle == Stream) + if (st.Handle == stream) return true; } return false; } - private int GetStreamIndex(int Stream) + private int _GetStreamIndex(int stream) { for (int i = 0; i < _Streams.Count; i++) { - if (_Streams[i].handle == Stream) + if (_Streams[i].Handle == stream) return i; } return -1; } - private void EndSync(int handle, int Stream, int data, IntPtr user) + private void _EndSync(int handle, int stream, int data, IntPtr user) { if (_Initialized) { - if (AlreadyAdded(Stream)) - Close(Stream); + if (_AlreadyAdded(stream)) + Close(stream); } } - private void close_proc(int StreamID) + private void _CloseProc(int streamID) { if (_Initialized) { - lock (MutexDecoder) + lock (_MutexDecoder) { - if (AlreadyAdded(StreamID)) + if (_AlreadyAdded(streamID)) { - int Index = GetStreamIndex(StreamID); - _Decoder.RemoveAt(Index); - _Streams.RemoveAt(Index); + int index = _GetStreamIndex(streamID); + _Decoder.RemoveAt(index); + _Streams.RemoveAt(index); } } } } } - class PortAudioStream : IDisposable + class CPortAudioStream : IDisposable { - private const long BUFSIZE = 1000000L; - private const long BEGINREFILL = 800000L; + private const long _Bufsize = 1000000L; + private const long _Beginrefill = 800000L; private readonly CSyncTimer _SyncTimer; private static bool _Initialized; @@ -341,22 +341,22 @@ namespace Vocaluxe.Lib.Sound private float _Volume = 1f; private float _VolumeMax = 1f; - private readonly Stopwatch _fadeTimer = new Stopwatch(); + private readonly Stopwatch _FadeTimer = new Stopwatch(); - private float _fadeTime; - private float _targetVolume = 1f; - private float _startVolume = 1f; - private bool _closeStreamAfterFade; - private bool _pauseStreamAfterFade; - private bool _fading; + private float _FadeTime; + private float _TargetVolume = 1f; + private float _StartVolume = 1f; + private bool _CloseStreamAfterFade; + private bool _PauseStreamAfterFade; + private bool _Fading; - private static PortAudio.PaHostApiInfo _apiInfo; - private static PortAudio.PaDeviceInfo _outputDeviceInfo; + private static CPortAudio.SPaHostApiInfo _ApiInfo; + private static CPortAudio.SPaDeviceInfo _OutputDeviceInfo; private IntPtr _Ptr = new IntPtr(0); - private CLOSEPROC _Closeproc; - private PortAudio.PaStreamCallbackDelegate _paStreamCallback; + private Closeproc _Closeproc; + private CPortAudio.PaStreamCallbackDelegate _PaStreamCallback; private int _StreamID; private string _FileName; private IAudioDecoder _Decoder; @@ -365,8 +365,8 @@ namespace Vocaluxe.Lib.Sound private bool _FileOpened; - private bool _waiting; - private bool _skip; + private bool _Waiting; + private bool _Skip; private bool _Loop; private float _Duration; @@ -375,36 +375,36 @@ namespace Vocaluxe.Lib.Sound private bool _Paused; - private RingBuffer _data; + private CRingBuffer _Data; private float _SetStart; private float _Start; private bool _SetLoop; private bool _SetSkip; - private bool _terminated; + private bool _Terminated; private readonly Thread _DecoderThread; - private AutoResetEvent EventDecode = new AutoResetEvent(false); + private AutoResetEvent _EventDecode = new AutoResetEvent(false); private readonly Object _LockData = new Object(); private readonly Object _LockSyncSignals = new Object(); - public PortAudioStream() + public CPortAudioStream() { _SyncTimer = new CSyncTimer(0f, 1f, 0.02f); - _DecoderThread = new Thread(Execute); + _DecoderThread = new Thread(_Execute); } - ~PortAudioStream() + ~CPortAudioStream() { Dispose(); } - public void Free(CLOSEPROC close_proc, int StreamID) + public void Free(Closeproc closeProc, int streamID) { - _Closeproc = close_proc; - _StreamID = StreamID; - _terminated = true; + _Closeproc = closeProc; + _StreamID = streamID; + _Terminated = true; } public float Length @@ -424,7 +424,7 @@ namespace Vocaluxe.Lib.Sound { lock (_LockData) { - return _NoMoreData && _data.BytesNotRead == 0L && _SyncTimer.Time >= _Duration; + return _NoMoreData && _Data.BytesNotRead == 0L && _SyncTimer.Time >= _Duration; } } } @@ -490,46 +490,46 @@ namespace Vocaluxe.Lib.Sound else { _SyncTimer.Resume(); - EventDecode.Set(); + _EventDecode.Set(); } } } } - public void Fade(float TargetVolume, float FadeTime) + public void Fade(float targetVolume, float fadeTime) { - _fading = true; - _fadeTimer.Stop(); - _fadeTimer.Reset(); - _startVolume = _Volume; - _targetVolume = TargetVolume / 100f; - _fadeTime = FadeTime; - _fadeTimer.Start(); + _Fading = true; + _FadeTimer.Stop(); + _FadeTimer.Reset(); + _StartVolume = _Volume; + _TargetVolume = targetVolume / 100f; + _FadeTime = fadeTime; + _FadeTimer.Start(); } - public void FadeAndPause(float TargetVolume, float FadeTime) + public void FadeAndPause(float targetVolume, float fadeTime) { - _pauseStreamAfterFade = true; + _PauseStreamAfterFade = true; - Fade(TargetVolume, FadeTime); + Fade(targetVolume, fadeTime); } - public void FadeAndStop(float TargetVolume, float FadeTime, CLOSEPROC close_proc, int StreamID) + public void FadeAndStop(float targetVolume, float fadeTime, Closeproc closeProc, int streamID) { - _Closeproc = close_proc; - _StreamID = StreamID; - _closeStreamAfterFade = true; + _Closeproc = closeProc; + _StreamID = streamID; + _CloseStreamAfterFade = true; - Fade(TargetVolume, FadeTime); + Fade(targetVolume, fadeTime); } public void Play() { Paused = false; - _pauseStreamAfterFade = false; + _PauseStreamAfterFade = false; lock (_Mutex) { - errorCheck("StartStream", PortAudio.Pa_StartStream(_Ptr)); + _ErrorCheck("StartStream", CPortAudio.Pa_StartStream(_Ptr)); } } @@ -537,7 +537,7 @@ namespace Vocaluxe.Lib.Sound { lock (_Mutex) { - errorCheck("StopStream (playback)", PortAudio.Pa_StopStream(_Ptr)); + _ErrorCheck("StopStream (playback)", CPortAudio.Pa_StopStream(_Ptr)); } Skip(0f); } @@ -548,12 +548,12 @@ namespace Vocaluxe.Lib.Sound set { _SetLoop = value; } } - public int Open(string FileName) + public int Open(string fileName) { if (_FileOpened) return -1; - if (!File.Exists(FileName)) + if (!File.Exists(fileName)) return -1; if (_FileOpened) @@ -568,19 +568,19 @@ namespace Vocaluxe.Lib.Sound { if (!_Initialized) { - if (errorCheck("Initialize", PortAudio.Pa_Initialize())) + if (_ErrorCheck("Initialize", CPortAudio.Pa_Initialize())) return -1; _Initialized = true; - int hostApi = apiSelect(); - _apiInfo = PortAudio.Pa_GetHostApiInfo(hostApi); - _outputDeviceInfo = PortAudio.Pa_GetDeviceInfo(_apiInfo.defaultOutputDevice); - if (_outputDeviceInfo.defaultLowOutputLatency < 0.1) - _outputDeviceInfo.defaultLowOutputLatency = 0.1; + int hostApi = _ApiSelect(); + _ApiInfo = CPortAudio.PaGetHostApiInfo(hostApi); + _OutputDeviceInfo = CPortAudio.PaGetDeviceInfo(_ApiInfo.DefaultOutputDevice); + if (_OutputDeviceInfo.DefaultLowOutputLatency < 0.1) + _OutputDeviceInfo.DefaultLowOutputLatency = 0.1; } } - _paStreamCallback = _ProcessNewData; + _PaStreamCallback = _ProcessNewData; } catch (Exception) { @@ -589,11 +589,11 @@ namespace Vocaluxe.Lib.Sound return -1; } - _FileName = FileName; - _Decoder.Open(FileName); + _FileName = fileName; + _Decoder.Open(fileName); _Duration = _Decoder.GetLength(); - FormatInfo format = _Decoder.GetFormatInfo(); + SFormatInfo format = _Decoder.GetFormatInfo(); if (format.SamplesPerSecond == 0) return -1; @@ -602,90 +602,90 @@ namespace Vocaluxe.Lib.Sound _CurrentTime = 0f; _SyncTimer.Time = _CurrentTime; - AudioStreams stream = new AudioStreams(0); + SAudioStreams stream = new SAudioStreams(0); IntPtr data = new IntPtr(0); - PortAudio.PaStreamParameters outputParams = new PortAudio.PaStreamParameters(); - outputParams.channelCount = format.ChannelCount; - outputParams.device = _apiInfo.defaultOutputDevice; - outputParams.sampleFormat = PortAudio.PaSampleFormat.paInt16; - outputParams.suggestedLatency = _outputDeviceInfo.defaultLowOutputLatency; + CPortAudio.SPaStreamParameters outputParams = new CPortAudio.SPaStreamParameters(); + outputParams.ChannelCount = format.ChannelCount; + outputParams.Device = _ApiInfo.DefaultOutputDevice; + outputParams.SampleFormat = CPortAudio.EPaSampleFormat.PaInt16; + outputParams.SuggestedLatency = _OutputDeviceInfo.DefaultLowOutputLatency; uint bufsize = (uint)CConfig.AudioBufferSize; lock (_Mutex) { - errorCheck("OpenDefaultStream (playback)", PortAudio.Pa_OpenStream( + _ErrorCheck("OpenDefaultStream (playback)", CPortAudio.Pa_OpenStream( out _Ptr, IntPtr.Zero, ref outputParams, format.SamplesPerSecond, bufsize, - PortAudio.PaStreamFlags.paNoFlag, - _paStreamCallback, + CPortAudio.EPaStreamFlags.PaNoFlag, + _PaStreamCallback, data)); } - stream.handle = _Ptr.ToInt32(); + stream.Handle = _Ptr.ToInt32(); - if (stream.handle != 0) + if (stream.Handle != 0) { _NumStreams++; _Paused = true; - _waiting = true; + _Waiting = true; _FileOpened = true; - _data = new RingBuffer(BUFSIZE); + _Data = new CRingBuffer(_Bufsize); _NoMoreData = false; _DecoderThread.Priority = ThreadPriority.Normal; - _DecoderThread.Name = Path.GetFileName(FileName); + _DecoderThread.Name = Path.GetFileName(fileName); _DecoderThread.Start(); - return stream.handle; + return stream.Handle; } return -1; } - public bool Skip(float Time) + public bool Skip(float time) { lock (_LockSyncSignals) { - _SetStart = Time; + _SetStart = time; _SetSkip = true; - _waiting = true; + _Waiting = true; } return true; } #region Threading - private void DoSkip() + private void _DoSkip() { lock (_LockData) { _Decoder.SetPosition(_Start); _CurrentTime = _Start; _TimeCode = _Start; - _data = new RingBuffer(BUFSIZE); + _Data = new CRingBuffer(_Bufsize); _NoMoreData = false; - EventDecode.Set(); - _waiting = false; + _EventDecode.Set(); + _Waiting = false; _SyncTimer.Time = _Start; } } - private void Execute() + private void _Execute() { - while (!_terminated) + while (!_Terminated) { - if (EventDecode.WaitOne(10)) + if (_EventDecode.WaitOne(10)) { lock (_LockSyncSignals) { if (_SetSkip) { - _skip = true; - EventDecode.Set(); - _waiting = true; + _Skip = true; + _EventDecode.Set(); + _Waiting = true; } _SetSkip = false; @@ -694,24 +694,24 @@ namespace Vocaluxe.Lib.Sound _Loop = _SetLoop; } - if (_skip) + if (_Skip) { - DoSkip(); - _skip = false; + _DoSkip(); + _Skip = false; } - if (!_waiting) + if (!_Waiting) { - DoDecode(); - Update(); + _DoDecode(); + _Update(); } } } - DoFree(); + _DoFree(); } - private void DoDecode() + private void _DoDecode() { if (!_FileOpened) return; @@ -719,25 +719,25 @@ namespace Vocaluxe.Lib.Sound if (_Paused) return; - if (_terminated) + if (_Terminated) return; - float Timecode; - byte[] Buffer; + float timecode; + byte[] buffer; - bool DoIt = false; + bool doIt = false; lock (_LockData) { - if (!_skip && BEGINREFILL > _data.BytesNotRead) - DoIt = true; + if (!_Skip && _Beginrefill > _Data.BytesNotRead) + doIt = true; } - if (!DoIt) + if (!doIt) return; - _Decoder.Decode(out Buffer, out Timecode); + _Decoder.Decode(out buffer, out timecode); - if (Buffer == null) + if (buffer == null) { if (_Loop) { @@ -747,7 +747,7 @@ namespace Vocaluxe.Lib.Sound _Start = 0f; } - DoSkip(); + _DoSkip(); } else _NoMoreData = true; @@ -756,19 +756,19 @@ namespace Vocaluxe.Lib.Sound lock (_LockData) { - _data.Write(Buffer); - _TimeCode = Timecode; - if (_data.BytesNotRead < BEGINREFILL) + _Data.Write(buffer); + _TimeCode = timecode; + if (_Data.BytesNotRead < _Beginrefill) { - _waiting = false; - EventDecode.Set(); + _Waiting = false; + _EventDecode.Set(); } else - _waiting = true; + _Waiting = true; } } - private void DoFree() + private void _DoFree() { if (_Initialized) { @@ -778,7 +778,7 @@ namespace Vocaluxe.Lib.Sound { lock (_Mutex) { - PortAudio.Pa_Terminate(); + CPortAudio.Pa_Terminate(); _Initialized = false; } } @@ -789,12 +789,12 @@ namespace Vocaluxe.Lib.Sound #endregion Threading #region Callbacks - private PortAudio.PaStreamCallbackResult _ProcessNewData( + private CPortAudio.EPaStreamCallbackResult _ProcessNewData( IntPtr input, IntPtr output, uint frameCount, - ref PortAudio.PaStreamCallbackTimeInfo timeInfo, - PortAudio.PaStreamCallbackFlags statusFlags, + ref CPortAudio.SPaStreamCallbackTimeInfo timeInfo, + CPortAudio.EPaStreamCallbackFlags statusFlags, IntPtr userData) { byte[] buf = new byte[frameCount * _ByteCount]; @@ -809,14 +809,14 @@ namespace Vocaluxe.Lib.Sound { Console.WriteLine(e.ToString()); } - return PortAudio.PaStreamCallbackResult.paContinue; + return CPortAudio.EPaStreamCallbackResult.PaContinue; } lock (_LockData) { - if (_NoMoreData || _data.BytesNotRead >= buf.Length) + if (_NoMoreData || _Data.BytesNotRead >= buf.Length) { - _data.Read(ref buf); + _Data.Read(ref buf); byte[] b = new byte[2]; for (int i = 0; i < buf.Length; i += _ByteCount) @@ -840,16 +840,16 @@ namespace Vocaluxe.Lib.Sound } } - if (_data.BytesNotRead < BEGINREFILL) + if (_Data.BytesNotRead < _Beginrefill) { - EventDecode.Set(); - _waiting = false; + _EventDecode.Set(); + _Waiting = false; } else - _waiting = true; + _Waiting = true; float latency = buf.Length / _BytesPerSecond + CConfig.AudioLatency / 1000f; - float time = _TimeCode - _data.BytesNotRead / _BytesPerSecond - latency; + float time = _TimeCode - _Data.BytesNotRead / _BytesPerSecond - latency; if (!_NoMoreData) _CurrentTime = _SyncTimer.Update(time); @@ -864,24 +864,24 @@ namespace Vocaluxe.Lib.Sound CLog.LogError("Error PortAudio.StreamCallback: " + e.Message); } - return PortAudio.PaStreamCallbackResult.paContinue; + return CPortAudio.EPaStreamCallbackResult.PaContinue; } #endregion Callbacks - private bool errorCheck(String action, PortAudio.PaError errorCode) + private bool _ErrorCheck(String action, CPortAudio.EPaError errorCode) { - if (errorCode != PortAudio.PaError.paNoError) + if (errorCode != CPortAudio.EPaError.PaNoError) { - if (errorCode == PortAudio.PaError.paStreamIsNotStopped) + if (errorCode == CPortAudio.EPaError.PaStreamIsNotStopped) return false; - CLog.LogError(action + " error (playback): " + PortAudio.Pa_GetErrorText(errorCode)); - if (errorCode == PortAudio.PaError.paUnanticipatedHostError) + CLog.LogError(action + " error (playback): " + CPortAudio.PaGetErrorText(errorCode)); + if (errorCode == CPortAudio.EPaError.PaUnanticipatedHostError) { - PortAudio.PaHostErrorInfo errorInfo = PortAudio.Pa_GetLastHostErrorInfo(); - CLog.LogError("- Host error API type: " + errorInfo.hostApiType); - CLog.LogError("- Host error code: " + errorInfo.errorCode); - CLog.LogError("- Host error text: " + errorInfo.errorText); + CPortAudio.SPaHostErrorInfo errorInfo = CPortAudio.PaGetLastHostErrorInfo(); + CLog.LogError("- Host error API type: " + errorInfo.HostApiType); + CLog.LogError("- Host error code: " + errorInfo.ErrorCode); + CLog.LogError("- Host error text: " + errorInfo.ErrorText); } return true; } @@ -889,39 +889,39 @@ namespace Vocaluxe.Lib.Sound return false; } - private int apiSelect() + private int _ApiSelect() { if (!_Initialized) return 0; - int selectedHostApi = PortAudio.Pa_GetDefaultHostApi(); - int apiCount = PortAudio.Pa_GetHostApiCount(); + int selectedHostApi = CPortAudio.Pa_GetDefaultHostApi(); + int apiCount = CPortAudio.Pa_GetHostApiCount(); for (int i = 0; i < apiCount; i++) { - PortAudio.PaHostApiInfo apiInfo = PortAudio.Pa_GetHostApiInfo(i); - if ((apiInfo.type == PortAudio.PaHostApiTypeId.paDirectSound) - || (apiInfo.type == PortAudio.PaHostApiTypeId.paALSA)) + CPortAudio.SPaHostApiInfo apiInfo = CPortAudio.PaGetHostApiInfo(i); + if ((apiInfo.Type == CPortAudio.EPaHostApiTypeId.PaDirectSound) + || (apiInfo.Type == CPortAudio.EPaHostApiTypeId.PaALSA)) selectedHostApi = i; } return selectedHostApi; } - private void Update() + private void _Update() { - if (_fading) + if (_Fading) { - if (_fadeTimer.ElapsedMilliseconds / 1000f < _fadeTime) - _Volume = _startVolume + (_targetVolume - _startVolume) * ((_fadeTimer.ElapsedMilliseconds / 1000f) / _fadeTime); + if (_FadeTimer.ElapsedMilliseconds / 1000f < _FadeTime) + _Volume = _StartVolume + (_TargetVolume - _StartVolume) * ((_FadeTimer.ElapsedMilliseconds / 1000f) / _FadeTime); else { - _Volume = _targetVolume; - _fadeTimer.Stop(); - _fading = false; + _Volume = _TargetVolume; + _FadeTimer.Stop(); + _Fading = false; - if (_closeStreamAfterFade) - _terminated = true; + if (_CloseStreamAfterFade) + _Terminated = true; - if (_pauseStreamAfterFade) + if (_PauseStreamAfterFade) Paused = true; } } @@ -929,10 +929,10 @@ namespace Vocaluxe.Lib.Sound public void Dispose() { - if (EventDecode != null) + if (_EventDecode != null) { - EventDecode.Close(); - EventDecode = null; + _EventDecode.Close(); + _EventDecode = null; GC.SuppressFinalize(this); } } diff --git a/Vocaluxe/Lib/Sound/CPortAudioRecord.cs b/Vocaluxe/Lib/Sound/CPortAudioRecord.cs index 0825ad79..03a1063f 100644 --- a/Vocaluxe/Lib/Sound/CPortAudioRecord.cs +++ b/Vocaluxe/Lib/Sound/CPortAudioRecord.cs @@ -9,12 +9,12 @@ namespace Vocaluxe.Lib.Sound { class CPortAudioRecord : IRecord { - private bool _initialized; + private bool _Initialized; private List _Devices; private SRecordDevice[] _DeviceConfig; - private PortAudio.PaStreamCallbackDelegate _myRecProc; - private IntPtr[] _recHandle; + private CPortAudio.PaStreamCallbackDelegate _MyRecProc; + private IntPtr[] _RecHandle; private readonly CBuffer[] _Buffer; @@ -39,32 +39,32 @@ namespace Vocaluxe.Lib.Sound try { - if (_initialized) + if (_Initialized) CloseAll(); - if (errorCheck("Initialize", PortAudio.Pa_Initialize())) + if (_ErrorCheck("Initialize", CPortAudio.Pa_Initialize())) return false; - _initialized = true; - int hostAPI = apiSelect(); + _Initialized = true; + int hostAPI = _ApiSelect(); - int numDevices = PortAudio.Pa_GetDeviceCount(); + int numDevices = CPortAudio.Pa_GetDeviceCount(); for (int i = 0; i < numDevices; i++) { - PortAudio.PaDeviceInfo info = PortAudio.Pa_GetDeviceInfo(i); - if (info.hostApi == hostAPI && info.maxInputChannels > 0) + CPortAudio.SPaDeviceInfo info = CPortAudio.PaGetDeviceInfo(i); + if (info.HostApi == hostAPI && info.MaxInputChannels > 0) { SRecordDevice dev = new SRecordDevice(); dev.ID = i; - dev.Name = info.name; - dev.Driver = info.name + i.ToString(); + dev.Name = info.Name; + dev.Driver = info.Name + i.ToString(); dev.Inputs = new List(); SInput inp = new SInput(); inp.Name = "Default"; - inp.Channels = info.maxInputChannels; + inp.Channels = info.MaxInputChannels; if (inp.Channels > 2) inp.Channels = 2; //more are not supported in vocaluxe @@ -73,14 +73,14 @@ namespace Vocaluxe.Lib.Sound } } - _recHandle = new IntPtr[_Devices.Count]; - _myRecProc = myPaStreamCallback; + _RecHandle = new IntPtr[_Devices.Count]; + _MyRecProc = MyPaStreamCallback; _DeviceConfig = _Devices.ToArray(); } catch (Exception e) { - _initialized = false; + _Initialized = false; CLog.LogError("Error initializing PortAudio: " + e.Message); return false; } @@ -91,74 +91,74 @@ namespace Vocaluxe.Lib.Sound /// /// Start Voice Capturing /// - /// + /// /// - public bool Start(SRecordDevice[] DeviceConfig) + public bool Start(SRecordDevice[] deviceConfig) { - if (!_initialized) + if (!_Initialized) return false; - if (DeviceConfig == null) + if (deviceConfig == null) return false; - if (_recHandle == null) + if (_RecHandle == null) return false; - if (_recHandle.Length == 0) + if (_RecHandle.Length == 0) return false; for (int i = 0; i < _Buffer.Length; i++) _Buffer[i].Reset(); - for (int i = 0; i < _recHandle.Length; i++) + for (int i = 0; i < _RecHandle.Length; i++) { int waitcount = 0; - while (waitcount < 5 && PortAudio.Pa_IsStreamStopped(_recHandle[i]) == PortAudio.PaError.paStreamIsNotStopped) + while (waitcount < 5 && CPortAudio.Pa_IsStreamStopped(_RecHandle[i]) == CPortAudio.EPaError.PaStreamIsNotStopped) { Thread.Sleep(1); waitcount++; } } - for (int i = 0; i < _recHandle.Length; i++) - _recHandle[i] = IntPtr.Zero; + for (int i = 0; i < _RecHandle.Length; i++) + _RecHandle[i] = IntPtr.Zero; - _DeviceConfig = DeviceConfig; - bool[] active = new bool[DeviceConfig.Length]; - for (int dev = 0; dev < DeviceConfig.Length; dev++) + _DeviceConfig = deviceConfig; + bool[] active = new bool[deviceConfig.Length]; + for (int dev = 0; dev < deviceConfig.Length; dev++) { active[dev] = false; - for (int inp = 0; inp < DeviceConfig[dev].Inputs.Count; inp++) + for (int inp = 0; inp < deviceConfig[dev].Inputs.Count; inp++) { - if (DeviceConfig[dev].Inputs[inp].PlayerChannel1 > 0 || - DeviceConfig[dev].Inputs[inp].PlayerChannel2 > 0) + if (deviceConfig[dev].Inputs[inp].PlayerChannel1 > 0 || + deviceConfig[dev].Inputs[inp].PlayerChannel2 > 0) active[dev] = true; } } bool result = true; - for (int i = 0; i < _recHandle.Length; i++) + for (int i = 0; i < _RecHandle.Length; i++) { if (active[i]) { - PortAudio.PaStreamParameters inputParams = new PortAudio.PaStreamParameters(); - inputParams.channelCount = _DeviceConfig[i].Inputs[0].Channels; - inputParams.device = _DeviceConfig[i].ID; - inputParams.sampleFormat = PortAudio.PaSampleFormat.paInt16; - inputParams.suggestedLatency = PortAudio.Pa_GetDeviceInfo(_DeviceConfig[i].ID).defaultLowInputLatency; + CPortAudio.SPaStreamParameters inputParams = new CPortAudio.SPaStreamParameters(); + inputParams.ChannelCount = _DeviceConfig[i].Inputs[0].Channels; + inputParams.Device = _DeviceConfig[i].ID; + inputParams.SampleFormat = CPortAudio.EPaSampleFormat.PaInt16; + inputParams.SuggestedLatency = CPortAudio.PaGetDeviceInfo(_DeviceConfig[i].ID).DefaultLowInputLatency; - if (errorCheck("OpenStream (rec)", PortAudio.Pa_OpenStream( - out _recHandle[i], + if (_ErrorCheck("OpenStream (rec)", CPortAudio.Pa_OpenStream( + out _RecHandle[i], ref inputParams, IntPtr.Zero, 44100, 882, - PortAudio.PaStreamFlags.paNoFlag, - _myRecProc, + CPortAudio.EPaStreamFlags.PaNoFlag, + _MyRecProc, new IntPtr(i)))) return false; - if (errorCheck("Start Stream (rec)", PortAudio.Pa_StartStream(_recHandle[i]))) + if (_ErrorCheck("Start Stream (rec)", CPortAudio.Pa_StartStream(_RecHandle[i]))) return false; } } @@ -171,11 +171,11 @@ namespace Vocaluxe.Lib.Sound /// public bool Stop() { - if (!_initialized) + if (!_Initialized) return false; - for (int i = 0; i < _recHandle.Length; i++) - PortAudio.Pa_StopStream(_recHandle[i]); + for (int i = 0; i < _RecHandle.Length; i++) + CPortAudio.Pa_StopStream(_RecHandle[i]); return true; } @@ -186,10 +186,10 @@ namespace Vocaluxe.Lib.Sound { Stop(); - if (_initialized) + if (_Initialized) { - PortAudio.Pa_Terminate(); - _initialized = false; + CPortAudio.Pa_Terminate(); + _Initialized = false; } //System.IO.File.WriteAllBytes("test0.raw", _Buffer[0].Buffer); @@ -198,74 +198,74 @@ namespace Vocaluxe.Lib.Sound /// /// Detect Pitch and Volume of the newest voice buffer /// - /// - public void AnalyzeBuffer(int Player) + /// + public void AnalyzeBuffer(int player) { - if (!_initialized) + if (!_Initialized) return; - _Buffer[Player].AnalyzeBuffer(); + _Buffer[player].AnalyzeBuffer(); } - public int GetToneAbs(int Player) + public int GetToneAbs(int player) { - if (!_initialized) + if (!_Initialized) return 0; - return _Buffer[Player].ToneAbs; + return _Buffer[player].ToneAbs; } - public int GetTone(int Player) + public int GetTone(int player) { - if (!_initialized) + if (!_Initialized) return 0; - return _Buffer[Player].Tone; + return _Buffer[player].Tone; } - public void SetTone(int Player, int Tone) + public void SetTone(int player, int tone) { - if (!_initialized) + if (!_Initialized) return; - _Buffer[Player].Tone = Tone; + _Buffer[player].Tone = tone; } - public float GetMaxVolume(int Player) + public float GetMaxVolume(int player) { - if (!_initialized) + if (!_Initialized) return 0f; - return _Buffer[Player].MaxVolume; + return _Buffer[player].MaxVolume; } - public bool ToneValid(int Player) + public bool ToneValid(int player) { - if (!_initialized) + if (!_Initialized) return false; - return _Buffer[Player].ToneValid; + return _Buffer[player].ToneValid; } - public int NumHalfTones(int Player) + public int NumHalfTones(int player) { - if (!_initialized) + if (!_Initialized) return 0; - return _Buffer[Player].NumHalfTones; + return _Buffer[player].NumHalfTones; } - public float[] ToneWeigth(int Player) + public float[] ToneWeigth(int player) { - if (!_initialized) + if (!_Initialized) return null; - return _Buffer[Player].ToneWeigth; + return _Buffer[player].ToneWeigth; } public SRecordDevice[] RecordDevices() { - if (!_initialized) + if (!_Initialized) return null; if (_Devices.Count == 0) @@ -274,12 +274,12 @@ namespace Vocaluxe.Lib.Sound return _Devices.ToArray(); } - public PortAudio.PaStreamCallbackResult myPaStreamCallback( + public CPortAudio.EPaStreamCallbackResult MyPaStreamCallback( IntPtr input, IntPtr output, uint frameCount, - ref PortAudio.PaStreamCallbackTimeInfo timeInfo, - PortAudio.PaStreamCallbackFlags statusFlags, + ref CPortAudio.SPaStreamCallbackTimeInfo timeInfo, + CPortAudio.EPaStreamCallbackFlags statusFlags, IntPtr userData) { try @@ -287,29 +287,29 @@ namespace Vocaluxe.Lib.Sound frameCount *= 4; if (frameCount > 0 && input != IntPtr.Zero) { - byte[] _recbuffer = new byte[frameCount]; - byte[] _leftBuffer = new byte[frameCount / 2]; - byte[] _rightBuffer = new byte[frameCount / 2]; + byte[] recbuffer = new byte[frameCount]; + byte[] leftBuffer = new byte[frameCount / 2]; + byte[] rightBuffer = new byte[frameCount / 2]; // copy from managed to unmanaged memory - Marshal.Copy(input, _recbuffer, 0, (int)frameCount); + Marshal.Copy(input, recbuffer, 0, (int)frameCount); // copy into left/right Buffer for (int i = 0; i < frameCount / 2; i++) { - _leftBuffer[i] = _recbuffer[i * 2 - (i % 2)]; - _rightBuffer[i] = _recbuffer[i * 2 - (i % 2) + 2]; + leftBuffer[i] = recbuffer[i * 2 - (i % 2)]; + rightBuffer[i] = recbuffer[i * 2 - (i % 2) + 2]; } - for (int i = 0; i < _recHandle.Length; i++) + for (int i = 0; i < _RecHandle.Length; i++) { if (new IntPtr(i) == userData) { if (_DeviceConfig[i].Inputs[0].PlayerChannel1 > 0) - _Buffer[_DeviceConfig[i].Inputs[0].PlayerChannel1 - 1].ProcessNewBuffer(_leftBuffer); + _Buffer[_DeviceConfig[i].Inputs[0].PlayerChannel1 - 1].ProcessNewBuffer(leftBuffer); if (_DeviceConfig[i].Inputs[0].PlayerChannel2 > 0) - _Buffer[_DeviceConfig[i].Inputs[0].PlayerChannel2 - 1].ProcessNewBuffer(_rightBuffer); + _Buffer[_DeviceConfig[i].Inputs[0].PlayerChannel2 - 1].ProcessNewBuffer(rightBuffer); break; } @@ -321,20 +321,20 @@ namespace Vocaluxe.Lib.Sound CLog.LogError("Error on Stream Callback (rec): " + e); } - return PortAudio.PaStreamCallbackResult.paContinue; + return CPortAudio.EPaStreamCallbackResult.PaContinue; } - private bool errorCheck(String action, PortAudio.PaError errorCode) + private bool _ErrorCheck(String action, CPortAudio.EPaError errorCode) { - if (errorCode != PortAudio.PaError.paNoError) + if (errorCode != CPortAudio.EPaError.PaNoError) { - CLog.LogError(action + " error (rec): " + PortAudio.Pa_GetErrorText(errorCode)); - if (errorCode == PortAudio.PaError.paUnanticipatedHostError) + CLog.LogError(action + " error (rec): " + CPortAudio.PaGetErrorText(errorCode)); + if (errorCode == CPortAudio.EPaError.PaUnanticipatedHostError) { - PortAudio.PaHostErrorInfo errorInfo = PortAudio.Pa_GetLastHostErrorInfo(); - CLog.LogError("- Host error API type: " + errorInfo.hostApiType); - CLog.LogError("- Host error code: " + errorInfo.errorCode); - CLog.LogError("- Host error text: " + errorInfo.errorText); + CPortAudio.SPaHostErrorInfo errorInfo = CPortAudio.PaGetLastHostErrorInfo(); + CLog.LogError("- Host error API type: " + errorInfo.HostApiType); + CLog.LogError("- Host error code: " + errorInfo.ErrorCode); + CLog.LogError("- Host error text: " + errorInfo.ErrorText); } return true; } @@ -342,18 +342,18 @@ namespace Vocaluxe.Lib.Sound return false; } - private int apiSelect() + private int _ApiSelect() { - if (!_initialized) + if (!_Initialized) return 0; - int selectedHostApi = PortAudio.Pa_GetDefaultHostApi(); - int apiCount = PortAudio.Pa_GetHostApiCount(); + int selectedHostApi = CPortAudio.Pa_GetDefaultHostApi(); + int apiCount = CPortAudio.Pa_GetHostApiCount(); for (int i = 0; i < apiCount; i++) { - PortAudio.PaHostApiInfo apiInfo = PortAudio.Pa_GetHostApiInfo(i); - if ((apiInfo.type == PortAudio.PaHostApiTypeId.paDirectSound) - || (apiInfo.type == PortAudio.PaHostApiTypeId.paALSA)) + CPortAudio.SPaHostApiInfo apiInfo = CPortAudio.PaGetHostApiInfo(i); + if ((apiInfo.Type == CPortAudio.EPaHostApiTypeId.PaDirectSound) + || (apiInfo.Type == CPortAudio.EPaHostApiTypeId.PaALSA)) selectedHostApi = i; } return selectedHostApi; diff --git a/Vocaluxe/Lib/Sound/Decoder/CAudioDecoder.cs b/Vocaluxe/Lib/Sound/Decoder/CAudioDecoder.cs index 7ce3f152..695337cd 100644 --- a/Vocaluxe/Lib/Sound/Decoder/CAudioDecoder.cs +++ b/Vocaluxe/Lib/Sound/Decoder/CAudioDecoder.cs @@ -8,16 +8,16 @@ public virtual void Close() {} - public void Open(string FileName) + public void Open(string fileName) { - Open(FileName, false); + Open(fileName, false); } - public virtual void Open(string FileName, bool Loop) {} + public virtual void Open(string fileName, bool loop) {} - public virtual FormatInfo GetFormatInfo() + public virtual SFormatInfo GetFormatInfo() { - return new FormatInfo(); + return new SFormatInfo(); } public virtual float GetLength() @@ -25,17 +25,17 @@ return 0f; } - public virtual void SetPosition(float Time) {} + public virtual void SetPosition(float time) {} public virtual float GetPosition() { return 0f; } - public virtual void Decode(out byte[] Buffer, out float TimeStamp) + public virtual void Decode(out byte[] buffer, out float timeStamp) { - Buffer = null; - TimeStamp = 0f; + buffer = null; + timeStamp = 0f; } } } \ No newline at end of file diff --git a/Vocaluxe/Lib/Sound/Decoder/CAudioDecoderFFmpeg.cs b/Vocaluxe/Lib/Sound/Decoder/CAudioDecoderFFmpeg.cs index 6c3bc15b..7a77af27 100644 --- a/Vocaluxe/Lib/Sound/Decoder/CAudioDecoderFFmpeg.cs +++ b/Vocaluxe/Lib/Sound/Decoder/CAudioDecoderFFmpeg.cs @@ -9,10 +9,10 @@ namespace Vocaluxe.Lib.Sound.Decoder class CAudioDecoderFFmpeg : CAudioDecoder, IDisposable { private IntPtr _InstancePtr = IntPtr.Zero; - private IntPtr _audiodecoder = IntPtr.Zero; + private IntPtr _Audiodecoder = IntPtr.Zero; - private AC_instance _Instance; - private FormatInfo _FormatInfo; + private SACInstance _Instance; + private SFormatInfo _FormatInfo; private float _CurrentTime; private string _FileName; @@ -24,18 +24,18 @@ namespace Vocaluxe.Lib.Sound.Decoder _Initialized = true; } - public override void Open(string FileName, bool Loop) + public override void Open(string fileName, bool loop) { if (!_Initialized) return; - _FileName = FileName; + _FileName = fileName; try { - _InstancePtr = CAcinerella.ac_init(); - CAcinerella.ac_open2(_InstancePtr, _FileName); - _Instance = (AC_instance)Marshal.PtrToStructure(_InstancePtr, typeof(AC_instance)); + _InstancePtr = CAcinerella.AcInit(); + CAcinerella.AcOpen2(_InstancePtr, _FileName); + _Instance = (SACInstance)Marshal.PtrToStructure(_InstancePtr, typeof(SACInstance)); } catch (Exception) { @@ -44,19 +44,19 @@ namespace Vocaluxe.Lib.Sound.Decoder } - if (!_Instance.opened) + if (!_Instance.Opened) { //Free(); return; } - int AudioStreamIndex = -1; - AC_decoder Audiodecoder; + int audioStreamIndex = -1; + SACDecoder audiodecoder; try { - _audiodecoder = CAcinerella.ac_create_audio_decoder(_InstancePtr); - Audiodecoder = (AC_decoder)Marshal.PtrToStructure(_audiodecoder, typeof(AC_decoder)); - AudioStreamIndex = Audiodecoder.stream_index; + _Audiodecoder = CAcinerella.AcCreateAudioDecoder(_InstancePtr); + audiodecoder = (SACDecoder)Marshal.PtrToStructure(_Audiodecoder, typeof(SACDecoder)); + audioStreamIndex = audiodecoder.StreamIndex; } catch (Exception) { @@ -64,23 +64,23 @@ namespace Vocaluxe.Lib.Sound.Decoder return; } - if (AudioStreamIndex < 0) + if (audioStreamIndex < 0) { //Free(); return; } - _FormatInfo = new FormatInfo(); + _FormatInfo = new SFormatInfo(); - _FormatInfo.SamplesPerSecond = Audiodecoder.stream_info.audio_info.samples_per_second; - _FormatInfo.BitDepth = Audiodecoder.stream_info.audio_info.bit_depth; - _FormatInfo.ChannelCount = Audiodecoder.stream_info.audio_info.channel_count; + _FormatInfo.SamplesPerSecond = audiodecoder.StreamInfo.AudioInfo.SamplesPerSecond; + _FormatInfo.BitDepth = audiodecoder.StreamInfo.AudioInfo.BitDepth; + _FormatInfo.ChannelCount = audiodecoder.StreamInfo.AudioInfo.ChannelCount; _CurrentTime = 0f; if (_FormatInfo.BitDepth != 16) { - CLog.LogError("Unsupported BitDepth in file " + FileName); + CLog.LogError("Unsupported BitDepth in file " + fileName); return; } _FileOpened = true; @@ -96,22 +96,22 @@ namespace Vocaluxe.Lib.Sound.Decoder if (!_FileOpened) return; - if (_audiodecoder != IntPtr.Zero) - CAcinerella.ac_free_decoder(_audiodecoder); + if (_Audiodecoder != IntPtr.Zero) + CAcinerella.AcFreeDecoder(_Audiodecoder); if (_InstancePtr != IntPtr.Zero) - CAcinerella.ac_close(_InstancePtr); + CAcinerella.AcClose(_InstancePtr); if (_InstancePtr != IntPtr.Zero) - CAcinerella.ac_free(_InstancePtr); + CAcinerella.AcFree(_InstancePtr); _FileOpened = false; } - public override FormatInfo GetFormatInfo() + public override SFormatInfo GetFormatInfo() { if (!_Initialized && !_FileOpened) - return new FormatInfo(); + return new SFormatInfo(); return _FormatInfo; } @@ -121,17 +121,17 @@ namespace Vocaluxe.Lib.Sound.Decoder if (!_Initialized && !_FileOpened) return 0f; - return _Instance.info.duration / 1000f; + return _Instance.Info.Duration / 1000f; } - public override void SetPosition(float Time) + public override void SetPosition(float time) { if (!_Initialized && !_FileOpened) return; try { - CAcinerella.ac_seek(_audiodecoder, 0, (Int64)(Time * 1000f)); + CAcinerella.AcSeek(_Audiodecoder, 0, (Int64)(time * 1000f)); } catch (Exception) { @@ -148,42 +148,42 @@ namespace Vocaluxe.Lib.Sound.Decoder return _CurrentTime; } - public override void Decode(out byte[] Buffer, out float TimeStamp) + public override void Decode(out byte[] buffer, out float timeStamp) { if (!_Initialized && !_FileOpened) { - Buffer = null; - TimeStamp = 0f; + buffer = null; + timeStamp = 0f; return; } - int FrameFinished = 0; + int frameFinished = 0; try { - FrameFinished = CAcinerella.ac_get_audio_frame(_InstancePtr, _audiodecoder); + frameFinished = CAcinerella.AcGetAudioFrame(_InstancePtr, _Audiodecoder); } catch (Exception) { - FrameFinished = 0; + frameFinished = 0; } - if (FrameFinished == 1) + if (frameFinished == 1) { - AC_decoder Decoder = (AC_decoder)Marshal.PtrToStructure(_audiodecoder, typeof(AC_decoder)); + SACDecoder decoder = (SACDecoder)Marshal.PtrToStructure(_Audiodecoder, typeof(SACDecoder)); - TimeStamp = (float)Decoder.timecode; - _CurrentTime = TimeStamp; - //Console.WriteLine(_CurrentTime.ToString("#0.000") + " Buffer size: " + Decoder.buffer_size.ToString()); - Buffer = new byte[Decoder.buffer_size]; + timeStamp = (float)decoder.Timecode; + _CurrentTime = timeStamp; + //Console.WriteLine(_CurrentTime.ToString("ReplacedStr:::0:::") + "ReplacedStr:::1:::" + Decoder.buffer_size.ToString()); + buffer = new byte[decoder.BufferSize]; - if (Decoder.buffer_size > 0) - Marshal.Copy(Decoder.buffer, Buffer, 0, Buffer.Length); + if (decoder.BufferSize > 0) + Marshal.Copy(decoder.Buffer, buffer, 0, buffer.Length); return; } - Buffer = null; - TimeStamp = 0f; + buffer = null; + timeStamp = 0f; } public void Dispose() diff --git a/Vocaluxe/Lib/Sound/Decoder/IAudioDecoder.cs b/Vocaluxe/Lib/Sound/Decoder/IAudioDecoder.cs index 36ec5152..b2db7363 100644 --- a/Vocaluxe/Lib/Sound/Decoder/IAudioDecoder.cs +++ b/Vocaluxe/Lib/Sound/Decoder/IAudioDecoder.cs @@ -1,6 +1,6 @@ namespace Vocaluxe.Lib.Sound.Decoder { - struct FormatInfo + struct SFormatInfo { public int ChannelCount; public int SamplesPerSecond; @@ -12,15 +12,15 @@ void Init(); void Close(); - void Open(string FileName); - void Open(string FileName, bool Loop); - FormatInfo GetFormatInfo(); + void Open(string fileName); + void Open(string fileName, bool loop); + SFormatInfo GetFormatInfo(); float GetLength(); - void SetPosition(float Time); + void SetPosition(float time); float GetPosition(); - void Decode(out byte[] Buffer, out float TimeStamp); + void Decode(out byte[] buffer, out float timeStamp); } } \ No newline at end of file diff --git a/Vocaluxe/Lib/Sound/Gstreamer/CGstreamerAudioWrapper.cs b/Vocaluxe/Lib/Sound/Gstreamer/CGstreamerAudioWrapper.cs index 930a494c..d8e77638 100644 --- a/Vocaluxe/Lib/Sound/Gstreamer/CGstreamerAudioWrapper.cs +++ b/Vocaluxe/Lib/Sound/Gstreamer/CGstreamerAudioWrapper.cs @@ -13,7 +13,7 @@ namespace Vocaluxe.Lib.Sound.Gstreamer #if ARCH_X64 #if WIN - private const string Dll = "x64\\gstreamer\\gstreamerhelper.dll"; + private const string _Dll = "x64\\gstreamer\\gstreamerhelper.dll"; #endif #endif #endregion arch @@ -21,82 +21,82 @@ namespace Vocaluxe.Lib.Sound.Gstreamer [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void LogCallback(string message); - [DllImport(Dll, CallingConvention=CallingConvention.Cdecl)] + [DllImport(_Dll, CallingConvention=CallingConvention.Cdecl)] public static extern void SetLogCallback(LogCallback c); - [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)] + [DllImport(_Dll, CallingConvention = CallingConvention.Cdecl)] [return: MarshalAs(UnmanagedType.U1)] public static extern bool Init(); - [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)] - public static extern void SetGlobalVolume(float Volume); + [DllImport(_Dll, CallingConvention = CallingConvention.Cdecl)] + public static extern void SetGlobalVolume(float volume); - [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)] + [DllImport(_Dll, CallingConvention = CallingConvention.Cdecl)] public static extern int GetStreamCount(); - [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)] + [DllImport(_Dll, CallingConvention = CallingConvention.Cdecl)] public static extern void CloseAll(); - [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)] - public static extern int Load(string Media); + [DllImport(_Dll, CallingConvention = CallingConvention.Cdecl)] + public static extern int Load(string media); - [DllImport(Dll, EntryPoint = "LoadPrescan", CallingConvention = CallingConvention.Cdecl)] - public static extern int Load(string Media, - [MarshalAs(UnmanagedType.U1)] bool Prescan); + [DllImport(_Dll, EntryPoint = "LoadPrescan", CallingConvention = CallingConvention.Cdecl)] + public static extern int Load(string media, + [MarshalAs(UnmanagedType.U1)] bool prescan); - [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)] - public static extern void Close(int Stream); + [DllImport(_Dll, CallingConvention = CallingConvention.Cdecl)] + public static extern void Close(int stream); - [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)] - public static extern void Play(int Stream); + [DllImport(_Dll, CallingConvention = CallingConvention.Cdecl)] + public static extern void Play(int stream); - [DllImport(Dll, EntryPoint = "PlayLoop")] - public static extern void Play(int Stream, - [MarshalAs(UnmanagedType.U1)] bool Loop); + [DllImport(_Dll, EntryPoint = "PlayLoop")] + public static extern void Play(int stream, + [MarshalAs(UnmanagedType.U1)] bool loop); - [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)] - public static extern void Pause(int Stream); + [DllImport(_Dll, CallingConvention = CallingConvention.Cdecl)] + public static extern void Pause(int stream); - [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)] - public static extern void Stop(int Stream); + [DllImport(_Dll, CallingConvention = CallingConvention.Cdecl)] + public static extern void Stop(int stream); - [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)] - public static extern void Fade(int Stream, float TargetVolume, float Seconds); + [DllImport(_Dll, CallingConvention = CallingConvention.Cdecl)] + public static extern void Fade(int stream, float targetVolume, float seconds); - [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)] - public static extern void FadeAndPause(int Stream, float TargetVolume, float Seconds); + [DllImport(_Dll, CallingConvention = CallingConvention.Cdecl)] + public static extern void FadeAndPause(int stream, float targetVolume, float seconds); - [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)] - public static extern void FadeAndStop(int Stream, float TargetVolume, float Seconds); + [DllImport(_Dll, CallingConvention = CallingConvention.Cdecl)] + public static extern void FadeAndStop(int stream, float targetVolume, float seconds); - [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)] - public static extern void SetStreamVolume(int Stream, float Volume); + [DllImport(_Dll, CallingConvention = CallingConvention.Cdecl)] + public static extern void SetStreamVolume(int stream, float volume); - [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)] - public static extern void SetStreamVolumeMax(int Stream, float Volume); + [DllImport(_Dll, CallingConvention = CallingConvention.Cdecl)] + public static extern void SetStreamVolumeMax(int stream, float volume); - [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)] - public static extern float GetLength(int Stream); + [DllImport(_Dll, CallingConvention = CallingConvention.Cdecl)] + public static extern float GetLength(int stream); - [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)] - public static extern float GetPosition(int Stream); + [DllImport(_Dll, CallingConvention = CallingConvention.Cdecl)] + public static extern float GetPosition(int stream); - [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)] + [DllImport(_Dll, CallingConvention = CallingConvention.Cdecl)] [return: MarshalAs(UnmanagedType.U1)] - public static extern bool IsPlaying(int Stream); + public static extern bool IsPlaying(int stream); - [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)] + [DllImport(_Dll, CallingConvention = CallingConvention.Cdecl)] [return: MarshalAs(UnmanagedType.U1)] - public static extern bool IsPaused(int Stream); + public static extern bool IsPaused(int stream); - [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)] + [DllImport(_Dll, CallingConvention = CallingConvention.Cdecl)] [return: MarshalAs(UnmanagedType.U1)] - public static extern bool IsFinished(int Stream); + public static extern bool IsFinished(int stream); - [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)] - public static extern void SetPosition(int Stream, float Position); + [DllImport(_Dll, CallingConvention = CallingConvention.Cdecl)] + public static extern void SetPosition(int stream, float position); - [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)] + [DllImport(_Dll, CallingConvention = CallingConvention.Cdecl)] public static extern void Update(); } } \ No newline at end of file diff --git a/Vocaluxe/Lib/Sound/IPlayback.cs b/Vocaluxe/Lib/Sound/IPlayback.cs index df269238..a3062906 100644 --- a/Vocaluxe/Lib/Sound/IPlayback.cs +++ b/Vocaluxe/Lib/Sound/IPlayback.cs @@ -2,104 +2,104 @@ namespace Vocaluxe.Lib.Sound { - struct AudioStreams + struct SAudioStreams { - public int handle; - public string file; + public int Handle; + public string File; - public AudioStreams(int stream) + public SAudioStreams(int stream) { - handle = stream; - file = String.Empty; + Handle = stream; + File = String.Empty; } } - delegate void CLOSEPROC(int StreamID); + delegate void Closeproc(int streamID); interface IPlayback { bool Init(); - void SetGlobalVolume(float Volume); + void SetGlobalVolume(float volume); int GetStreamCount(); void CloseAll(); #region Stream Handling - int Load(string Media); - int Load(string Media, bool Prescan); - void Close(int Stream); + int Load(string media); + int Load(string media, bool prescan); + void Close(int stream); - void Play(int Stream); - void Play(int Stream, bool Loop); - void Pause(int Stream); - void Stop(int Stream); - void Fade(int Stream, float TargetVolume, float Seconds); - void FadeAndPause(int Stream, float TargetVolume, float Seconds); - void FadeAndStop(int Stream, float TargetVolume, float Seconds); - void SetStreamVolume(int Stream, float Volume); - void SetStreamVolumeMax(int Stream, float Volume); + void Play(int stream); + void Play(int stream, bool loop); + void Pause(int stream); + void Stop(int stream); + void Fade(int stream, float targetVolume, float seconds); + void FadeAndPause(int stream, float targetVolume, float seconds); + void FadeAndStop(int stream, float targetVolume, float seconds); + void SetStreamVolume(int stream, float volume); + void SetStreamVolumeMax(int stream, float volume); - float GetLength(int Stream); - float GetPosition(int Stream); + float GetLength(int stream); + float GetPosition(int stream); - bool IsPlaying(int Stream); - bool IsPaused(int Stream); - bool IsFinished(int Stream); + bool IsPlaying(int stream); + bool IsPaused(int stream); + bool IsFinished(int stream); - void SetPosition(int Stream, float Position); + void SetPosition(int stream, float position); void Update(); #endregion Stream Handling } - class RingBuffer + class CRingBuffer { - private readonly byte[] _data; - private readonly long _size; - private long _readPos; - private long _writePos; - private long _bytesNotRead; + private readonly byte[] _Data; + private readonly long _Size; + private long _ReadPos; + private long _WritePos; + private long _BytesNotRead; public long BytesNotRead { - get { return _bytesNotRead; } + get { return _BytesNotRead; } } - public RingBuffer(long size) + public CRingBuffer(long size) { - _size = size; - _data = new byte[size]; - _readPos = 0L; - _writePos = 0L; - _bytesNotRead = 0L; + _Size = size; + _Data = new byte[size]; + _ReadPos = 0L; + _WritePos = 0L; + _BytesNotRead = 0L; } - public void Write(byte[] Data) + public void Write(byte[] data) { long written = 0L; - while (written < Data.Length) + while (written < data.Length) { - _data[_writePos] = Data[written]; - _writePos++; - if (_writePos >= _size) - _writePos = 0L; + _Data[_WritePos] = data[written]; + _WritePos++; + if (_WritePos >= _Size) + _WritePos = 0L; written++; - _bytesNotRead++; + _BytesNotRead++; } } - public void Read(ref byte[] Data) + public void Read(ref byte[] data) { long read = 0L; - while (read < Data.Length && _bytesNotRead > 0L) + while (read < data.Length && _BytesNotRead > 0L) { - Data[read] = _data[_readPos]; - _readPos++; - if (_readPos >= _size) - _readPos = 0L; + data[read] = _Data[_ReadPos]; + _ReadPos++; + if (_ReadPos >= _Size) + _ReadPos = 0L; read++; - _bytesNotRead--; + _BytesNotRead--; } } } diff --git a/Vocaluxe/Lib/Sound/IRecord.cs b/Vocaluxe/Lib/Sound/IRecord.cs index 2db59a6c..30df7caf 100644 --- a/Vocaluxe/Lib/Sound/IRecord.cs +++ b/Vocaluxe/Lib/Sound/IRecord.cs @@ -41,17 +41,17 @@ namespace Vocaluxe.Lib.Sound bool Init(); void CloseAll(); - bool Start(SRecordDevice[] DeviceConfig); + bool Start(SRecordDevice[] deviceConfig); bool Stop(); - void AnalyzeBuffer(int Player); + void AnalyzeBuffer(int player); - int GetToneAbs(int Player); - int GetTone(int Player); - void SetTone(int Player, int Tone); - float GetMaxVolume(int Player); - bool ToneValid(int Player); - int NumHalfTones(int Player); - float[] ToneWeigth(int Player); + int GetToneAbs(int player); + int GetTone(int player); + void SetTone(int player, int tone); + float GetMaxVolume(int player); + bool ToneValid(int player); + int NumHalfTones(int player); + float[] ToneWeigth(int player); SRecordDevice[] RecordDevices(); } diff --git a/Vocaluxe/Lib/Sound/Portaudio/PortAudio.cs b/Vocaluxe/Lib/Sound/Portaudio/PortAudio.cs index 5a2fc998..90072073 100644 --- a/Vocaluxe/Lib/Sound/Portaudio/PortAudio.cs +++ b/Vocaluxe/Lib/Sound/Portaudio/PortAudio.cs @@ -29,16 +29,16 @@ namespace PortAudioSharp PortAudio v.19 bindings for .NET */ - public partial class PortAudio + public partial class CPortAudio { #region **** PORTAUDIO CALLBACKS **** [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate PaStreamCallbackResult PaStreamCallbackDelegate( + public delegate EPaStreamCallbackResult PaStreamCallbackDelegate( IntPtr input, IntPtr output, uint frameCount, - ref PaStreamCallbackTimeInfo timeInfo, - PaStreamCallbackFlags statusFlags, + ref SPaStreamCallbackTimeInfo timeInfo, + EPaStreamCallbackFlags statusFlags, IntPtr userData); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] @@ -47,226 +47,226 @@ namespace PortAudioSharp #region **** PORTAUDIO DATA STRUCTURES **** [StructLayout(LayoutKind.Sequential)] - public struct PaDeviceInfo + public struct SPaDeviceInfo { - public int structVersion; - [MarshalAs(UnmanagedType.LPStr)] public string name; - public int hostApi; - public int maxInputChannels; - public int maxOutputChannels; - public double defaultLowInputLatency; - public double defaultLowOutputLatency; - public double defaultHighInputLatency; - public double defaultHighOutputLatency; - public double defaultSampleRate; + public int StructVersion; + [MarshalAs(UnmanagedType.LPStr)] public string Name; + public int HostApi; + public int MaxInputChannels; + public int MaxOutputChannels; + public double DefaultLowInputLatency; + public double DefaultLowOutputLatency; + public double DefaultHighInputLatency; + public double DefaultHighOutputLatency; + public double DefaultSampleRate; public override string ToString() { return "[" + GetType().Name + "]" + "\n" - + "name: " + name + "\n" - + "hostApi: " + hostApi + "\n" - + "maxInputChannels: " + maxInputChannels + "\n" - + "maxOutputChannels: " + maxOutputChannels + "\n" - + "defaultLowInputLatency: " + defaultLowInputLatency + "\n" - + "defaultLowOutputLatency: " + defaultLowOutputLatency + "\n" - + "defaultHighInputLatency: " + defaultHighInputLatency + "\n" - + "defaultHighOutputLatency: " + defaultHighOutputLatency + "\n" - + "defaultSampleRate: " + defaultSampleRate; + + "name: " + Name + "\n" + + "hostApi: " + HostApi + "\n" + + "maxInputChannels: " + MaxInputChannels + "\n" + + "maxOutputChannels: " + MaxOutputChannels + "\n" + + "defaultLowInputLatency: " + DefaultLowInputLatency + "\n" + + "defaultLowOutputLatency: " + DefaultLowOutputLatency + "\n" + + "defaultHighInputLatency: " + DefaultHighInputLatency + "\n" + + "defaultHighOutputLatency: " + DefaultHighOutputLatency + "\n" + + "defaultSampleRate: " + DefaultSampleRate; } } [StructLayout(LayoutKind.Sequential)] - public struct PaHostApiInfo + public struct SPaHostApiInfo { - public int structVersion; - public PaHostApiTypeId type; - [MarshalAs(UnmanagedType.LPStr)] public string name; - public int deviceCount; - public int defaultInputDevice; - public int defaultOutputDevice; + public int StructVersion; + public EPaHostApiTypeId Type; + [MarshalAs(UnmanagedType.LPStr)] public string Name; + public int DeviceCount; + public int DefaultInputDevice; + public int DefaultOutputDevice; public override string ToString() { return "[" + GetType().Name + "]" + "\n" - + "structVersion: " + structVersion + "\n" - + "type: " + type + "\n" - + "name: " + name + "\n" - + "deviceCount: " + deviceCount + "\n" - + "defaultInputDevice: " + defaultInputDevice + "\n" - + "defaultOutputDevice: " + defaultOutputDevice; + + "structVersion: " + StructVersion + "\n" + + "type: " + Type + "\n" + + "name: " + Name + "\n" + + "deviceCount: " + DeviceCount + "\n" + + "defaultInputDevice: " + DefaultInputDevice + "\n" + + "defaultOutputDevice: " + DefaultOutputDevice; } } [StructLayout(LayoutKind.Sequential)] - public struct PaHostErrorInfo + public struct SPaHostErrorInfo { - public PaHostApiTypeId hostApiType; - public int errorCode; - [MarshalAs(UnmanagedType.LPStr)] public string errorText; + public EPaHostApiTypeId HostApiType; + public int ErrorCode; + [MarshalAs(UnmanagedType.LPStr)] public string ErrorText; public override string ToString() { return "[" + GetType().Name + "]" + "\n" - + "hostApiType: " + hostApiType + "\n" - + "errorCode: " + errorCode + "\n" - + "errorText: " + errorText; + + "hostApiType: " + HostApiType + "\n" + + "errorCode: " + ErrorCode + "\n" + + "errorText: " + ErrorText; } } [StructLayout(LayoutKind.Sequential)] - public struct PaStreamCallbackTimeInfo + public struct SPaStreamCallbackTimeInfo { - public double inputBufferAdcTime; - public double currentTime; - public double outputBufferDacTime; + public double InputBufferAdcTime; + public double CurrentTime; + public double OutputBufferDacTime; public override string ToString() { return "[" + GetType().Name + "]" + "\n" - + "currentTime: " + currentTime + "\n" - + "inputBufferAdcTime: " + inputBufferAdcTime + "\n" - + "outputBufferDacTime: " + outputBufferDacTime; + + "currentTime: " + CurrentTime + "\n" + + "inputBufferAdcTime: " + InputBufferAdcTime + "\n" + + "outputBufferDacTime: " + OutputBufferDacTime; } } [StructLayout(LayoutKind.Sequential)] - public struct PaStreamInfo + public struct SPaStreamInfo { - public int structVersion; - public double inputLatency; - public double outputLatency; - public double sampleRate; + public int StructVersion; + public double InputLatency; + public double OutputLatency; + public double SampleRate; public override string ToString() { return "[" + GetType().Name + "]" + "\n" - + "structVersion: " + structVersion + "\n" - + "inputLatency: " + inputLatency + "\n" - + "outputLatency: " + outputLatency + "\n" - + "sampleRate: " + sampleRate; + + "structVersion: " + StructVersion + "\n" + + "inputLatency: " + InputLatency + "\n" + + "outputLatency: " + OutputLatency + "\n" + + "sampleRate: " + SampleRate; } } [StructLayout(LayoutKind.Sequential)] - public struct PaStreamParameters + public struct SPaStreamParameters { - public int device; - public int channelCount; - public PaSampleFormat sampleFormat; - public double suggestedLatency; - internal IntPtr hostApiSpecificStreamInfo; + public int Device; + public int ChannelCount; + public EPaSampleFormat SampleFormat; + public double SuggestedLatency; + internal IntPtr HostApiSpecificStreamInfo; public override string ToString() { return "[" + GetType().Name + "]" + "\n" - + "device: " + device + "\n" - + "channelCount: " + channelCount + "\n" - + "sampleFormat: " + sampleFormat + "\n" - + "suggestedLatency: " + suggestedLatency; + + "device: " + Device + "\n" + + "channelCount: " + ChannelCount + "\n" + + "sampleFormat: " + SampleFormat + "\n" + + "suggestedLatency: " + SuggestedLatency; } } #endregion #region **** PORTAUDIO DEFINES **** - public enum PaDeviceIndex + public enum EPaDeviceIndex { - paNoDevice = -1, - paUseHostApiSpecificDeviceSpecification = -2 + PaNoDevice = -1, + PaUseHostApiSpecificDeviceSpecification = -2 } - public enum PaSampleFormat : uint + public enum EPaSampleFormat : uint { - paFloat32 = 0x00000001, - paInt32 = 0x00000002, - paInt24 = 0x00000004, - paInt16 = 0x00000008, - paInt8 = 0x00000010, - paUInt8 = 0x00000020, - paCustomFormat = 0x00010000, - paNonInterleaved = 0x80000000, + PaFloat32 = 0x00000001, + PaInt32 = 0x00000002, + PaInt24 = 0x00000004, + PaInt16 = 0x00000008, + PaInt8 = 0x00000010, + PaUInt8 = 0x00000020, + PaCustomFormat = 0x00010000, + PaNonInterleaved = 0x80000000, } - public const int paFormatIsSupported = 0; - public const int paFramesPerBufferUnspecified = 0; + public const int PaFormatIsSupported = 0; + public const int PaFramesPerBufferUnspecified = 0; - public enum PaStreamFlags : uint + public enum EPaStreamFlags : uint { - paNoFlag = 0, - paClipOff = 0x00000001, - paDitherOff = 0x00000002, - paNeverDropInput = 0x00000004, - paPrimeOutputBuffersUsingStreamCallback = 0x00000008, - paPlatformSpecificFlags = 0xFFFF0000 + PaNoFlag = 0, + PaClipOff = 0x00000001, + PaDitherOff = 0x00000002, + PaNeverDropInput = 0x00000004, + PaPrimeOutputBuffersUsingStreamCallback = 0x00000008, + PaPlatformSpecificFlags = 0xFFFF0000 } - public enum PaStreamCallbackFlags : uint + public enum EPaStreamCallbackFlags : uint { - paInputUnderflow = 0x00000001, - paInputOverflow = 0x00000002, - paOutputUnderflow = 0x00000004, - paOutputOverflow = 0x00000008, - paPrimingOutput = 0x00000010 + PaInputUnderflow = 0x00000001, + PaInputOverflow = 0x00000002, + PaOutputUnderflow = 0x00000004, + PaOutputOverflow = 0x00000008, + PaPrimingOutput = 0x00000010 } #endregion #region **** PORTAUDIO ENUMERATIONS **** - public enum PaError + public enum EPaError { - paNoError = 0, - paNotInitialized = -10000, - paUnanticipatedHostError, - paInvalidChannelCount, - paInvalidSampleRate, - paInvalidDevice, - paInvalidFlag, - paSampleFormatNotSupported, - paBadIODeviceCombination, - paInsufficientMemory, - paBufferTooBig, - paBufferTooSmall, - paNullCallback, - paBadStreamPtr, - paTimedOut, - paInternalError, - paDeviceUnavailable, - paIncompatibleHostApiSpecificStreamInfo, - paStreamIsStopped, - paStreamIsNotStopped, - paInputOverflowed, - paOutputUnderflowed, - paHostApiNotFound, - paInvalidHostApi, - paCanNotReadFromCallbackStream, - paCanNotWriteToACallbackStream, - paCanNotReadFromAnOutputOnlyStream, - paCanNotWriteToAnInputOnlyStream, - paIncompatibleStreamHostApi, - paBadBufferPtr + PaNoError = 0, + PaNotInitialized = -10000, + PaUnanticipatedHostError, + PaInvalidChannelCount, + PaInvalidSampleRate, + PaInvalidDevice, + PaInvalidFlag, + PaSampleFormatNotSupported, + PaBadIODeviceCombination, + PaInsufficientMemory, + PaBufferTooBig, + PaBufferTooSmall, + PaNullCallback, + PaBadStreamPtr, + PaTimedOut, + PaInternalError, + PaDeviceUnavailable, + PaIncompatibleHostApiSpecificStreamInfo, + PaStreamIsStopped, + PaStreamIsNotStopped, + PaInputOverflowed, + PaOutputUnderflowed, + PaHostApiNotFound, + PaInvalidHostApi, + PaCanNotReadFromCallbackStream, + PaCanNotWriteToACallbackStream, + PaCanNotReadFromAnOutputOnlyStream, + PaCanNotWriteToAnInputOnlyStream, + PaIncompatibleStreamHostApi, + PaBadBufferPtr } - public enum PaHostApiTypeId : uint + public enum EPaHostApiTypeId : uint { - paInDevelopment = 0, - paDirectSound = 1, - paMME = 2, - paASIO = 3, - paSoundManager = 4, - paCoreAudio = 5, - paOSS = 7, - paALSA = 8, - paAL = 9, - paBeOS = 10, - paWDMKS = 11, - paJACK = 12, - paWASAPI = 13, - paAudioScienceHPI = 14 + PaInDevelopment = 0, + PaDirectSound = 1, + PaMME = 2, + PaASIO = 3, + PaSoundManager = 4, + PaCoreAudio = 5, + PaOSS = 7, + PaALSA = 8, + PaAL = 9, + PaBeOS = 10, + PaWDMKS = 11, + PaJACK = 12, + PaWASAPI = 13, + PaAudioScienceHPI = 14 } - public enum PaStreamCallbackResult : uint + public enum EPaStreamCallbackResult : uint { - paContinue = 0, - paComplete = 1, - paAbort = 2 + PaContinue = 0, + PaComplete = 1, + PaAbort = 2 } #endregion @@ -283,7 +283,7 @@ namespace PortAudioSharp #if ARCH_X64 #if WIN - private const string PaDll = "x64\\portaudio_x64.dll"; + private const string _PaDll = "x64\\portaudio_x64.dll"; #endif #if LINUX @@ -291,122 +291,122 @@ namespace PortAudioSharp #endif #endif - [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)] + [DllImport(_PaDll, CallingConvention = CallingConvention.Cdecl)] public static extern int Pa_GetVersion(); - [DllImport(PaDll, EntryPoint = "Pa_GetVersionText", CallingConvention = CallingConvention.Cdecl)] + [DllImport(_PaDll, EntryPoint = "Pa_GetVersionText", CallingConvention = CallingConvention.Cdecl)] private static extern IntPtr IntPtr_Pa_GetVersionText(); - public static string Pa_GetVersionText() + public static string PaGetVersionText() { IntPtr strptr = IntPtr_Pa_GetVersionText(); return Marshal.PtrToStringAnsi(strptr); } - [DllImport(PaDll, EntryPoint = "Pa_GetErrorText", CallingConvention = CallingConvention.Cdecl)] - public static extern IntPtr IntPtr_Pa_GetErrorText(PaError errorCode); + [DllImport(_PaDll, EntryPoint = "Pa_GetErrorText", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr IntPtr_Pa_GetErrorText(EPaError errorCode); - public static string Pa_GetErrorText(PaError errorCode) + public static string PaGetErrorText(EPaError errorCode) { IntPtr strptr = IntPtr_Pa_GetErrorText(errorCode); return Marshal.PtrToStringAnsi(strptr); } - [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)] - public static extern PaError Pa_Initialize(); + [DllImport(_PaDll, CallingConvention = CallingConvention.Cdecl)] + public static extern EPaError Pa_Initialize(); - [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)] - public static extern PaError Pa_Terminate(); + [DllImport(_PaDll, CallingConvention = CallingConvention.Cdecl)] + public static extern EPaError Pa_Terminate(); - [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)] + [DllImport(_PaDll, CallingConvention = CallingConvention.Cdecl)] public static extern int Pa_GetHostApiCount(); - [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)] + [DllImport(_PaDll, CallingConvention = CallingConvention.Cdecl)] public static extern int Pa_GetDefaultHostApi(); - [DllImport(PaDll, EntryPoint = "Pa_GetHostApiInfo", CallingConvention = CallingConvention.Cdecl)] + [DllImport(_PaDll, EntryPoint = "Pa_GetHostApiInfo", CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr IntPtr_Pa_GetHostApiInfo(int hostApi); - public static PaHostApiInfo Pa_GetHostApiInfo(int hostApi) + public static SPaHostApiInfo PaGetHostApiInfo(int hostApi) { IntPtr structptr = IntPtr_Pa_GetHostApiInfo(hostApi); - return (PaHostApiInfo)Marshal.PtrToStructure(structptr, typeof(PaHostApiInfo)); + return (SPaHostApiInfo)Marshal.PtrToStructure(structptr, typeof(SPaHostApiInfo)); } - [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)] - public static extern int Pa_HostApiTypeIdToHostApiIndex(PaHostApiTypeId type); + [DllImport(_PaDll, CallingConvention = CallingConvention.Cdecl)] + public static extern int Pa_HostApiTypeIdToHostApiIndex(EPaHostApiTypeId type); - [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)] + [DllImport(_PaDll, CallingConvention = CallingConvention.Cdecl)] public static extern int Pa_HostApiDeviceIndexToDeviceIndex(int hostApi, int hostApiDeviceIndex); - [DllImport(PaDll, EntryPoint = "Pa_GetLastHostErrorInfo", CallingConvention = CallingConvention.Cdecl)] + [DllImport(_PaDll, EntryPoint = "Pa_GetLastHostErrorInfo", CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr IntPtr_Pa_GetLastHostErrorInfo(); - public static PaHostErrorInfo Pa_GetLastHostErrorInfo() + public static SPaHostErrorInfo PaGetLastHostErrorInfo() { IntPtr structptr = IntPtr_Pa_GetLastHostErrorInfo(); - return (PaHostErrorInfo)Marshal.PtrToStructure(structptr, typeof(PaHostErrorInfo)); + return (SPaHostErrorInfo)Marshal.PtrToStructure(structptr, typeof(SPaHostErrorInfo)); } - [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)] + [DllImport(_PaDll, CallingConvention = CallingConvention.Cdecl)] public static extern int Pa_GetDeviceCount(); - [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)] + [DllImport(_PaDll, CallingConvention = CallingConvention.Cdecl)] public static extern int Pa_GetDefaultInputDevice(); - [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)] + [DllImport(_PaDll, CallingConvention = CallingConvention.Cdecl)] public static extern int Pa_GetDefaultOutputDevice(); - [DllImport(PaDll, EntryPoint = "Pa_GetDeviceInfo", CallingConvention = CallingConvention.Cdecl)] + [DllImport(_PaDll, EntryPoint = "Pa_GetDeviceInfo", CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr IntPtr_Pa_GetDeviceInfo(int device); - public static PaDeviceInfo Pa_GetDeviceInfo(int device) + public static SPaDeviceInfo PaGetDeviceInfo(int device) { IntPtr structptr = IntPtr_Pa_GetDeviceInfo(device); - return (PaDeviceInfo)Marshal.PtrToStructure(structptr, typeof(PaDeviceInfo)); + return (SPaDeviceInfo)Marshal.PtrToStructure(structptr, typeof(SPaDeviceInfo)); } - [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)] - public static extern PaError Pa_IsFormatSupported( - ref PaStreamParameters inputParameters, - ref PaStreamParameters outputParameters, + [DllImport(_PaDll, CallingConvention = CallingConvention.Cdecl)] + public static extern EPaError Pa_IsFormatSupported( + ref SPaStreamParameters inputParameters, + ref SPaStreamParameters outputParameters, double sampleRate); - [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)] - public static extern PaError Pa_OpenStream( + [DllImport(_PaDll, CallingConvention = CallingConvention.Cdecl)] + public static extern EPaError Pa_OpenStream( out IntPtr stream, - ref PaStreamParameters inputParameters, - ref PaStreamParameters outputParameters, + ref SPaStreamParameters inputParameters, + ref SPaStreamParameters outputParameters, double sampleRate, uint framesPerBuffer, - PaStreamFlags streamFlags, + EPaStreamFlags streamFlags, PaStreamCallbackDelegate streamCallback, IntPtr userData); - [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)] - public static extern PaError Pa_OpenStream( + [DllImport(_PaDll, CallingConvention = CallingConvention.Cdecl)] + public static extern EPaError Pa_OpenStream( out IntPtr stream, - ref PaStreamParameters inputParameters, + ref SPaStreamParameters inputParameters, IntPtr outputParameters, double sampleRate, uint framesPerBuffer, - PaStreamFlags streamFlags, + EPaStreamFlags streamFlags, PaStreamCallbackDelegate streamCallback, IntPtr userData); - [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)] - public static extern PaError Pa_OpenStream( + [DllImport(_PaDll, CallingConvention = CallingConvention.Cdecl)] + public static extern EPaError Pa_OpenStream( out IntPtr stream, IntPtr inputParameters, - ref PaStreamParameters outputParameters, + ref SPaStreamParameters outputParameters, double sampleRate, uint framesPerBuffer, - PaStreamFlags streamFlags, + EPaStreamFlags streamFlags, PaStreamCallbackDelegate streamCallback, IntPtr userData); - [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)] - public static extern PaError Pa_OpenDefaultStream( + [DllImport(_PaDll, CallingConvention = CallingConvention.Cdecl)] + public static extern EPaError Pa_OpenDefaultStream( out IntPtr stream, int numInputChannels, int numOutputChannels, @@ -416,142 +416,142 @@ namespace PortAudioSharp PaStreamCallbackDelegate streamCallback, IntPtr userData); - [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)] - public static extern PaError Pa_CloseStream(IntPtr stream); + [DllImport(_PaDll, CallingConvention = CallingConvention.Cdecl)] + public static extern EPaError Pa_CloseStream(IntPtr stream); - [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)] - public static extern PaError Pa_SetStreamFinishedCallback( + [DllImport(_PaDll, CallingConvention = CallingConvention.Cdecl)] + public static extern EPaError Pa_SetStreamFinishedCallback( ref IntPtr stream, [MarshalAs(UnmanagedType.FunctionPtr)] PaStreamFinishedCallbackDelegate streamFinishedCallback); - [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)] - public static extern PaError Pa_StartStream(IntPtr stream); + [DllImport(_PaDll, CallingConvention = CallingConvention.Cdecl)] + public static extern EPaError Pa_StartStream(IntPtr stream); - [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)] - public static extern PaError Pa_StopStream(IntPtr stream); + [DllImport(_PaDll, CallingConvention = CallingConvention.Cdecl)] + public static extern EPaError Pa_StopStream(IntPtr stream); - [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)] - public static extern PaError Pa_AbortStream(IntPtr stream); + [DllImport(_PaDll, CallingConvention = CallingConvention.Cdecl)] + public static extern EPaError Pa_AbortStream(IntPtr stream); - [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)] - public static extern PaError Pa_IsStreamStopped(IntPtr stream); + [DllImport(_PaDll, CallingConvention = CallingConvention.Cdecl)] + public static extern EPaError Pa_IsStreamStopped(IntPtr stream); - [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)] - public static extern PaError Pa_IsStreamActive(IntPtr stream); + [DllImport(_PaDll, CallingConvention = CallingConvention.Cdecl)] + public static extern EPaError Pa_IsStreamActive(IntPtr stream); - [DllImport(PaDll, EntryPoint = "Pa_GetStreamInfo", CallingConvention = CallingConvention.Cdecl)] + [DllImport(_PaDll, EntryPoint = "Pa_GetStreamInfo", CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr IntPtr_Pa_GetStreamInfo(IntPtr stream); - public static PaStreamInfo Pa_GetStreamInfo(IntPtr stream) + public static SPaStreamInfo PaGetStreamInfo(IntPtr stream) { IntPtr structptr = IntPtr_Pa_GetStreamInfo(stream); - return (PaStreamInfo)Marshal.PtrToStructure(structptr, typeof(PaStreamInfo)); + return (SPaStreamInfo)Marshal.PtrToStructure(structptr, typeof(SPaStreamInfo)); } - [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)] + [DllImport(_PaDll, CallingConvention = CallingConvention.Cdecl)] public static extern double Pa_GetStreamTime(IntPtr stream); - [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)] + [DllImport(_PaDll, CallingConvention = CallingConvention.Cdecl)] public static extern double Pa_GetStreamCpuLoad(IntPtr stream); - [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)] - public static extern PaError Pa_ReadStream( + [DllImport(_PaDll, CallingConvention = CallingConvention.Cdecl)] + public static extern EPaError Pa_ReadStream( IntPtr stream, [Out] float[] buffer, uint frames); - [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)] - public static extern PaError Pa_ReadStream( + [DllImport(_PaDll, CallingConvention = CallingConvention.Cdecl)] + public static extern EPaError Pa_ReadStream( IntPtr stream, [Out] byte[] buffer, uint frames); - [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)] - public static extern PaError Pa_ReadStream( + [DllImport(_PaDll, CallingConvention = CallingConvention.Cdecl)] + public static extern EPaError Pa_ReadStream( IntPtr stream, [Out] sbyte[] buffer, uint frames); - [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)] - public static extern PaError Pa_ReadStream( + [DllImport(_PaDll, CallingConvention = CallingConvention.Cdecl)] + public static extern EPaError Pa_ReadStream( IntPtr stream, [Out] ushort[] buffer, uint frames); - [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)] - public static extern PaError Pa_ReadStream( + [DllImport(_PaDll, CallingConvention = CallingConvention.Cdecl)] + public static extern EPaError Pa_ReadStream( IntPtr stream, [Out] short[] buffer, uint frames); - [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)] - public static extern PaError Pa_ReadStream( + [DllImport(_PaDll, CallingConvention = CallingConvention.Cdecl)] + public static extern EPaError Pa_ReadStream( IntPtr stream, [Out] uint[] buffer, uint frames); - [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)] - public static extern PaError Pa_ReadStream( + [DllImport(_PaDll, CallingConvention = CallingConvention.Cdecl)] + public static extern EPaError Pa_ReadStream( IntPtr stream, [Out] int[] buffer, uint frames); - [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)] - public static extern PaError Pa_WriteStream( + [DllImport(_PaDll, CallingConvention = CallingConvention.Cdecl)] + public static extern EPaError Pa_WriteStream( IntPtr stream, [In] float[] buffer, uint frames); - [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)] - public static extern PaError Pa_WriteStream( + [DllImport(_PaDll, CallingConvention = CallingConvention.Cdecl)] + public static extern EPaError Pa_WriteStream( IntPtr stream, [In] byte[] buffer, uint frames); - [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)] - public static extern PaError Pa_WriteStream( + [DllImport(_PaDll, CallingConvention = CallingConvention.Cdecl)] + public static extern EPaError Pa_WriteStream( IntPtr stream, [In] sbyte[] buffer, uint frames); - [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)] - public static extern PaError Pa_WriteStream( + [DllImport(_PaDll, CallingConvention = CallingConvention.Cdecl)] + public static extern EPaError Pa_WriteStream( IntPtr stream, [In] ushort[] buffer, uint frames); - [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)] - public static extern PaError Pa_WriteStream( + [DllImport(_PaDll, CallingConvention = CallingConvention.Cdecl)] + public static extern EPaError Pa_WriteStream( IntPtr stream, [In] short[] buffer, uint frames); - [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)] - public static extern PaError Pa_WriteStream( + [DllImport(_PaDll, CallingConvention = CallingConvention.Cdecl)] + public static extern EPaError Pa_WriteStream( IntPtr stream, [In] uint[] buffer, uint frames); - [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)] - public static extern PaError Pa_WriteStream( + [DllImport(_PaDll, CallingConvention = CallingConvention.Cdecl)] + public static extern EPaError Pa_WriteStream( IntPtr stream, [In] int[] buffer, uint frames); - [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)] + [DllImport(_PaDll, CallingConvention = CallingConvention.Cdecl)] public static extern int Pa_GetStreamReadAvailable(IntPtr stream); - [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)] + [DllImport(_PaDll, CallingConvention = CallingConvention.Cdecl)] public static extern int Pa_GetStreamWriteAvailable(IntPtr stream); - [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)] - public static extern PaError Pa_GetSampleSize(PaSampleFormat format); + [DllImport(_PaDll, CallingConvention = CallingConvention.Cdecl)] + public static extern EPaError Pa_GetSampleSize(EPaSampleFormat format); - [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)] + [DllImport(_PaDll, CallingConvention = CallingConvention.Cdecl)] public static extern void Pa_Sleep(int msec); #endregion - private PortAudio() + private CPortAudio() { // This is a static class } diff --git a/Vocaluxe/Lib/Sound/Portaudio/PortAudioASIO.cs b/Vocaluxe/Lib/Sound/Portaudio/PortAudioASIO.cs index 557358c9..081ce0b0 100644 --- a/Vocaluxe/Lib/Sound/Portaudio/PortAudioASIO.cs +++ b/Vocaluxe/Lib/Sound/Portaudio/PortAudioASIO.cs @@ -25,16 +25,16 @@ using System.Runtime.InteropServices; namespace PortAudioSharp { /// PortAudio v.19 bindings for .NET - ASIO bindings - public partial class PortAudio + public partial class CPortAudio { #region **** PORTAUDIO DATA STRUCTURES **** [StructLayout(LayoutKind.Sequential)] - public struct PaAsioStreamInfo + public struct SPaAsioStreamInfo { - public ulong size; /**< sizeof(PaAsioStreamInfo) */ - public int hostApiType; /**< paASIO */ - public ulong version; /**< 1 */ - public ulong flags; + public ulong Size; /**< sizeof(PaAsioStreamInfo) */ + public int HostApiType; /**< paASIO */ + public ulong Version; /**< 1 */ + public ulong Flags; /// Support for opening only specific channels of an ASIO device. /// If the paAsioUseChannelSelectors flag is set, channelSelectors is a @@ -45,12 +45,12 @@ namespace PortAudioSharp /// The values in the selectors array must specify channels within the /// range of supported channels for the device or paInvalidChannelCount will /// result. - private readonly IntPtr channelSelectors; + private readonly IntPtr _ChannelSelectors; } #endregion #region **** PORTAUDIO DEFINES **** - public const int paAsioUseChannelSelectors = 0x01; + public const int PaAsioUseChannelSelectors = 0x01; #endregion #region **** PORTAUDIO FUNCTIONS **** @@ -73,7 +73,7 @@ namespace PortAudioSharp /// on Macintosh this value should be zero. /// [DllImport("PortAudio.dll", CallingConvention = CallingConvention.Cdecl)] - public static extern PaError PaAsio_ShowControlPanel(int device, IntPtr systemSpecific); + public static extern EPaError PaAsio_ShowControlPanel(int device, IntPtr systemSpecific); // /// Retrieve a pointer to a string containing the name of the specified input channel. // /// The string is valid until Pa_Terminate is called. @@ -86,7 +86,7 @@ namespace PortAudioSharp // PaError PaAsio_GetOutputChannelName( PaDeviceIndex device, int channelIndex, const char** channelName ); /// Set the sample rate of an open paASIO stream. - /// stream + /// /// The stream to operate on. /// /// The new sample rate. @@ -94,7 +94,7 @@ namespace PortAudioSharp /// ASIO driver does not support switching the sample rate of a running stream. /// paIncompatibleStreamHostApi if stream is not a paASIO stream. [DllImport("PortAudio.dll", CallingConvention = CallingConvention.Cdecl)] - public static extern PaError PaAsio_SetStreamSampleRate(IntPtr stream, double sampleRate); + public static extern EPaError PaAsio_SetStreamSampleRate(IntPtr stream, double sampleRate); #endregion } } \ No newline at end of file diff --git a/Vocaluxe/Lib/Video/Acinerella/CAcinerella.cs b/Vocaluxe/Lib/Video/Acinerella/CAcinerella.cs index 594b2a2e..ebff6299 100644 --- a/Vocaluxe/Lib/Video/Acinerella/CAcinerella.cs +++ b/Vocaluxe/Lib/Video/Acinerella/CAcinerella.cs @@ -3,135 +3,135 @@ using System.Runtime.InteropServices; namespace Vocaluxe.Lib.Video.Acinerella { - public enum AC_stream_type : sbyte + public enum EACStreamType : sbyte { /*The type of the media stream is not known. This kind of stream can not be decoded.*/ - AC_STREAM_TYPE_UNKNOWN = -1, + ACStreamTypeUnknown = -1, //This media stream is a video stream. - AC_STREAM_TYPE_VIDEO = 0, + ACStreamTypeVideo = 0, //This media stream is an audio stream. - AC_STREAM_TYPE_AUDIO = 1 + ACStreamTypeAudio = 1 } //Defines the type of an Acinerella media decoder. - public enum AC_decoder_type : byte + public enum EACDecoderType : byte { //This decoder is used to decode a video stream. - AC_DECODER_TYPE_VIDEO = 0, + ACDecoderTypeVideo = 0, //This decoder is used to decode an audio stram. - AC_DECODER_TYPE_AUDIO = 1 + ACDecoderTypeAudio = 1 } //Defines the format video/image data is outputted in - public enum AC_output_format : byte + public enum EACOutputFormat : byte { - AC_OUTPUT_RGB24 = 0, - AC_OUTPUT_BGR24 = 1, - AC_OUTPUT_RGBA32 = 2, - AC_OUTPUT_BGRA32 = 3 + ACOutputRGB24 = 0, + ACOutputBGR24 = 1, + ACOutputRGBA32 = 2, + ACOutputBGra32 = 3 } // Contains information about the whole file/stream that has been opened. Default // values are "" for strings and -1 for integer values. [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] - public struct AC_file_info + public struct SACFileInfo { - public Int64 duration; + public Int64 Duration; } // TAc_instance represents an Acinerella instance. Each instance can open and // decode one file at once. There can be only 26 Acinerella instances opened at // once. [StructLayout(LayoutKind.Sequential)] - public struct AC_instance + public struct SACInstance { //If true, the instance currently opened a media file - public bool opened; + public bool Opened; //Contains the count of streams the media file has. This value is available //after calling the ac_open function. - public Int32 stream_count; + public Int32 StreamCount; //Set this value to change the image output format - public AC_output_format output_format; + public EACOutputFormat OutputFormat; //Contains information about the opened stream/file - public AC_file_info info; + public SACFileInfo Info; } // Contains information about an Acinerella audio stream. [StructLayout(LayoutKind.Sequential)] - public struct AC_audio_stream_info + public struct SACAudioStreamInfo { //Samples per second. Default values are 44100 or 48000. - public Int32 samples_per_second; + public Int32 SamplesPerSecond; //Bits per sample. Can be 8 or 16 Bit. - public Int32 bit_depth; + public Int32 BitDepth; //Count of channels in the audio stream. - public Int32 channel_count; + public Int32 ChannelCount; } // Contains information about an Acinerella video stream. [StructLayout(LayoutKind.Sequential)] - public struct AC_video_stream_info + public struct SACVideoStreamInfo { //The width of one frame. - public Int32 frame_width; + public Int32 FrameWidth; //The height of one frame. - public Int32 frame_height; + public Int32 FrameHeight; //The width of one pixel. 1.07 for 4:3 format, 1,42 for the 16:9 format - public float pixel_aspect; + public float PixelAspect; //Frames per second that should be played. - public double frames_per_second; + public double FramesPerSecond; } // Contains information about an Acinerella stream. [StructLayout(LayoutKind.Sequential)] - public struct AC_stream_info + public struct SACStreamInfo { //Contains the type of the stream. - public AC_stream_type stream_type; + public EACStreamType StreamType; //Additional info about the stream - public AC_audio_stream_info audio_info; - public AC_video_stream_info video_info; + public SACAudioStreamInfo AudioInfo; + public SACVideoStreamInfo VideoInfo; } // Contains information about an Acinerella video/audio decoder. [StructLayout(LayoutKind.Sequential)] - public struct AC_decoder + public struct SACDecoder { //Pointer on the Acinerella instance - private readonly IntPtr ACInstancePtr; + private readonly IntPtr _ACInstancePtr; //Contains the type of the decoder. - public AC_decoder_type dec_type; + public EACDecoderType DecType; //The timecode of the currently decoded picture in seconds. - public double timecode; + public double Timecode; - public double video_clock; + public double VideoClock; //Contains information about the stream the decoder is attached to. - public AC_stream_info stream_info; + public SACStreamInfo StreamInfo; //The index of the stream the decoder is attached to. - public Int32 stream_index; + public Int32 StreamIndex; //Pointer to the buffer which contains the data. - internal IntPtr buffer; + internal IntPtr Buffer; //Size of the data in the buffer. - public Int32 buffer_size; + public Int32 BufferSize; } // Contains information about an Acinerella package. [StructLayout(LayoutKind.Sequential)] - public struct AC_package + public struct SACPackage { //The stream the package belongs to. - public Int32 stream_index; + public Int32 StreamIndex; } // Callback function used to ask the application to read data. Should return // the number of bytes read or an value smaller than zero if an error occured. //TAc_read_callback = function(sender: Pointer; byte[] buf, int size): integer; cdecl; [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate Int32 AC_read_callback( + public delegate Int32 ACReadCallback( IntPtr sender, IntPtr buf, Int32 size @@ -140,14 +140,14 @@ namespace Vocaluxe.Lib.Video.Acinerella // Callback function used to ask the application to seek. return 0 if succeed , -1 on failure. //TAc_seek_callback = function(sender: Pointer; pos: int64; whence: integer): int64; cdecl; [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate Int64 AC_seek_callback(IntPtr sender, Int64 pos, Int32 whence); + public delegate Int64 ACSeekCallback(IntPtr sender, Int64 pos, Int32 whence); // Callback function that is used to notify the application when the data stream // is opened or closed. For example the file pointer should be resetted to zero // when the "open" function is called. // TAc_openclose_callback = function(sender: Pointer): integer; cdecl; [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate Int32 AC_openclose_callback(IntPtr sender); + public delegate Int32 ACOpencloseCallback(IntPtr sender); public static class CAcinerella { @@ -163,7 +163,7 @@ namespace Vocaluxe.Lib.Video.Acinerella #if ARCH_X64 #if WIN - private const string AcDll = "x64\\acinerella.dll"; + private const string _AcDll = "x64\\acinerella.dll"; #endif #if LINUX @@ -171,7 +171,7 @@ namespace Vocaluxe.Lib.Video.Acinerella #endif #endif - private static readonly Object _lock = new Object(); + private static readonly Object _Lock = new Object(); // Defines the type of an Acinerella media stream. Currently only video and // audio streams are supported, subtitle and data streams will be marked as @@ -179,12 +179,12 @@ namespace Vocaluxe.Lib.Video.Acinerella // Initializes an Acinerella instance. //function ac_init(): PAc_instance; cdecl; external ac_dll; - [DllImport(AcDll, EntryPoint = "ac_init", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)] + [DllImport(_AcDll, EntryPoint = "ac_init", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)] private static extern IntPtr _ac_init(); - public static IntPtr ac_init() + public static IntPtr AcInit() { - lock (_lock) + lock (_Lock) { return _ac_init(); } @@ -192,14 +192,14 @@ namespace Vocaluxe.Lib.Video.Acinerella // Frees an Acinerella instance. //procedure ac_free(inst: PAc_instance); cdecl; external ac_dll; - [DllImport(AcDll, EntryPoint = "ac_free", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)] - private static extern void _ac_free(IntPtr PAc_instance); + [DllImport(_AcDll, EntryPoint = "ac_free", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)] + private static extern void _ac_free(IntPtr pAcInstance); - public static void ac_free(IntPtr PAc_instance) + public static void AcFree(IntPtr pAcInstance) { - lock (_lock) + lock (_Lock) { - _ac_free(PAc_instance); + _ac_free(pAcInstance); } } @@ -248,152 +248,152 @@ namespace Vocaluxe.Lib.Video.Acinerella } }*/ - [DllImport(AcDll, EntryPoint = "ac_open", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)] + [DllImport(_AcDll, EntryPoint = "ac_open", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)] private static extern Int32 _ac_open2( - IntPtr PAc_instance, + IntPtr pAcInstance, string filename ); - public static Int32 ac_open2( - IntPtr PAc_instance, + public static Int32 AcOpen2( + IntPtr pAcInstance, string filename ) { - lock (_lock) + lock (_Lock) { - return _ac_open2(PAc_instance, filename); + return _ac_open2(pAcInstance, filename); } } // Closes an opened media file. //procedure ac_close(inst: PAc_instance);cdecl; external ac_dll; - [DllImport(AcDll, EntryPoint = "ac_close", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)] - private static extern void _ac_close(IntPtr PAc_instance); + [DllImport(_AcDll, EntryPoint = "ac_close", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)] + private static extern void _ac_close(IntPtr pAcInstance); - public static void ac_close(IntPtr PAc_instance) + public static void AcClose(IntPtr pAcInstance) { - lock (_lock) + lock (_Lock) { - _ac_close(PAc_instance); + _ac_close(pAcInstance); } } // Stores information in "pInfo" about stream number "nb". //procedure ac_get_stream_info( //inst: PAc_instance; nb: integer; pinfo: PAc_stream_info); cdecl; external ac_dll; - [DllImport(AcDll, EntryPoint = "ac_get_stream_info", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)] + [DllImport(_AcDll, EntryPoint = "ac_get_stream_info", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)] private static extern void _ac_get_stream_info( - IntPtr PAc_instance, + IntPtr pAcInstance, Int32 nb, - out AC_stream_info Info + out SACStreamInfo info ); - public static void ac_get_stream_info( - IntPtr PAc_instance, + public static void AcGetStreamInfo( + IntPtr pAcInstance, Int32 nb, - out AC_stream_info Info + out SACStreamInfo info ) { - lock (_lock) + lock (_Lock) { _ac_get_stream_info( - PAc_instance, + pAcInstance, nb, - out Info + out info ); } } // Reads a package from an opened media file. //function ac_read_package(inst: PAc_instance): PAc_package; cdecl; external ac_dll; - [DllImport(AcDll, EntryPoint = "ac_read_package", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)] + [DllImport(_AcDll, EntryPoint = "ac_read_package", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)] public static extern IntPtr ac_read_package(IntPtr inst); // Frees a package that has been read. //procedure ac_free_package(package: PAc_package); cdecl; external ac_dll; - [DllImport(AcDll, EntryPoint = "ac_free_package", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)] - public static extern void ac_free_package(IntPtr PAc_package); + [DllImport(_AcDll, EntryPoint = "ac_free_package", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)] + public static extern void ac_free_package(IntPtr pAcPackage); - [DllImport(AcDll, EntryPoint = "ac_create_video_decoder", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)] - private static extern IntPtr _ac_create_video_decoder(IntPtr PAc_instance); + [DllImport(_AcDll, EntryPoint = "ac_create_video_decoder", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)] + private static extern IntPtr _ac_create_video_decoder(IntPtr pAcInstance); - public static IntPtr ac_create_video_decoder(IntPtr PAc_instance) + public static IntPtr AcCreateVideoDecoder(IntPtr pAcInstance) { - lock (_lock) + lock (_Lock) { - return _ac_create_video_decoder(PAc_instance); + return _ac_create_video_decoder(pAcInstance); } } - [DllImport(AcDll, EntryPoint = "ac_create_audio_decoder", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)] - private static extern IntPtr _ac_create_audio_decoder(IntPtr PAc_instance); + [DllImport(_AcDll, EntryPoint = "ac_create_audio_decoder", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)] + private static extern IntPtr _ac_create_audio_decoder(IntPtr pAcInstance); - public static IntPtr ac_create_audio_decoder(IntPtr PAc_instance) + public static IntPtr AcCreateAudioDecoder(IntPtr pAcInstance) { - lock (_lock) + lock (_Lock) { - return _ac_create_audio_decoder(PAc_instance); + return _ac_create_audio_decoder(pAcInstance); } } // Frees an created decoder. //procedure ac_free_decoder(pDecoder: PAc_decoder); cdecl; external ac_dll; - [DllImport(AcDll, EntryPoint = "ac_free_decoder", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)] - private static extern void _ac_free_decoder(IntPtr PAc_decoder); + [DllImport(_AcDll, EntryPoint = "ac_free_decoder", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)] + private static extern void _ac_free_decoder(IntPtr pAcDecoder); - public static void ac_free_decoder(IntPtr PAc_decoder) + public static void AcFreeDecoder(IntPtr pAcDecoder) { - lock (_lock) + lock (_Lock) { - _ac_free_decoder(PAc_decoder); + _ac_free_decoder(pAcDecoder); } } // Decodes a package using the specified decoder. The decodec data is stored in the // "buffer" property of the decoder. //function ac_decode_package(pPackage: PAc_package; pDecoder: PAc_decoder): integer; cdecl; external ac_dll; - [DllImport(AcDll, EntryPoint = "ac_decode_package", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)] - private static extern Int32 _ac_decode_package(IntPtr PAc_package, IntPtr PAc_decoder); + [DllImport(_AcDll, EntryPoint = "ac_decode_package", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)] + private static extern Int32 _ac_decode_package(IntPtr pAcPackage, IntPtr pAcDecoder); - public static Int32 ac_decode_package(IntPtr PAc_package, IntPtr PAc_decoder) + public static Int32 AcDecodePackage(IntPtr pAcPackage, IntPtr pAcDecoder) { - lock (_lock) + lock (_Lock) { - return _ac_decode_package(PAc_package, PAc_decoder); + return _ac_decode_package(pAcPackage, pAcDecoder); } } - [DllImport(AcDll, EntryPoint = "ac_get_audio_frame", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)] - private static extern Int32 _ac_get_audio_frame(IntPtr PAcInstance, IntPtr PAc_decoder); + [DllImport(_AcDll, EntryPoint = "ac_get_audio_frame", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)] + private static extern Int32 _ac_get_audio_frame(IntPtr pAcInstance, IntPtr pAcDecoder); - public static Int32 ac_get_audio_frame(IntPtr PAcInstance, IntPtr PAc_decoder) + public static Int32 AcGetAudioFrame(IntPtr pAcInstance, IntPtr pAcDecoder) { - lock (_lock) + lock (_Lock) { - return _ac_get_audio_frame(PAcInstance, PAc_decoder); + return _ac_get_audio_frame(pAcInstance, pAcDecoder); } } - [DllImport(AcDll, EntryPoint = "ac_get_frame", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)] - private static extern Int32 _ac_get_frame(IntPtr PAcInstance, IntPtr PAc_decoder); + [DllImport(_AcDll, EntryPoint = "ac_get_frame", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)] + private static extern Int32 _ac_get_frame(IntPtr pAcInstance, IntPtr pAcDecoder); - public static Int32 ac_get_frame(IntPtr PAcInstance, IntPtr PAc_decoder) + public static Int32 AcGetFrame(IntPtr pAcInstance, IntPtr pAcDecoder) { - lock (_lock) + lock (_Lock) { - return _ac_get_frame(PAcInstance, PAc_decoder); + return _ac_get_frame(pAcInstance, pAcDecoder); } } - [DllImport(AcDll, EntryPoint = "ac_skip_frames", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)] - private static extern Int32 _ac_skip_frames(IntPtr PAcInstance, IntPtr PAc_decoder, Int32 num); + [DllImport(_AcDll, EntryPoint = "ac_skip_frames", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)] + private static extern Int32 _ac_skip_frames(IntPtr pAcInstance, IntPtr pAcDecoder, Int32 num); - public static Int32 ac_skip_frames(IntPtr PAcInstance, IntPtr PAc_decoder, Int32 num) + public static Int32 AcSkipFrames(IntPtr pAcInstance, IntPtr pAcDecoder, Int32 num) { - lock (_lock) + lock (_Lock) { - return _ac_skip_frames(PAcInstance, PAc_decoder, num); + return _ac_skip_frames(pAcInstance, pAcDecoder, num); } } @@ -402,25 +402,25 @@ namespace Vocaluxe.Lib.Video.Acinerella // The parameter "dir" specifies the seek direction: 0 for forward, -1 for backward. // The target_pos paremeter is in milliseconds. Returns 1 if the functions succeded.} //function ac_seek(pDecoder: PAc_decoder; dir: integer; target_pos: int64): integer; cdecl; external ac_dll; - [DllImport(AcDll, EntryPoint = "ac_seek", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)] - private static extern Int32 _ac_seek(IntPtr PAc_decoder, Int32 dir, Int64 target_pos); + [DllImport(_AcDll, EntryPoint = "ac_seek", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)] + private static extern Int32 _ac_seek(IntPtr pAcDecoder, Int32 dir, Int64 targetPos); - public static Int32 ac_seek(IntPtr PAc_decoder, Int32 dir, Int64 target_pos) + public static Int32 AcSeek(IntPtr pAcDecoder, Int32 dir, Int64 targetPos) { - lock (_lock) + lock (_Lock) { - return _ac_seek(PAc_decoder, dir, target_pos); + return _ac_seek(pAcDecoder, dir, targetPos); } } //function ac_probe_input_buffer(buf: PChar; bufsize: Integer; filename: PChar; //var score_max: Integer): PAc_proberesult; cdecl; external ac_dll; - [DllImport(AcDll, EntryPoint = "ac_probe_input_buffer", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)] + [DllImport(_AcDll, EntryPoint = "ac_probe_input_buffer", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)] public static extern IntPtr ac_probe_input_buffer( IntPtr buf, Int32 bufsize, IntPtr filename, - out Int32 score_max + out Int32 scoreMax ); } } \ No newline at end of file diff --git a/Vocaluxe/Lib/Video/CVideoDecoder.cs b/Vocaluxe/Lib/Video/CVideoDecoder.cs index 98a0cec4..9956ee48 100644 --- a/Vocaluxe/Lib/Video/CVideoDecoder.cs +++ b/Vocaluxe/Lib/Video/CVideoDecoder.cs @@ -5,12 +5,12 @@ namespace Vocaluxe.Lib.Video { abstract class CVideoDecoder : IVideoDecoder { - protected List _Streams = new List(); + protected List _Streams = new List(); protected bool _Initialized = false; public virtual bool Init() { - _Streams = new List(); + _Streams = new List(); _Initialized = true; return true; @@ -23,59 +23,59 @@ namespace Vocaluxe.Lib.Video return _Streams.Count; } - public virtual int Load(string VideoFileName) + public virtual int Load(string videoFileName) { return 0; } - public virtual bool Close(int StreamID) + public virtual bool Close(int streamID) { return true; } - public virtual float GetLength(int StreamID) + public virtual float GetLength(int streamID) { return 0f; } - public virtual bool GetFrame(int StreamID, ref STexture Frame, float Time, ref float VideoTime) + public virtual bool GetFrame(int streamID, ref STexture frame, float time, ref float videoTime) { return true; } - public virtual bool Skip(int StreamID, float Start, float Gap) + public virtual bool Skip(int streamID, float start, float gap) { return true; } - public virtual void SetLoop(int StreamID, bool Loop) {} + public virtual void SetLoop(int streamID, bool loop) {} - public virtual void Pause(int StreamID) {} + public virtual void Pause(int streamID) {} - public virtual void Resume(int StreamID) {} + public virtual void Resume(int streamID) {} - public virtual bool Finished(int StreamID) + public virtual bool Finished(int streamID) { return false; } public virtual void Update() {} - protected bool AlreadyAdded(int StreamID) + protected bool _AlreadyAdded(int streamID) { - foreach (VideoStreams st in _Streams) + foreach (SVideoStreams st in _Streams) { - if (st.handle == StreamID) + if (st.Handle == streamID) return true; } return false; } - protected int GetStreamIndex(int StreamID) + protected int _GetStreamIndex(int streamID) { for (int i = 0; i < _Streams.Count; i++) { - if (_Streams[i].handle == StreamID) + if (_Streams[i].Handle == streamID) return i; } return -1; diff --git a/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs b/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs index 9d867a56..faf7fa14 100644 --- a/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs +++ b/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs @@ -10,19 +10,19 @@ using VocaluxeLib.Menu; namespace Vocaluxe.Lib.Video { - delegate void CLOSEPROC(int StreamID); + delegate void Closeproc(int streamID); class CVideoDecoderFFmpeg : CVideoDecoder { - private readonly List _Decoder = new List(); - private CLOSEPROC closeproc; + private readonly List _Decoder = new List(); + private Closeproc _Closeproc; private int _Count = 1; - private readonly Object MutexDecoder = new Object(); + private readonly Object _MutexDecoder = new Object(); public override bool Init() { - closeproc = close_proc; + _Closeproc = _CloseProc; CloseAll(); return base.Init(); @@ -30,41 +30,41 @@ namespace Vocaluxe.Lib.Video public override void CloseAll() { - lock (MutexDecoder) + lock (_MutexDecoder) { for (int i = 0; i < _Decoder.Count; i++) - _Decoder[i].Free(closeproc, i + 1); + _Decoder[i].Free(_Closeproc, i + 1); } } - public override int Load(string VideoFileName) + public override int Load(string videoFileName) { - VideoStreams stream = new VideoStreams(0); - Decoder decoder = new Decoder(); + SVideoStreams stream = new SVideoStreams(0); + CDecoder decoder = new CDecoder(); - if (decoder.Open(VideoFileName)) + if (decoder.Open(videoFileName)) { - lock (MutexDecoder) + lock (_MutexDecoder) { _Decoder.Add(decoder); - stream.handle = _Count++; - stream.file = VideoFileName; + stream.Handle = _Count++; + stream.File = videoFileName; _Streams.Add(stream); - return stream.handle; + return stream.Handle; } } return -1; } - public override bool Close(int StreamID) + public override bool Close(int streamID) { if (_Initialized) { - lock (MutexDecoder) + lock (_MutexDecoder) { - if (AlreadyAdded(StreamID)) + if (_AlreadyAdded(streamID)) { - _Decoder[GetStreamIndex(StreamID)].Free(closeproc, StreamID); + _Decoder[_GetStreamIndex(streamID)].Free(_Closeproc, streamID); return true; } } @@ -72,105 +72,105 @@ namespace Vocaluxe.Lib.Video return false; } - public override bool GetFrame(int StreamID, ref STexture Frame, float Time, ref float VideoTime) + public override bool GetFrame(int streamID, ref STexture frame, float time, ref float videoTime) { if (_Initialized) { - lock (MutexDecoder) + lock (_MutexDecoder) { - if (AlreadyAdded(StreamID)) - return _Decoder[GetStreamIndex(StreamID)].GetFrame(ref Frame, Time, ref VideoTime); + if (_AlreadyAdded(streamID)) + return _Decoder[_GetStreamIndex(streamID)].GetFrame(ref frame, time, ref videoTime); } } return false; } - public override float GetLength(int StreamID) + public override float GetLength(int streamID) { if (_Initialized) { - lock (MutexDecoder) + lock (_MutexDecoder) { - if (AlreadyAdded(StreamID)) - return _Decoder[GetStreamIndex(StreamID)].Length; + if (_AlreadyAdded(streamID)) + return _Decoder[_GetStreamIndex(streamID)].Length; } } return 0f; } - public override bool Skip(int StreamID, float Start, float Gap) + public override bool Skip(int streamID, float start, float gap) { if (_Initialized) { - lock (MutexDecoder) + lock (_MutexDecoder) { - if (AlreadyAdded(StreamID)) - return _Decoder[GetStreamIndex(StreamID)].Skip(Start, Gap); + if (_AlreadyAdded(streamID)) + return _Decoder[_GetStreamIndex(streamID)].Skip(start, gap); } } return false; } - public override void SetLoop(int StreamID, bool Loop) + public override void SetLoop(int streamID, bool loop) { if (_Initialized) { - lock (MutexDecoder) + lock (_MutexDecoder) { - if (AlreadyAdded(StreamID)) - _Decoder[GetStreamIndex(StreamID)].Loop = Loop; + if (_AlreadyAdded(streamID)) + _Decoder[_GetStreamIndex(streamID)].Loop = loop; } } } - public override void Pause(int StreamID) + public override void Pause(int streamID) { if (_Initialized) { - lock (MutexDecoder) + lock (_MutexDecoder) { - if (AlreadyAdded(StreamID)) - _Decoder[GetStreamIndex(StreamID)].Paused = true; + if (_AlreadyAdded(streamID)) + _Decoder[_GetStreamIndex(streamID)].Paused = true; } } } - public override void Resume(int StreamID) + public override void Resume(int streamID) { if (_Initialized) { - lock (MutexDecoder) + lock (_MutexDecoder) { - if (AlreadyAdded(StreamID)) - _Decoder[GetStreamIndex(StreamID)].Paused = false; + if (_AlreadyAdded(streamID)) + _Decoder[_GetStreamIndex(streamID)].Paused = false; } } } - public override bool Finished(int StreamID) + public override bool Finished(int streamID) { if (_Initialized) { - lock (MutexDecoder) + lock (_MutexDecoder) { - if (AlreadyAdded(StreamID)) - return _Decoder[GetStreamIndex(StreamID)].Finished; + if (_AlreadyAdded(streamID)) + return _Decoder[_GetStreamIndex(streamID)].Finished; } } return true; } - private void close_proc(int StreamID) + private void _CloseProc(int streamID) { if (_Initialized) { - lock (MutexDecoder) + lock (_MutexDecoder) { - if (AlreadyAdded(StreamID)) + if (_AlreadyAdded(streamID)) { - int Index = GetStreamIndex(StreamID); - _Decoder.RemoveAt(Index); - _Streams.RemoveAt(Index); + int index = _GetStreamIndex(streamID); + _Decoder.RemoveAt(index); + _Streams.RemoveAt(index); } } } @@ -179,18 +179,18 @@ namespace Vocaluxe.Lib.Video struct SFrameBuffer { - public byte[] data; - public float time; - public bool displayed; + public byte[] Data; + public float Time; + public bool Displayed; } - class Decoder : IDisposable + class CDecoder : IDisposable { - private IntPtr _instance = IntPtr.Zero; // acinerella instance - private IntPtr _videodecoder = IntPtr.Zero; // acinerella video decoder instance + private IntPtr _Instance = IntPtr.Zero; // acinerella instance + private IntPtr _Videodecoder = IntPtr.Zero; // acinerella video decoder instance private readonly Stopwatch _LoopTimer = new Stopwatch(); - private CLOSEPROC _Closeproc; // delegate for stream closing + private Closeproc _Closeproc; // delegate for stream closing private int _StreamID; // stream ID for stream closing private string _FileName; // current video file name @@ -201,7 +201,7 @@ namespace Vocaluxe.Lib.Video private float _CurrentVideoTime; // current video position private bool _BufferFull; // buffer is full, waiting for free frame slot - private bool _skip; // do skip + private bool _Skip; // do skip private float _Time; private float _Gap; private float _Start; @@ -222,25 +222,25 @@ namespace Vocaluxe.Lib.Video private float _SetStart; private bool _SetLoop; private bool _SetSkip; - private bool _terminated; + private bool _Terminated; - private readonly Thread _thread; + private readonly Thread _Thread; //AutoResetEvent EventDecode = new AutoResetEvent(false); private readonly SFrameBuffer[] _FrameBuffer = new SFrameBuffer[5]; private bool _NewFrame; - private readonly Object MutexFramebuffer = new Object(); - private readonly Object MutexSyncSignals = new Object(); + private readonly Object _MutexFramebuffer = new Object(); + private readonly Object _MutexSyncSignals = new Object(); - public Decoder() + public CDecoder() { - _thread = new Thread(Execute); + _Thread = new Thread(_Execute); } - public void Free(CLOSEPROC close_proc, int StreamID) + public void Free(Closeproc closeProc, int streamID) { - _Closeproc = close_proc; - _StreamID = StreamID; - _terminated = true; + _Closeproc = closeProc; + _StreamID = streamID; + _Terminated = true; } public float Length @@ -259,7 +259,7 @@ namespace Vocaluxe.Lib.Video get { return _Paused; } set { - lock (MutexSyncSignals) + lock (_MutexSyncSignals) { _Paused = value; if (_Paused) @@ -281,22 +281,22 @@ namespace Vocaluxe.Lib.Video get { return _Finished; } } - public bool Open(string FileName) + public bool Open(string fileName) { if (_FileOpened) return false; - if (!File.Exists(FileName)) + if (!File.Exists(fileName)) return false; - _FileName = FileName; - _thread.Priority = ThreadPriority.Normal; - _thread.Name = Path.GetFileName(FileName); - _thread.Start(); + _FileName = fileName; + _Thread.Priority = ThreadPriority.Normal; + _Thread.Name = Path.GetFileName(fileName); + _Thread.Start(); return true; } - public bool GetFrame(ref STexture frame, float Time, ref float VideoTime) + public bool GetFrame(ref STexture frame, float time, ref float videoTime) { if (!_FileOpened) return false; @@ -306,10 +306,10 @@ namespace Vocaluxe.Lib.Video if (_SetLoop) { - lock (MutexSyncSignals) + lock (_MutexSyncSignals) { _SetTime += _LoopTimer.ElapsedMilliseconds / 1000f; - VideoTime = _SetTime; + videoTime = _SetTime; _LoopTimer.Stop(); _LoopTimer.Reset(); @@ -317,31 +317,31 @@ namespace Vocaluxe.Lib.Video } - UploadNewFrame(ref frame); + _UploadNewFrame(ref frame); //EventDecode.Set(); return true; } - if (_SetTime != Time) + if (_SetTime != time) { - lock (MutexSyncSignals) + lock (_MutexSyncSignals) { - _SetTime = Time; + _SetTime = time; } - UploadNewFrame(ref frame); - VideoTime = _CurrentVideoTime; + _UploadNewFrame(ref frame); + videoTime = _CurrentVideoTime; //EventDecode.Set(); return true; } return false; } - public bool Skip(float Start, float Gap) + public bool Skip(float start, float gap) { - lock (MutexSyncSignals) + lock (_MutexSyncSignals) { - _SetStart = Start; - _SetGap = Gap; + _SetStart = start; + _SetGap = gap; _SetSkip = true; _NoMoreFrames = false; _Finished = false; @@ -351,7 +351,7 @@ namespace Vocaluxe.Lib.Video } #region Threading - private void DoSkip() + private void _DoSkip() { if (!_FileOpened) return; @@ -365,7 +365,7 @@ namespace Vocaluxe.Lib.Video _VideoDecoderTime = _SkipTime; try { - CAcinerella.ac_seek(_videodecoder, -1, (Int64)(_SkipTime * 1000f)); + CAcinerella.AcSeek(_Videodecoder, -1, (Int64)(_SkipTime * 1000f)); } catch (Exception e) { @@ -377,7 +377,7 @@ namespace Vocaluxe.Lib.Video _VideoDecoderTime = 0f; try { - CAcinerella.ac_seek(_videodecoder, -1, 0); + CAcinerella.AcSeek(_Videodecoder, -1, 0); } catch (Exception e) { @@ -385,39 +385,39 @@ namespace Vocaluxe.Lib.Video } } - lock (MutexSyncSignals) + lock (_MutexSyncSignals) { _CurrentVideoTime = _VideoDecoderTime; } - lock (MutexFramebuffer) + lock (_MutexFramebuffer) { for (int i = 0; i < _FrameBuffer.Length; i++) { - _FrameBuffer[i].displayed = true; - _FrameBuffer[i].time = -1f; + _FrameBuffer[i].Displayed = true; + _FrameBuffer[i].Time = -1f; } } _BufferFull = false; - _skip = false; + _Skip = false; _NewFrame = false; //EventDecode.Set(); } - private void Execute() + private void _Execute() { - DoOpen(); + _DoOpen(); //EventDecode.Set(); - while (!_terminated) + while (!_Terminated) { { //if (EventDecode.WaitOne(10)) - lock (MutexSyncSignals) + lock (_MutexSyncSignals) { _Time = _SetTime; if (_SetSkip) - _skip = true; + _Skip = true; _SetSkip = false; _Gap = _SetGap; @@ -425,32 +425,32 @@ namespace Vocaluxe.Lib.Video _Loop = _SetLoop; } - if (_skip) - DoSkip(); + if (_Skip) + _DoSkip(); if (!_NewFrame) - DoDecode(); + _DoDecode(); if (_NewFrame) - Copy(); + _Copy(); Thread.Sleep(1); } } - DoFree(); + _DoFree(); } - private void DoOpen() + private void _DoOpen() { bool ok = false; - AC_instance Instance = new AC_instance(); + SACInstance instance = new SACInstance(); try { - _instance = CAcinerella.ac_init(); - CAcinerella.ac_open2(_instance, _FileName); + _Instance = CAcinerella.AcInit(); + CAcinerella.AcOpen2(_Instance, _FileName); - Instance = (AC_instance)Marshal.PtrToStructure(_instance, typeof(AC_instance)); - ok = Instance.opened; + instance = (SACInstance)Marshal.PtrToStructure(_Instance, typeof(SACInstance)); + ok = instance.Opened; } catch (Exception) { @@ -459,21 +459,21 @@ namespace Vocaluxe.Lib.Video } - if (!Instance.opened || !ok) + if (!instance.Opened || !ok) { //Free(); return; } - _Duration = Instance.info.duration / 1000f; + _Duration = instance.Info.Duration / 1000f; - int VideoStreamIndex = -1; - AC_decoder Videodecoder; + int videoStreamIndex = -1; + SACDecoder videodecoder; try { - _videodecoder = CAcinerella.ac_create_video_decoder(_instance); - Videodecoder = (AC_decoder)Marshal.PtrToStructure(_videodecoder, typeof(AC_decoder)); - VideoStreamIndex = Videodecoder.stream_index; + _Videodecoder = CAcinerella.AcCreateVideoDecoder(_Instance); + videodecoder = (SACDecoder)Marshal.PtrToStructure(_Videodecoder, typeof(SACDecoder)); + videoStreamIndex = videodecoder.StreamIndex; } catch (Exception) { @@ -482,33 +482,33 @@ namespace Vocaluxe.Lib.Video } - if (VideoStreamIndex < 0) + if (videoStreamIndex < 0) { //Free(); return; } - _Width = Videodecoder.stream_info.video_info.frame_width; - _Height = Videodecoder.stream_info.video_info.frame_height; + _Width = videodecoder.StreamInfo.VideoInfo.FrameWidth; + _Height = videodecoder.StreamInfo.VideoInfo.FrameHeight; - if (Videodecoder.stream_info.video_info.frames_per_second > 0) - _VideoTimeBase = 1f / (float)Videodecoder.stream_info.video_info.frames_per_second; + if (videodecoder.StreamInfo.VideoInfo.FramesPerSecond > 0) + _VideoTimeBase = 1f / (float)videodecoder.StreamInfo.VideoInfo.FramesPerSecond; _VideoDecoderTime = 0f; _Time = 0f; for (int i = 0; i < _FrameBuffer.Length; i++) { - _FrameBuffer[i].time = -1f; - _FrameBuffer[i].displayed = true; - _FrameBuffer[i].data = new byte[_Width * _Height * 4]; + _FrameBuffer[i].Time = -1f; + _FrameBuffer[i].Displayed = true; + _FrameBuffer[i].Data = new byte[_Width * _Height * 4]; } _FileOpened = true; } - private void DoDecode() + private void _DoDecode() { - const int FRAMEDROPCOUNT = 4; + const int framedropcount = 4; if (!_FileOpened || _NewFrame) return; @@ -520,21 +520,21 @@ namespace Vocaluxe.Lib.Video _SkipTime = 0f; float myTime = _Time + _VideoSkipTime; - float TimeDifference = myTime - _VideoDecoderTime; + float timeDifference = myTime - _VideoDecoderTime; - bool DropFrame = false; - if (TimeDifference >= (FRAMEDROPCOUNT - 1) * _VideoTimeBase) - DropFrame = true; + bool dropFrame = false; + if (timeDifference >= (framedropcount - 1) * _VideoTimeBase) + dropFrame = true; - if (_terminated) + if (_Terminated) return; - int FrameFinished = 0; - if (DropFrame && !_BeforeLoop) + int frameFinished = 0; + if (dropFrame && !_BeforeLoop) { try { - FrameFinished = CAcinerella.ac_skip_frames(_instance, _videodecoder, FRAMEDROPCOUNT - 1); + frameFinished = CAcinerella.AcSkipFrames(_Instance, _Videodecoder, framedropcount - 1); } catch (Exception) { @@ -542,11 +542,11 @@ namespace Vocaluxe.Lib.Video } } - if (!_BeforeLoop && (!DropFrame || FrameFinished != 0)) + if (!_BeforeLoop && (!dropFrame || frameFinished != 0)) { try { - FrameFinished = CAcinerella.ac_get_frame(_instance, _videodecoder); + frameFinished = CAcinerella.AcGetFrame(_Instance, _Videodecoder); } catch (Exception) { @@ -554,7 +554,7 @@ namespace Vocaluxe.Lib.Video } } - if (FrameFinished == 0) + if (frameFinished == 0) { if (_Loop) { @@ -562,32 +562,32 @@ namespace Vocaluxe.Lib.Video bool doskip = true; float tm = 0f; int num = -1; - lock (MutexFramebuffer) + lock (_MutexFramebuffer) { for (int i = 0; i < _FrameBuffer.Length; i++) { - if (_FrameBuffer[i].time > tm && !_FrameBuffer[i].displayed) + if (_FrameBuffer[i].Time > tm && !_FrameBuffer[i].Displayed) { - tm = _FrameBuffer[i].time; + tm = _FrameBuffer[i].Time; num = i; } } if (num >= 0) - doskip = _FrameBuffer[num].displayed; + doskip = _FrameBuffer[num].Displayed; } if (!doskip) return; - lock (MutexSyncSignals) + lock (_MutexSyncSignals) { _Start = 0f; _Gap = 0f; _SetTime = 0f; } - DoSkip(); + _DoSkip(); } else _NoMoreFrames = true; @@ -596,22 +596,22 @@ namespace Vocaluxe.Lib.Video else { _NewFrame = true; - Copy(); + _Copy(); } } - private void Copy() + private void _Copy() { if (!_NewFrame) return; int num = -1; - lock (MutexFramebuffer) + lock (_MutexFramebuffer) { for (int i = 0; i < _FrameBuffer.Length; i++) { - if (_FrameBuffer[i].displayed) + if (_FrameBuffer[i].Displayed) { num = i; break; @@ -622,22 +622,22 @@ namespace Vocaluxe.Lib.Video _BufferFull = true; else { - AC_decoder Videodecoder = (AC_decoder)Marshal.PtrToStructure(_videodecoder, typeof(AC_decoder)); + SACDecoder videodecoder = (SACDecoder)Marshal.PtrToStructure(_Videodecoder, typeof(SACDecoder)); - _VideoDecoderTime = (float)Videodecoder.timecode; - _FrameBuffer[num].time = _VideoDecoderTime; + _VideoDecoderTime = (float)videodecoder.Timecode; + _FrameBuffer[num].Time = _VideoDecoderTime; - if (Videodecoder.buffer != IntPtr.Zero) + if (videodecoder.Buffer != IntPtr.Zero) { - Marshal.Copy(Videodecoder.buffer, _FrameBuffer[num].data, 0, _Width * _Height * 4); + Marshal.Copy(videodecoder.Buffer, _FrameBuffer[num].Data, 0, _Width * _Height * 4); - _FrameBuffer[num].displayed = false; + _FrameBuffer[num].Displayed = false; } int numfull = 0; for (int i = 0; i < _FrameBuffer.Length; i++) { - if (!_FrameBuffer[i].displayed) + if (!_FrameBuffer[i].Displayed) numfull++; } @@ -649,28 +649,28 @@ namespace Vocaluxe.Lib.Video } } - private void UploadNewFrame(ref STexture frame) + private void _UploadNewFrame(ref STexture frame) { if (!_FileOpened) return; - lock (MutexFramebuffer) + lock (_MutexFramebuffer) { - int num = FindFrame(); + int num = _FindFrame(); if (num >= 0) { - if (frame.index == -1 || _Width != frame.width || _Height != frame.height) + if (frame.Index == -1 || _Width != frame.Width || _Height != frame.Height) { CDraw.RemoveTexture(ref frame); - frame = CDraw.AddTexture(_Width, _Height, ref _FrameBuffer[num].data); + frame = CDraw.AddTexture(_Width, _Height, ref _FrameBuffer[num].Data); } else - CDraw.UpdateTexture(ref frame, ref _FrameBuffer[num].data); + CDraw.UpdateTexture(ref frame, ref _FrameBuffer[num].Data); - lock (MutexSyncSignals) + lock (_MutexSyncSignals) { - _CurrentVideoTime = _FrameBuffer[num].time; + _CurrentVideoTime = _FrameBuffer[num].Time; } _Finished = false; } @@ -682,44 +682,44 @@ namespace Vocaluxe.Lib.Video } } - private int FindFrame() + private int _FindFrame() { - int Result = -1; + int result = -1; float diff = 10000000f; for (int i = 0; i < _FrameBuffer.Length; i++) { - float td = _SetTime + _VideoSkipTime - _FrameBuffer[i].time; + float td = _SetTime + _VideoSkipTime - _FrameBuffer[i].Time; if (td > _VideoTimeBase * 2f) - _FrameBuffer[i].displayed = true; + _FrameBuffer[i].Displayed = true; - if (!_FrameBuffer[i].displayed && (td < diff) && (td > _VideoTimeBase)) + if (!_FrameBuffer[i].Displayed && (td < diff) && (td > _VideoTimeBase)) { - diff = Math.Abs(_FrameBuffer[i].time - _SetTime - _VideoSkipTime); - Result = i; + diff = Math.Abs(_FrameBuffer[i].Time - _SetTime - _VideoSkipTime); + result = i; } } - if (Result != -1) + if (result != -1) { - _FrameBuffer[Result].displayed = true; + _FrameBuffer[result].Displayed = true; _BufferFull = false; } - return Result; + return result; } - private void DoFree() + private void _DoFree() { - if (_videodecoder != IntPtr.Zero) - CAcinerella.ac_free_decoder(_videodecoder); + if (_Videodecoder != IntPtr.Zero) + CAcinerella.AcFreeDecoder(_Videodecoder); - if (_instance != IntPtr.Zero) - CAcinerella.ac_close(_instance); + if (_Instance != IntPtr.Zero) + CAcinerella.AcClose(_Instance); - if (_instance != IntPtr.Zero) - CAcinerella.ac_free(_instance); + if (_Instance != IntPtr.Zero) + CAcinerella.AcFree(_Instance); _Closeproc(_StreamID); } diff --git a/Vocaluxe/Lib/Video/CVideoDecoderGstreamer.cs b/Vocaluxe/Lib/Video/CVideoDecoderGstreamer.cs index 2337878a..079229d5 100644 --- a/Vocaluxe/Lib/Video/CVideoDecoderGstreamer.cs +++ b/Vocaluxe/Lib/Video/CVideoDecoderGstreamer.cs @@ -10,7 +10,7 @@ namespace Vocaluxe.Lib.Video #region log public CGstreamerVideoWrapper.LogCallback Log; - private void LogHandler(string text) + private void _LogHandler(string text) { CLog.LogError(text); } @@ -19,7 +19,7 @@ namespace Vocaluxe.Lib.Video public bool Init() { bool retval = CGstreamerVideoWrapper.InitVideo(); - Log = LogHandler; + Log = _LogHandler; //Really needed? CodeAnalysis complains //GC.SuppressFinalize(Log); CGstreamerVideoWrapper.SetVideoLogCallback(Log); @@ -31,12 +31,12 @@ namespace Vocaluxe.Lib.Video CGstreamerVideoWrapper.CloseAllVideos(); } - public int Load(string VideoFileName) + public int Load(string videoFileName) { int i = -1; try { - Uri u = new Uri(VideoFileName); + Uri u = new Uri(videoFileName); i = CGstreamerVideoWrapper.LoadVideo(u.AbsoluteUri); return i; } @@ -44,9 +44,9 @@ namespace Vocaluxe.Lib.Video return i; } - public bool Close(int StreamID) + public bool Close(int streamID) { - return CGstreamerVideoWrapper.CloseVideo(StreamID); + return CGstreamerVideoWrapper.CloseVideo(streamID); } public int GetNumStreams() @@ -54,43 +54,43 @@ namespace Vocaluxe.Lib.Video return CGstreamerVideoWrapper.GetVideoNumStreams(); } - public float GetLength(int StreamID) + public float GetLength(int streamID) { - return CGstreamerVideoWrapper.GetVideoLength(StreamID); + return CGstreamerVideoWrapper.GetVideoLength(streamID); } - public bool GetFrame(int StreamID, ref STexture Frame, float Time, ref float VideoTime) + public bool GetFrame(int streamID, ref STexture frame, float time, ref float videoTime) { - ManagedFrame managedFrame = CGstreamerVideoWrapper.GetFrame(StreamID, Time); - VideoTime = managedFrame.Videotime; + SManagedFrame managedFrame = CGstreamerVideoWrapper.GetFrame(streamID, time); + videoTime = managedFrame.Videotime; - UploadNewFrame(ref Frame, ref managedFrame.buffer, managedFrame.Width, managedFrame.Height); + _UploadNewFrame(ref frame, ref managedFrame.Buffer, managedFrame.Width, managedFrame.Height); return true; } - public bool Skip(int StreamID, float Start, float Gap) + public bool Skip(int streamID, float start, float gap) { - return CGstreamerVideoWrapper.Skip(StreamID, Start, Gap); + return CGstreamerVideoWrapper.Skip(streamID, start, gap); } - public void SetLoop(int StreamID, bool Loop) + public void SetLoop(int streamID, bool loop) { - CGstreamerVideoWrapper.SetVideoLoop(StreamID, Loop); + CGstreamerVideoWrapper.SetVideoLoop(streamID, loop); } - public void Pause(int StreamID) + public void Pause(int streamID) { - CGstreamerVideoWrapper.PauseVideo(StreamID); + CGstreamerVideoWrapper.PauseVideo(streamID); } - public void Resume(int StreamID) + public void Resume(int streamID) { - CGstreamerVideoWrapper.ResumeVideo(StreamID); + CGstreamerVideoWrapper.ResumeVideo(streamID); } - public bool Finished(int StreamID) + public bool Finished(int streamID) { - return CGstreamerVideoWrapper.Finished(StreamID); + return CGstreamerVideoWrapper.Finished(streamID); } public void Update() @@ -98,18 +98,18 @@ namespace Vocaluxe.Lib.Video CGstreamerVideoWrapper.UpdateVideo(); } - private void UploadNewFrame(ref STexture frame, ref byte[] Data, int Width, int Height) + private void _UploadNewFrame(ref STexture frame, ref byte[] data, int width, int height) { - if (Data != null) + if (data != null) { - if (frame.index == -1 || Width != frame.width || Height != frame.height || Data.Length == 0) + if (frame.Index == -1 || width != frame.Width || height != frame.Height || data.Length == 0) { CDraw.RemoveTexture(ref frame); - frame = CDraw.AddTexture(Width, Height, ref Data); + frame = CDraw.AddTexture(width, height, ref data); } else - CDraw.UpdateTexture(ref frame, ref Data); - Data = null; + CDraw.UpdateTexture(ref frame, ref data); + data = null; } } } diff --git a/Vocaluxe/Lib/Video/Gstreamer/CGstreamerVideoWrapper.cs b/Vocaluxe/Lib/Video/Gstreamer/CGstreamerVideoWrapper.cs index 7d781f33..02924974 100644 --- a/Vocaluxe/Lib/Video/Gstreamer/CGstreamerVideoWrapper.cs +++ b/Vocaluxe/Lib/Video/Gstreamer/CGstreamerVideoWrapper.cs @@ -3,18 +3,18 @@ using System.Runtime.InteropServices; namespace Vocaluxe.Lib.Video.Gstreamer { - public struct NativeFrame + public struct SNativeFrame { - internal IntPtr buffer; + internal IntPtr Buffer; public int Size; public int Width; public int Height; public float Videotime; } - public struct ManagedFrame + public struct SManagedFrame { - public byte[] buffer; + public byte[] Buffer; public int Size; public int Width; public int Height; @@ -32,7 +32,7 @@ namespace Vocaluxe.Lib.Video.Gstreamer #if ARCH_X64 #if WIN - private const string Dll = "x64\\gstreamer\\gstreamerhelper.dll"; + private const string _Dll = "x64\\gstreamer\\gstreamerhelper.dll"; #endif #endif #endregion arch @@ -40,46 +40,46 @@ namespace Vocaluxe.Lib.Video.Gstreamer [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void LogCallback(string message); - [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)] + [DllImport(_Dll, CallingConvention = CallingConvention.Cdecl)] public static extern void SetVideoLogCallback(LogCallback c); - [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)] + [DllImport(_Dll, CallingConvention = CallingConvention.Cdecl)] [return: MarshalAs(UnmanagedType.U1)] public static extern bool InitVideo(); - [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)] + [DllImport(_Dll, CallingConvention = CallingConvention.Cdecl)] public static extern void CloseAllVideos(); - [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)] - public static extern int LoadVideo(string VideoFileName); + [DllImport(_Dll, CallingConvention = CallingConvention.Cdecl)] + public static extern int LoadVideo(string videoFileName); - [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)] + [DllImport(_Dll, CallingConvention = CallingConvention.Cdecl)] [return: MarshalAs(UnmanagedType.U1)] - public static extern bool CloseVideo(int StreamID); + public static extern bool CloseVideo(int streamID); - [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)] + [DllImport(_Dll, CallingConvention = CallingConvention.Cdecl)] public static extern int GetVideoNumStreams(); - [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)] - public static extern float GetVideoLength(int StreamID); + [DllImport(_Dll, CallingConvention = CallingConvention.Cdecl)] + public static extern float GetVideoLength(int streamID); - [DllImport(Dll, EntryPoint = "GetFrame", CallingConvention = CallingConvention.Cdecl)] - public static extern NativeFrame GetFrameNative(int StreamID, float Time); + [DllImport(_Dll, EntryPoint = "GetFrame", CallingConvention = CallingConvention.Cdecl)] + public static extern SNativeFrame GetFrameNative(int streamID, float time); - public static ManagedFrame GetFrame(int StreamID, float Time) + public static SManagedFrame GetFrame(int streamID, float time) { - NativeFrame f = GetFrameNative(StreamID, Time); + SNativeFrame f = GetFrameNative(streamID, time); byte[] buffer = null; if (f.Size > 0) { buffer = new byte[f.Size]; - Marshal.Copy(f.buffer, buffer, 0, f.Size); + Marshal.Copy(f.Buffer, buffer, 0, f.Size); } - ManagedFrame m; - m.buffer = buffer; + SManagedFrame m; + m.Buffer = buffer; m.Height = f.Height; m.Size = f.Size; m.Videotime = f.Videotime; @@ -87,25 +87,25 @@ namespace Vocaluxe.Lib.Video.Gstreamer return m; } - [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)] + [DllImport(_Dll, CallingConvention = CallingConvention.Cdecl)] [return: MarshalAs(UnmanagedType.U1)] - public static extern bool Skip(int StreamID, float Start, float Gap); + public static extern bool Skip(int streamID, float start, float gap); - [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)] - public static extern void SetVideoLoop(int StreamID, - [MarshalAs(UnmanagedType.U1)] bool Loop); + [DllImport(_Dll, CallingConvention = CallingConvention.Cdecl)] + public static extern void SetVideoLoop(int streamID, + [MarshalAs(UnmanagedType.U1)] bool loop); - [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)] - public static extern void PauseVideo(int StreamID); + [DllImport(_Dll, CallingConvention = CallingConvention.Cdecl)] + public static extern void PauseVideo(int streamID); - [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)] - public static extern void ResumeVideo(int StreamID); + [DllImport(_Dll, CallingConvention = CallingConvention.Cdecl)] + public static extern void ResumeVideo(int streamID); - [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)] + [DllImport(_Dll, CallingConvention = CallingConvention.Cdecl)] [return: MarshalAs(UnmanagedType.U1)] - public static extern bool Finished(int StreamID); + public static extern bool Finished(int streamID); - [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)] + [DllImport(_Dll, CallingConvention = CallingConvention.Cdecl)] [return: MarshalAs(UnmanagedType.U1)] public static extern bool UpdateVideo(); } diff --git a/Vocaluxe/Lib/Video/IVideoDecoder.cs b/Vocaluxe/Lib/Video/IVideoDecoder.cs index 0dbb2af9..d81dce74 100644 --- a/Vocaluxe/Lib/Video/IVideoDecoder.cs +++ b/Vocaluxe/Lib/Video/IVideoDecoder.cs @@ -3,15 +3,15 @@ using VocaluxeLib.Menu; namespace Vocaluxe.Lib.Video { - struct VideoStreams + struct SVideoStreams { - public int handle; - public string file; + public int Handle; + public string File; - public VideoStreams(int stream) + public SVideoStreams(int stream) { - handle = stream; - file = String.Empty; + Handle = stream; + File = String.Empty; } } @@ -20,18 +20,18 @@ namespace Vocaluxe.Lib.Video bool Init(); void CloseAll(); - int Load(string VideoFileName); - bool Close(int StreamID); + int Load(string videoFileName); + bool Close(int streamID); int GetNumStreams(); - float GetLength(int StreamID); - bool GetFrame(int StreamID, ref STexture Frame, float Time, ref float VideoTime); - bool Skip(int StreamID, float Start, float Gap); - void SetLoop(int StreamID, bool Loop); - void Pause(int StreamID); - void Resume(int StreamID); + float GetLength(int streamID); + bool GetFrame(int streamID, ref STexture frame, float time, ref float videoTime); + bool Skip(int streamID, float start, float gap); + void SetLoop(int streamID, bool loop); + void Pause(int streamID); + void Resume(int streamID); - bool Finished(int StreamID); + bool Finished(int streamID); void Update(); } diff --git a/Vocaluxe/Lib/Webcam/CAForgeNet.cs b/Vocaluxe/Lib/Webcam/CAForgeNet.cs index 2a3dd7af..72712685 100644 --- a/Vocaluxe/Lib/Webcam/CAForgeNet.cs +++ b/Vocaluxe/Lib/Webcam/CAForgeNet.cs @@ -16,8 +16,8 @@ namespace Vocaluxe.Lib.Webcam private VideoCaptureDevice _Webcam; private FilterInfoCollection _WebcamDevices; private SWebcamConfig _Config; - private byte[] data = new byte[1]; - private static readonly object _mutexData = new object(); + private byte[] _Data = new byte[1]; + private static readonly object _MutexData = new object(); private int _Width, _Height; public void Close() @@ -26,24 +26,24 @@ namespace Vocaluxe.Lib.Webcam { _Webcam.SignalToStop(); _Webcam.WaitForStop(); - _Webcam.NewFrame -= OnFrame; - data = new byte[1]; + _Webcam.NewFrame -= _OnFrame; + _Data = new byte[1]; } } - public bool GetFrame(ref STexture Frame) + public bool GetFrame(ref STexture frame) { - if (_Webcam != null && _Width > 0 && _Height > 0 && data.Length == _Width * _Height * 4) + if (_Webcam != null && _Width > 0 && _Height > 0 && _Data.Length == _Width * _Height * 4) { - lock (_mutexData) + lock (_MutexData) { - if (Frame.index == -1 || _Width != Frame.width || _Height != Frame.height) + if (frame.Index == -1 || _Width != frame.Width || _Height != frame.Height) { - CDraw.RemoveTexture(ref Frame); - Frame = CDraw.AddTexture(_Width, _Height, ref data); + CDraw.RemoveTexture(ref frame); + frame = CDraw.AddTexture(_Width, _Height, ref _Data); } else - CDraw.UpdateTexture(ref Frame, ref data); + CDraw.UpdateTexture(ref frame, ref _Data); } } return false; @@ -51,13 +51,13 @@ namespace Vocaluxe.Lib.Webcam public Bitmap GetBitmap() { - if (_Webcam != null && _Width > 0 && _Height > 0 && data.Length == _Height * _Width * 4) + if (_Webcam != null && _Width > 0 && _Height > 0 && _Data.Length == _Height * _Width * 4) { - lock (_mutexData) + lock (_MutexData) { Bitmap bmp = new Bitmap(_Width, _Height); BitmapData bitmapdata = bmp.LockBits(new Rectangle(0, 0, _Width, _Height), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb); - Marshal.Copy(data, 0, bitmapdata.Scan0, data.Length); + Marshal.Copy(_Data, 0, bitmapdata.Scan0, _Data.Length); bmp.UnlockBits(bitmapdata); return bmp; } @@ -97,19 +97,19 @@ namespace Vocaluxe.Lib.Webcam return true; } - private void OnFrame(object sender, NewFrameEventArgs e) + private void _OnFrame(object sender, NewFrameEventArgs e) { if (!_Paused) { - lock (_mutexData) + lock (_MutexData) { - if (_Width != e.Frame.Width || _Height != e.Frame.Height || data.Length != e.Frame.Width * e.Frame.Height * 4) - data = new byte[4 * e.Frame.Width * e.Frame.Height]; + if (_Width != e.Frame.Width || _Height != e.Frame.Height || _Data.Length != e.Frame.Width * e.Frame.Height * 4) + _Data = new byte[4 * e.Frame.Width * e.Frame.Height]; _Width = e.Frame.Width; _Height = e.Frame.Height; BitmapData bitmapdata = e.Frame.LockBits(new Rectangle(0, 0, _Width, _Height), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb); - Marshal.Copy(bitmapdata.Scan0, data, 0, data.Length); + Marshal.Copy(bitmapdata.Scan0, _Data, 0, _Data.Length); e.Frame.UnlockBits(bitmapdata); } } @@ -125,9 +125,9 @@ namespace Vocaluxe.Lib.Webcam { if (_Webcam != null) { - _Webcam.NewFrame -= OnFrame; + _Webcam.NewFrame -= _OnFrame; //Subscribe to NewFrame event - _Webcam.NewFrame += OnFrame; + _Webcam.NewFrame += _OnFrame; _Webcam.Start(); _Paused = false; } @@ -144,7 +144,7 @@ namespace Vocaluxe.Lib.Webcam return _Devices.ToArray(); } - public bool Select(SWebcamConfig Config) + public bool Select(SWebcamConfig config) { //Close old camera connection Close(); @@ -155,18 +155,18 @@ namespace Vocaluxe.Lib.Webcam return false; //No MonikerString found, try first webcam - if (Config.MonikerString.Length == 0) + if (config.MonikerString.Length == 0) _Webcam = new VideoCaptureDevice(_WebcamDevices[0].MonikerString); else //Found MonikerString - _Webcam = new VideoCaptureDevice(Config.MonikerString); + _Webcam = new VideoCaptureDevice(config.MonikerString); if (_Webcam == null) return false; - if (Config.Framerate != 0 && Config.Height != 0 && Config.Width != 0) + if (config.Framerate != 0 && config.Height != 0 && config.Width != 0) { - _Webcam.DesiredFrameRate = Config.Framerate; - _Webcam.DesiredFrameSize = new Size(Config.Width, Config.Height); + _Webcam.DesiredFrameRate = config.Framerate; + _Webcam.DesiredFrameSize = new Size(config.Width, config.Height); } _Config.Framerate = _Webcam.DesiredFrameRate; diff --git a/Vocaluxe/Lib/Webcam/IWebcam.cs b/Vocaluxe/Lib/Webcam/IWebcam.cs index f5bc183c..8b0ecc1c 100644 --- a/Vocaluxe/Lib/Webcam/IWebcam.cs +++ b/Vocaluxe/Lib/Webcam/IWebcam.cs @@ -36,11 +36,11 @@ namespace Vocaluxe.Lib.Webcam void Stop(); void Close(); - bool GetFrame(ref STexture Frame); + bool GetFrame(ref STexture frame); Bitmap GetBitmap(); SWebcamConfig GetConfig(); SWebcamDevice[] GetDevices(); - bool Select(SWebcamConfig sWebcamConfig); + bool Select(SWebcamConfig webcamConfig); } } \ No newline at end of file diff --git a/Vocaluxe/Program.cs b/Vocaluxe/Program.cs index 89373317..b912c774 100644 --- a/Vocaluxe/Program.cs +++ b/Vocaluxe/Program.cs @@ -9,17 +9,19 @@ using Vocaluxe.Base; namespace Vocaluxe { // just a small comment for the new develop branch - static class MainProgram + static class CMainProgram { - private static SplashScreen _SplashScreen; + private static CSplashScreen _SplashScreen; [STAThread] +// ReSharper disable InconsistentNaming private static void Main(string[] args) +// ReSharper restore InconsistentNaming { - AppDomain.CurrentDomain.AssemblyResolve += AssemblyResolver; + AppDomain.CurrentDomain.AssemblyResolve += _AssemblyResolver; // Close program if there is another instance running - if (!EnsureSingleInstance()) + if (!_EnsureSingleInstance()) { //TODO: put it into language file MessageBox.Show("Another Instance of Vocaluxe is already runnning!"); @@ -53,7 +55,7 @@ namespace Vocaluxe CLog.StopBenchmark(0, "Init Config"); Application.DoEvents(); - _SplashScreen = new SplashScreen(); + _SplashScreen = new CSplashScreen(); Application.DoEvents(); // Init Draw @@ -159,7 +161,7 @@ namespace Vocaluxe { MessageBox.Show("Error on start up: " + e.Message + e.StackTrace); CLog.LogError("Error on start up: " + e.Message + e.StackTrace); - CloseProgram(); + _CloseProgram(); Environment.Exit(Environment.ExitCode); } Application.DoEvents(); @@ -177,10 +179,10 @@ namespace Vocaluxe CLog.LogError("Unhandled error: " + e.Message + e.StackTrace); } - CloseProgram(); + _CloseProgram(); } - private static void CloseProgram() + private static void _CloseProgram() { // Unloading try @@ -197,7 +199,7 @@ namespace Vocaluxe catch (Exception) {} } - private static Assembly AssemblyResolver(Object sender, ResolveEventArgs args) + private static Assembly _AssemblyResolver(Object sender, ResolveEventArgs args) { string[] arr = args.Name.Split(new char[] {','}); if (arr != null) @@ -215,7 +217,7 @@ namespace Vocaluxe return null; } - private static bool EnsureSingleInstance() + private static bool _EnsureSingleInstance() { Process currentProcess = Process.GetCurrentProcess(); Process[] processes = Process.GetProcesses(); @@ -233,19 +235,19 @@ namespace Vocaluxe } } - class SplashScreen : Form + class CSplashScreen : Form { - private readonly Bitmap logo; + private readonly Bitmap _Logo; - public SplashScreen() + public CSplashScreen() { - string path = Path.Combine(Environment.CurrentDirectory, Path.Combine(CSettings.sFolderGraphics, CSettings.sLogo)); + string path = Path.Combine(Environment.CurrentDirectory, Path.Combine(CSettings.FolderGraphics, CSettings.Logo)); if (File.Exists(path)) { try { - logo = new Bitmap(path); - ClientSize = new Size(logo.Width, logo.Height); + _Logo = new Bitmap(path); + ClientSize = new Size(_Logo.Width, _Logo.Height); } catch (Exception e) { @@ -255,7 +257,7 @@ namespace Vocaluxe else CLog.LogError("Can't find " + path); - path = Path.Combine(Environment.CurrentDirectory, CSettings.sIcon); + path = Path.Combine(Environment.CurrentDirectory, CSettings.Icon); if (File.Exists(path)) { try @@ -274,7 +276,7 @@ namespace Vocaluxe BackColor = Color.Transparent; FormBorderStyle = FormBorderStyle.None; - Text = CSettings.sProgramName; + Text = CSettings.ProgramName; CenterToScreen(); Show(); } @@ -283,11 +285,11 @@ namespace Vocaluxe protected override void OnPaintBackground(PaintEventArgs e) { - if (logo == null) + if (_Logo == null) return; Graphics g = e.Graphics; - g.DrawImage(logo, new Rectangle(0, 0, Width, Height)); + g.DrawImage(_Logo, new Rectangle(0, 0, Width, Height)); } } } \ No newline at end of file diff --git a/Vocaluxe/Screens/CPopupScreenPlayerControl.cs b/Vocaluxe/Screens/CPopupScreenPlayerControl.cs index 22669d4a..dbdae6c9 100644 --- a/Vocaluxe/Screens/CPopupScreenPlayerControl.cs +++ b/Vocaluxe/Screens/CPopupScreenPlayerControl.cs @@ -14,35 +14,35 @@ namespace Vocaluxe.Screens get { return 1; } } - private const string StaticBG = "StaticBG"; - private const string StaticCover = "StaticCover"; + private const string _StaticBG = "StaticBG"; + private const string _StaticCover = "StaticCover"; - private const string ButtonPrevious = "ButtonPrevious"; - private const string ButtonPlay = "ButtonPlay"; - private const string ButtonPause = "ButtonPause"; - private const string ButtonNext = "ButtonNext"; - private const string ButtonRepeat = "ButtonRepeat"; - private const string ButtonShowVideo = "ButtonShowVideo"; - private const string ButtonSing = "ButtonSing"; - private const string ButtonToBackgroundVideo = "ButtonToBackgroundVideo"; + private const string _ButtonPrevious = "ButtonPrevious"; + private const string _ButtonPlay = "ButtonPlay"; + private const string _ButtonPause = "ButtonPause"; + private const string _ButtonNext = "ButtonNext"; + private const string _ButtonRepeat = "ButtonRepeat"; + private const string _ButtonShowVideo = "ButtonShowVideo"; + private const string _ButtonSing = "ButtonSing"; + private const string _ButtonToBackgroundVideo = "ButtonToBackgroundVideo"; - private const string TextCurrentSong = "TextCurrentSong"; + private const string _TextCurrentSong = "TextCurrentSong"; private bool _VideoPreviewInt; - private bool VideoPreview + private bool _VideoPreview { get { return _VideoPreviewInt; } set { _VideoPreviewInt = value; - if (!_VideoPreviewInt && !VideoBackground) + if (!_VideoPreviewInt && !_VideoBackground) CBackgroundMusic.VideoEnabled = false; else CBackgroundMusic.VideoEnabled = true; } } - private bool VideoBackground + private bool _VideoBackground { get { return CConfig.VideosToBackground == EOffOn.TR_CONFIG_ON; } set @@ -69,29 +69,29 @@ namespace Vocaluxe.Screens { base.Init(); - _ThemeStatics = new string[] {StaticBG, StaticCover}; - _ThemeTexts = new string[] {TextCurrentSong}; + _ThemeStatics = new string[] {_StaticBG, _StaticCover}; + _ThemeTexts = new string[] {_TextCurrentSong}; List buttons = new List(); - buttons.Add(ButtonPlay); - buttons.Add(ButtonPause); - buttons.Add(ButtonPrevious); - buttons.Add(ButtonNext); - buttons.Add(ButtonRepeat); - buttons.Add(ButtonShowVideo); - buttons.Add(ButtonSing); - buttons.Add(ButtonToBackgroundVideo); + buttons.Add(_ButtonPlay); + buttons.Add(_ButtonPause); + buttons.Add(_ButtonPrevious); + buttons.Add(_ButtonNext); + buttons.Add(_ButtonRepeat); + buttons.Add(_ButtonShowVideo); + buttons.Add(_ButtonSing); + buttons.Add(_ButtonToBackgroundVideo); _ThemeButtons = buttons.ToArray(); } - public override void LoadTheme(string XmlPath) + public override void LoadTheme(string xmlPath) { - base.LoadTheme(XmlPath); + base.LoadTheme(xmlPath); - _ScreenArea = Statics[StaticBG].Rect; + _ScreenArea = Statics[_StaticBG].Rect; } - public override bool HandleInput(KeyEvent keyEvent) + public override bool HandleInput(SKeyEvent keyEvent) { base.HandleInput(keyEvent); if (keyEvent.KeyPressed && !Char.IsControl(keyEvent.Unicode)) {} @@ -105,22 +105,22 @@ namespace Vocaluxe.Screens return false; case Keys.Enter: - if (Buttons[ButtonNext].Selected) + if (Buttons[_ButtonNext].Selected) CBackgroundMusic.Next(); - if (Buttons[ButtonPrevious].Selected) + if (Buttons[_ButtonPrevious].Selected) CBackgroundMusic.Previous(); - if (Buttons[ButtonPlay].Selected) + if (Buttons[_ButtonPlay].Selected) CBackgroundMusic.Play(); - if (Buttons[ButtonPause].Selected) + if (Buttons[_ButtonPause].Selected) CBackgroundMusic.Pause(); - if (Buttons[ButtonRepeat].Selected) + if (Buttons[_ButtonRepeat].Selected) CBackgroundMusic.RepeatSong = !CBackgroundMusic.RepeatSong; - if (Buttons[ButtonShowVideo].Selected) - VideoPreview = !VideoPreview; - if (Buttons[ButtonSing].Selected) - StartSong(CBackgroundMusic.SongID, CBackgroundMusic.Duet); - if (Buttons[ButtonToBackgroundVideo].Selected) - VideoBackground = !VideoBackground; + if (Buttons[_ButtonShowVideo].Selected) + _VideoPreview = !_VideoPreview; + if (Buttons[_ButtonSing].Selected) + _StartSong(CBackgroundMusic.SongID, CBackgroundMusic.Duet); + if (Buttons[_ButtonToBackgroundVideo].Selected) + _VideoBackground = !_VideoBackground; break; } } @@ -128,27 +128,27 @@ namespace Vocaluxe.Screens return true; } - public override bool HandleMouse(MouseEvent mouseEvent) + public override bool HandleMouse(SMouseEvent mouseEvent) { base.HandleMouse(mouseEvent); if (mouseEvent.LB && IsMouseOver(mouseEvent)) { - if (Buttons[ButtonNext].Selected) + if (Buttons[_ButtonNext].Selected) CBackgroundMusic.Next(); - if (Buttons[ButtonPrevious].Selected) + if (Buttons[_ButtonPrevious].Selected) CBackgroundMusic.Previous(); - if (Buttons[ButtonPlay].Selected) + if (Buttons[_ButtonPlay].Selected) CBackgroundMusic.Play(); - if (Buttons[ButtonPause].Selected) + if (Buttons[_ButtonPause].Selected) CBackgroundMusic.Pause(); - if (Buttons[ButtonRepeat].Selected) + if (Buttons[_ButtonRepeat].Selected) CBackgroundMusic.RepeatSong = !CBackgroundMusic.RepeatSong; - if (Buttons[ButtonShowVideo].Selected) - VideoPreview = !VideoPreview; - if (Buttons[ButtonSing].Selected) - StartSong(CBackgroundMusic.SongID, CBackgroundMusic.Duet); - if (Buttons[ButtonToBackgroundVideo].Selected) - VideoBackground = !VideoBackground; + if (Buttons[_ButtonShowVideo].Selected) + _VideoPreview = !_VideoPreview; + if (Buttons[_ButtonSing].Selected) + _StartSong(CBackgroundMusic.SongID, CBackgroundMusic.Duet); + if (Buttons[_ButtonToBackgroundVideo].Selected) + _VideoBackground = !_VideoBackground; } else if (mouseEvent.LB) { @@ -165,11 +165,11 @@ namespace Vocaluxe.Screens public override bool UpdateGame() { - Statics[StaticCover].Visible = !_VideoPreviewInt || !CBackgroundMusic.SongHasVideo; - Buttons[ButtonToBackgroundVideo].Pressed = VideoBackground; - Buttons[ButtonShowVideo].Pressed = _VideoPreviewInt; - Buttons[ButtonRepeat].Pressed = CBackgroundMusic.RepeatSong; - Buttons[ButtonSing].Visible = CBackgroundMusic.CanSing && CParty.CurrentPartyModeID == -1; + Statics[_StaticCover].Visible = !_VideoPreviewInt || !CBackgroundMusic.SongHasVideo; + Buttons[_ButtonToBackgroundVideo].Pressed = _VideoBackground; + Buttons[_ButtonShowVideo].Pressed = _VideoPreviewInt; + Buttons[_ButtonRepeat].Pressed = CBackgroundMusic.RepeatSong; + Buttons[_ButtonSing].Visible = CBackgroundMusic.CanSing && CParty.CurrentPartyModeID == -1; return true; } @@ -177,28 +177,28 @@ namespace Vocaluxe.Screens { if (!_Active) return false; - Statics[StaticCover].Texture = CBackgroundMusic.Cover; - if (CBackgroundMusic.VideoEnabled && VideoPreview && CBackgroundMusic.SongHasVideo) - CDraw.DrawTexture(Statics[StaticCover], CBackgroundMusic.GetVideoTexture(), EAspect.Crop); - Buttons[ButtonPause].Visible = CBackgroundMusic.Playing; - Buttons[ButtonPlay].Visible = !CBackgroundMusic.Playing; - Texts[TextCurrentSong].Text = CBackgroundMusic.ArtistAndTitle; + Statics[_StaticCover].Texture = CBackgroundMusic.Cover; + if (CBackgroundMusic.VideoEnabled && _VideoPreview && CBackgroundMusic.SongHasVideo) + CDraw.DrawTexture(Statics[_StaticCover], CBackgroundMusic.GetVideoTexture(), EAspect.Crop); + Buttons[_ButtonPause].Visible = CBackgroundMusic.Playing; + Buttons[_ButtonPlay].Visible = !CBackgroundMusic.Playing; + Texts[_TextCurrentSong].Text = CBackgroundMusic.ArtistAndTitle; return base.Draw(); } - private void StartSong(int SongNr, bool Duet) + private void _StartSong(int songNr, bool duet) { - if (SongNr >= 0 && CSongs.SongsLoaded) + if (songNr >= 0 && CSongs.SongsLoaded) { CGame.Reset(); CGame.ClearSongs(); EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL; - if (CSongs.AllSongs[SongNr].IsDuet) + if (CSongs.AllSongs[songNr].IsDuet) gm = EGameMode.TR_GAMEMODE_DUET; - CGame.AddSong(SongNr, gm); + CGame.AddSong(songNr, gm); CGraphics.FadeTo(EScreens.ScreenNames); } diff --git a/Vocaluxe/Screens/CPopupScreenVolumeControl.cs b/Vocaluxe/Screens/CPopupScreenVolumeControl.cs index 0f4e829d..d1f477ea 100644 --- a/Vocaluxe/Screens/CPopupScreenVolumeControl.cs +++ b/Vocaluxe/Screens/CPopupScreenVolumeControl.cs @@ -11,57 +11,57 @@ namespace Vocaluxe.Screens get { return 1; } } - private const string StaticBG = "StaticBG"; + private const string _StaticBG = "StaticBG"; - private const string SelectSlideVolume = "SelectSlideVolume"; + private const string _SelectSlideVolume = "SelectSlideVolume"; public override void Init() { base.Init(); - _ThemeStatics = new string[] {StaticBG}; - _ThemeSelectSlides = new string[] {SelectSlideVolume}; + _ThemeStatics = new string[] {_StaticBG}; + _ThemeSelectSlides = new string[] {_SelectSlideVolume}; } - public override void LoadTheme(string XmlPath) + public override void LoadTheme(string xmlPath) { - base.LoadTheme(XmlPath); + base.LoadTheme(xmlPath); - _ScreenArea = Statics[StaticBG].Rect; - SelectSlides[SelectSlideVolume].AddValues(new string[] + _ScreenArea = Statics[_StaticBG].Rect; + SelectSlides[_SelectSlideVolume].AddValues(new string[] {"0", "5", "10", "15", "20", "25", "30", "35", "40", "45", "50", "55", "60", "65", "70", "75", "80", "85", "90", "95", "100"}); } - public override bool HandleInput(KeyEvent keyEvent) + public override bool HandleInput(SKeyEvent keyEvent) { - UpdateSlides(); + _UpdateSlides(); return true; } - public override bool HandleMouse(MouseEvent mouseEvent) + public override bool HandleMouse(SMouseEvent mouseEvent) { base.HandleMouse(mouseEvent); if (mouseEvent.LB) { - SaveConfig(); + _SaveConfig(); return true; } else if (mouseEvent.Wheel > 0 && CHelper.IsInBounds(_ScreenArea, mouseEvent)) { - if (SelectSlides[SelectSlideVolume].Selection - mouseEvent.Wheel >= 0) - SelectSlides[SelectSlideVolume].Selection = SelectSlides[SelectSlideVolume].Selection - mouseEvent.Wheel; - else if (SelectSlides[SelectSlideVolume].Selection - mouseEvent.Wheel < 0) - SelectSlides[SelectSlideVolume].Selection = 0; - SaveConfig(); + if (SelectSlides[_SelectSlideVolume].Selection - mouseEvent.Wheel >= 0) + SelectSlides[_SelectSlideVolume].Selection = SelectSlides[_SelectSlideVolume].Selection - mouseEvent.Wheel; + else if (SelectSlides[_SelectSlideVolume].Selection - mouseEvent.Wheel < 0) + SelectSlides[_SelectSlideVolume].Selection = 0; + _SaveConfig(); return true; } else if (mouseEvent.Wheel < 0 && CHelper.IsInBounds(_ScreenArea, mouseEvent)) { - if (SelectSlides[SelectSlideVolume].Selection - mouseEvent.Wheel < SelectSlides[SelectSlideVolume].NumValues) - SelectSlides[SelectSlideVolume].Selection = SelectSlides[SelectSlideVolume].Selection - mouseEvent.Wheel; - else if (SelectSlides[SelectSlideVolume].Selection - mouseEvent.Wheel >= SelectSlides[SelectSlideVolume].NumValues) - SelectSlides[SelectSlideVolume].Selection = SelectSlides[SelectSlideVolume].NumValues - 1; - SaveConfig(); + if (SelectSlides[_SelectSlideVolume].Selection - mouseEvent.Wheel < SelectSlides[_SelectSlideVolume].NumValues) + SelectSlides[_SelectSlideVolume].Selection = SelectSlides[_SelectSlideVolume].Selection - mouseEvent.Wheel; + else if (SelectSlides[_SelectSlideVolume].Selection - mouseEvent.Wheel >= SelectSlides[_SelectSlideVolume].NumValues) + SelectSlides[_SelectSlideVolume].Selection = SelectSlides[_SelectSlideVolume].NumValues - 1; + _SaveConfig(); return true; } else if (mouseEvent.RB) @@ -72,12 +72,12 @@ namespace Vocaluxe.Screens public override void OnShow() { base.OnShow(); - UpdateSlides(); + _UpdateSlides(); } public override bool UpdateGame() { - UpdateSlides(); + _UpdateSlides(); return true; } @@ -89,49 +89,49 @@ namespace Vocaluxe.Screens return base.Draw(); } - private void SaveConfig() + private void _SaveConfig() { switch (CGraphics.CurrentScreen) { case EScreens.ScreenSong: if (CSongs.IsInCategory) - CConfig.PreviewMusicVolume = SelectSlides[SelectSlideVolume].Selection * 5; + CConfig.PreviewMusicVolume = SelectSlides[_SelectSlideVolume].Selection * 5; else { - CConfig.BackgroundMusicVolume = SelectSlides[SelectSlideVolume].Selection * 5; + CConfig.BackgroundMusicVolume = SelectSlides[_SelectSlideVolume].Selection * 5; CBackgroundMusic.ApplyVolume(); } break; case EScreens.ScreenSing: - CConfig.GameMusicVolume = SelectSlides[SelectSlideVolume].Selection * 5; + CConfig.GameMusicVolume = SelectSlides[_SelectSlideVolume].Selection * 5; break; default: - CConfig.BackgroundMusicVolume = SelectSlides[SelectSlideVolume].Selection * 5; + CConfig.BackgroundMusicVolume = SelectSlides[_SelectSlideVolume].Selection * 5; CBackgroundMusic.ApplyVolume(); break; } CConfig.SaveConfig(); } - private void UpdateSlides() + private void _UpdateSlides() { switch (CGraphics.CurrentScreen) { case EScreens.ScreenSong: if (CSongs.IsInCategory) - SelectSlides[SelectSlideVolume].Selection = CConfig.PreviewMusicVolume / 5; + SelectSlides[_SelectSlideVolume].Selection = CConfig.PreviewMusicVolume / 5; else - SelectSlides[SelectSlideVolume].Selection = CConfig.BackgroundMusicVolume / 5; + SelectSlides[_SelectSlideVolume].Selection = CConfig.BackgroundMusicVolume / 5; break; case EScreens.ScreenSing: - SelectSlides[SelectSlideVolume].Selection = CConfig.GameMusicVolume / 5; + SelectSlides[_SelectSlideVolume].Selection = CConfig.GameMusicVolume / 5; break; default: - SelectSlides[SelectSlideVolume].Selection = CConfig.BackgroundMusicVolume / 5; + SelectSlides[_SelectSlideVolume].Selection = CConfig.BackgroundMusicVolume / 5; break; } } diff --git a/Vocaluxe/Screens/CScreenCredits.cs b/Vocaluxe/Screens/CScreenCredits.cs index 58a97264..bf985c56 100644 --- a/Vocaluxe/Screens/CScreenCredits.cs +++ b/Vocaluxe/Screens/CScreenCredits.cs @@ -23,13 +23,13 @@ class CCreditName public float StartTimeUp; public bool Active; - public CCreditName(CStatic Image, CStatic ImgDot, CParticleEffect Particle, int ParticleOffsetX, int ParticleOffsetY) + public CCreditName(CStatic image, CStatic imgDot, CParticleEffect particle, int particleOffsetX, int particleOffsetY) { - _Image = Image; - _ImgDot = ImgDot; - _Particle = Particle; - _ParticleOffsetX = (int)Math.Round(ParticleOffsetX * Image.Rect.W / Image.Texture.w2 - Particle.Rect.W / 2); - _ParticleOffsetY = (int)Math.Round(ParticleOffsetY * Image.Rect.H / Image.Texture.h2 - Particle.Rect.H / 2); + _Image = image; + _ImgDot = imgDot; + _Particle = particle; + _ParticleOffsetX = (int)Math.Round(particleOffsetX * image.Rect.W / image.Texture.W2 - particle.Rect.W / 2); + _ParticleOffsetY = (int)Math.Round(particleOffsetY * image.Rect.H / image.Texture.H2 - particle.Rect.H / 2); Active = true; } @@ -94,17 +94,17 @@ namespace Vocaluxe.Screens get { return 1; } } - private CStatic logo; - private CParticleEffect starsRed; - private CParticleEffect starsBlue; + private CStatic _Logo; + private CParticleEffect _StarsRed; + private CParticleEffect _StarsBlue; private List _CreditNames; - private Stopwatch LogoTimer; - private Stopwatch CreditsTimer; - private Stopwatch TextTimer; + private Stopwatch _LogoTimer; + private Stopwatch _CreditsTimer; + private Stopwatch _TextTimer; - private List paragraphs; - private List paragraphTexts; + private List _Paragraphs; + private List _ParagraphTexts; private STexture _TexLogo; private STexture _TexPerfectNoteStar; @@ -125,13 +125,13 @@ namespace Vocaluxe.Screens { base.Init(); - LogoTimer = new Stopwatch(); - CreditsTimer = new Stopwatch(); - TextTimer = new Stopwatch(); + _LogoTimer = new Stopwatch(); + _CreditsTimer = new Stopwatch(); + _TextTimer = new Stopwatch(); //Text for last part of credits. - paragraphTexts = new List(); - paragraphs = new List(); + _ParagraphTexts = new List(); + _Paragraphs = new List(); string paragraph; string[] words; @@ -140,14 +140,14 @@ namespace Vocaluxe.Screens "a good thing even better, we ended up rewriting the game from scratch. And a new implementation in a new " + "programming language called for a new name - and VOCALUXE [ˈvoʊˈkəˈlʌks] it is!"; words = paragraph.Split(new char[] {' '}); - paragraphs.Add(words); + _Paragraphs.Add(words); paragraph = "This first public version has already implemented many of the original features and it is fully " + "compatible with all the song files in your existing song collection. The code design allows a much faster " + "implementation of new features, thus the roadmap for the next few stable releases is packed and we expect much " + "shorter release cycles than ever before. And, of course, our and your ideas may be the features of tomorrow."; words = paragraph.Split(new char[] {' '}); - paragraphs.Add(words); + _Paragraphs.Add(words); paragraph = "We appreciate the feedback in the beta release phase and are, of course, always open for bug reports, " + "suggestions for improvements and ideas for new features. We would also like to thank the translators who make " + @@ -155,15 +155,15 @@ namespace Vocaluxe.Screens "there's something for everyone in the huge collection of available songs! Last but not least, thanks to " + "Kosal Sen's Philly Sans type used in the Vocaluxe Logo."; words = paragraph.Split(new char[] {' '}); - paragraphs.Add(words); + _Paragraphs.Add(words); paragraph = "Go ahead and grab your mics, crank up your stereo, warm up your voice and get ready to sing to the best " + "of your abilities!"; words = paragraph.Split(new char[] {' '}); - paragraphs.Add(words); + _Paragraphs.Add(words); } - public override void LoadTheme(string XmlPath) + public override void LoadTheme(string xmlPath) { //Vocaluxe-Logo CDataBase.GetCreditsRessource("Logo_voc.png", ref _TexLogo); @@ -185,32 +185,32 @@ namespace Vocaluxe.Screens //Prepare Text int lastY = 280; - for (int i = 0; i < paragraphs.Count; i++) + for (int i = 0; i < _Paragraphs.Count; i++) { string line = ""; - for (int e = 0; e < paragraphs[i].Length; e++) + for (int e = 0; e < _Paragraphs[i].Length; e++) { - if (paragraphs[i][e] != null) + if (_Paragraphs[i][e] != null) { - string newline = line + " " + paragraphs[i][e]; + string newline = line + " " + _Paragraphs[i][e]; CText text = GetNewText(75, lastY, -2, 30, -1, EAlignment.Left, EStyle.Bold, "Outline", new SColorF(1, 1, 1, 1), line); - if (CDraw.GetTextBounds(text).Width < (CSettings.iRenderW - 220)) + if (CDraw.GetTextBounds(text).Width < (CSettings.RenderW - 220)) { - line = line + " " + paragraphs[i][e]; + line = line + " " + _Paragraphs[i][e]; //Check if all words are used - if ((e + 1) == paragraphs[i].Length) + if ((e + 1) == _Paragraphs[i].Length) { text.Text = line; - paragraphTexts.Add(text); + _ParagraphTexts.Add(text); line = ""; lastY += 40; } } else { - paragraphTexts.Add(text); - line = " " + paragraphs[i][e]; + _ParagraphTexts.Add(text); + line = " " + _Paragraphs[i][e]; lastY += 27; } } @@ -218,7 +218,7 @@ namespace Vocaluxe.Screens } } - public override void ReloadTheme(string XmlPath) {} + public override void ReloadTheme(string xmlPath) {} public override void SaveTheme() {} @@ -226,7 +226,7 @@ namespace Vocaluxe.Screens public override void ReloadTextures() {} - public override bool HandleInput(KeyEvent keyEvent) + public override bool HandleInput(SKeyEvent keyEvent) { if (!keyEvent.KeyPressed || Char.IsControl(keyEvent.Unicode)) { @@ -243,7 +243,7 @@ namespace Vocaluxe.Screens return true; } - public override bool HandleMouse(MouseEvent mouseEvent) + public override bool HandleMouse(SMouseEvent mouseEvent) { if (mouseEvent.LB || mouseEvent.RB) CGraphics.FadeTo(EScreens.ScreenMain); @@ -252,38 +252,38 @@ namespace Vocaluxe.Screens public override bool UpdateGame() { - if (!animation()) + if (!_Animation()) CGraphics.FadeTo(EScreens.ScreenMain); return true; } - public CParticleEffect _GetStarParticles(int NumStars, bool isRed, SRectF Rect, bool BigParticles) + public CParticleEffect GetStarParticles(int numStars, bool isRed, SRectF rect, bool bigParticles) { SColorF partColor = isRed ? new SColorF(1, 0, 0, 1) : new SColorF(0.149f, 0.415f, 0.819f, 1); - int partSize = BigParticles ? 35 : 25; - return GetNewParticleEffect(NumStars, partColor, Rect, _TexPerfectNoteStar, partSize, EParticleType.Star); + int partSize = bigParticles ? 35 : 25; + return GetNewParticleEffect(numStars, partColor, rect, _TexPerfectNoteStar, partSize, EParticleType.Star); } - private void _AddNewCreditName(STexture Texture, int ParticleOffsetX, int ParticleOffsetY, bool BigParticles) + private void _AddNewCreditName(STexture texture, int particleOffsetX, int particleOffsetY, bool bigParticles) { bool isRight = _CreditNames.Count % 2 == 0; - int partRectSize = BigParticles ? 25 : 20; - int partCount = BigParticles ? 8 : 6; - STexture TexDot = isRight ? _TexRedDot : _TexBlueDot; + int partRectSize = bigParticles ? 25 : 20; + int partCount = bigParticles ? 8 : 6; + STexture texDot = isRight ? _TexRedDot : _TexBlueDot; - CStatic Image = GetNewStatic(Texture, new SColorF(1, 1, 1, 1), new SRectF(-1, -1, 400, 120, -4)); + CStatic image = GetNewStatic(texture, new SColorF(1, 1, 1, 1), new SRectF(-1, -1, 400, 120, -4)); SRectF particleRect = new SRectF(-1, -1, partRectSize, partRectSize, -6); SRectF imgDotRect = new SRectF(particleRect); imgDotRect.Z = -5; - CStatic ImgDot = GetNewStatic(TexDot, new SColorF(1, 1, 1, 1), imgDotRect); - CParticleEffect Particle = _GetStarParticles(partCount, isRight, particleRect, BigParticles); + CStatic imgDot = GetNewStatic(texDot, new SColorF(1, 1, 1, 1), imgDotRect); + CParticleEffect particle = GetStarParticles(partCount, isRight, particleRect, bigParticles); - CCreditName credit = new CCreditName(Image, ImgDot, Particle, ParticleOffsetX, ParticleOffsetY); + CCreditName credit = new CCreditName(image, imgDot, particle, particleOffsetX, particleOffsetY); if (isRight) { - credit.X = CSettings.iRenderW; + credit.X = CSettings.RenderW; credit.Direction = EDirection.Right; } else @@ -300,13 +300,13 @@ namespace Vocaluxe.Screens base.OnShow(); //Vocaluxe-Logo - logo = GetNewStatic(_TexLogo, new SColorF(1, 1, 1, 1), new SRectF((CSettings.iRenderW - _TexLogo.width) / 2, -270, _TexLogo.width, _TexLogo.height, -2)); + _Logo = GetNewStatic(_TexLogo, new SColorF(1, 1, 1, 1), new SRectF((CSettings.RenderW - _TexLogo.Width) / 2, -270, _TexLogo.Width, _TexLogo.Height, -2)); //Little stars for logo - int numstars = (int)(logo.Rect.W * 0.25f / 2f); - SRectF partRect = new SRectF(logo.Rect.X, logo.Rect.Y, logo.Rect.W, logo.Rect.H, -1); - starsRed = _GetStarParticles(numstars, true, partRect, true); - starsBlue = _GetStarParticles(numstars, false, partRect, true); + int numstars = (int)(_Logo.Rect.W * 0.25f / 2f); + SRectF partRect = new SRectF(_Logo.Rect.X, _Logo.Rect.Y, _Logo.Rect.W, _Logo.Rect.H, -1); + _StarsRed = GetStarParticles(numstars, true, partRect, true); + _StarsBlue = GetStarParticles(numstars, false, partRect, true); //Credit names _CreditNames = new List(); @@ -320,16 +320,16 @@ namespace Vocaluxe.Screens _AddNewCreditName(_TexNamePantero, 311, 45, false); _AddNewCreditName(_TexNamePinky007, 113, 50, false); - TextTimer.Reset(); - LogoTimer.Reset(); - CreditsTimer.Reset(); + _TextTimer.Reset(); + _LogoTimer.Reset(); + _CreditsTimer.Reset(); } public override void OnShowFinish() { base.OnShowFinish(); - LogoTimer.Start(); + _LogoTimer.Start(); } public override bool Draw() @@ -337,47 +337,47 @@ namespace Vocaluxe.Screens base.Draw(); //Draw background - CDraw.DrawColor(new SColorF(0, 0.18f, 0.474f, 1), new SRectF(0, 0, CSettings.iRenderW, CSettings.iRenderH, 0)); + CDraw.DrawColor(new SColorF(0, 0.18f, 0.474f, 1), new SRectF(0, 0, CSettings.RenderW, CSettings.RenderH, 0)); //Draw stars - starsBlue.Draw(); - starsRed.Draw(); + _StarsBlue.Draw(); + _StarsRed.Draw(); - logo.Draw(); + _Logo.Draw(); //Draw credit-entries foreach (CCreditName cn in _CreditNames) cn.Draw(); //Draw Text - if (TextTimer.IsRunning) + if (_TextTimer.IsRunning) { - for (int i = 0; i < paragraphTexts.Count; i++) - paragraphTexts[i].Draw(); + for (int i = 0; i < _ParagraphTexts.Count; i++) + _ParagraphTexts[i].Draw(); } return true; } - private bool animation() + private bool _Animation() { bool active = false; - if (LogoTimer.IsRunning) + if (_LogoTimer.IsRunning) { active = true; - logo.Rect.Y = -270 + (270f / 3000f) * LogoTimer.ElapsedMilliseconds; - starsRed.Rect.Y = logo.Rect.Y; - starsBlue.Rect.Y = logo.Rect.Y; - if (LogoTimer.ElapsedMilliseconds >= 2000 && !CreditsTimer.IsRunning) - CreditsTimer.Start(); - if (LogoTimer.ElapsedMilliseconds >= 3000) + _Logo.Rect.Y = -270 + (270f / 3000f) * _LogoTimer.ElapsedMilliseconds; + _StarsRed.Rect.Y = _Logo.Rect.Y; + _StarsBlue.Rect.Y = _Logo.Rect.Y; + if (_LogoTimer.ElapsedMilliseconds >= 2000 && !_CreditsTimer.IsRunning) + _CreditsTimer.Start(); + if (_LogoTimer.ElapsedMilliseconds >= 3000) { - LogoTimer.Stop(); - LogoTimer.Reset(); + _LogoTimer.Stop(); + _LogoTimer.Reset(); } } - if (CreditsTimer.IsRunning) + if (_CreditsTimer.IsRunning) { active = true; @@ -388,36 +388,36 @@ namespace Vocaluxe.Screens switch (_CreditNames[i].Direction) { case EDirection.Right: - if (i * 4000f <= CreditsTimer.ElapsedMilliseconds) + if (i * 4000f <= _CreditsTimer.ElapsedMilliseconds) { - _CreditNames[i].X = -450 + (((CSettings.iRenderW - _CreditNames[i].W) / 2) / 3000f) * (CreditsTimer.ElapsedMilliseconds - (i * 4000f)); + _CreditNames[i].X = -450 + (((CSettings.RenderW - _CreditNames[i].W) / 2) / 3000f) * (_CreditsTimer.ElapsedMilliseconds - (i * 4000f)); //Check if name is in middle of screen and should go up - if (_CreditNames[i].X >= (CSettings.iRenderW - _CreditNames[i].W) / 2) + if (_CreditNames[i].X >= (CSettings.RenderW - _CreditNames[i].W) / 2) { _CreditNames[i].Direction = EDirection.Up; - _CreditNames[i].StartTimeUp = CreditsTimer.ElapsedMilliseconds; + _CreditNames[i].StartTimeUp = _CreditsTimer.ElapsedMilliseconds; } } break; case EDirection.Left: - if (i * 4000f <= CreditsTimer.ElapsedMilliseconds) + if (i * 4000f <= _CreditsTimer.ElapsedMilliseconds) { - _CreditNames[i].X = CSettings.iRenderW - - (((CSettings.iRenderW - _CreditNames[i].W) / 2) / 3000f) * (CreditsTimer.ElapsedMilliseconds - (i * 4000f)); + _CreditNames[i].X = CSettings.RenderW - + (((CSettings.RenderW - _CreditNames[i].W) / 2) / 3000f) * (_CreditsTimer.ElapsedMilliseconds - (i * 4000f)); //Check if name is in middle of screen and should go up - if (_CreditNames[i].X <= (CSettings.iRenderW - _CreditNames[i].W) / 2) + if (_CreditNames[i].X <= (CSettings.RenderW - _CreditNames[i].W) / 2) { _CreditNames[i].Direction = EDirection.Up; - _CreditNames[i].StartTimeUp = CreditsTimer.ElapsedMilliseconds; + _CreditNames[i].StartTimeUp = _CreditsTimer.ElapsedMilliseconds; } } break; case EDirection.Up: - _CreditNames[i].Y = 580 - (430f / 3000f) * (CreditsTimer.ElapsedMilliseconds - _CreditNames[i].StartTimeUp); + _CreditNames[i].Y = 580 - (430f / 3000f) * (_CreditsTimer.ElapsedMilliseconds - _CreditNames[i].StartTimeUp); //Set name inactive if (_CreditNames[i].Y <= 160f) @@ -427,11 +427,11 @@ namespace Vocaluxe.Screens if (i == _CreditNames.Count - 1) { //Stop and reset timer for next time - CreditsTimer.Stop(); - CreditsTimer.Reset(); + _CreditsTimer.Stop(); + _CreditsTimer.Reset(); //Start Text-Timer - TextTimer.Start(); + _TextTimer.Start(); active = true; } } @@ -453,8 +453,8 @@ namespace Vocaluxe.Screens } } - if (TextTimer.IsRunning) - active = TextTimer.ElapsedMilliseconds <= 60000; + if (_TextTimer.IsRunning) + active = _TextTimer.ElapsedMilliseconds <= 60000; return active; } diff --git a/Vocaluxe/Screens/CScreenHighscore.cs b/Vocaluxe/Screens/CScreenHighscore.cs index 9df909c1..a568d68a 100644 --- a/Vocaluxe/Screens/CScreenHighscore.cs +++ b/Vocaluxe/Screens/CScreenHighscore.cs @@ -15,14 +15,14 @@ namespace Vocaluxe.Screens get { return 2; } } - private const int NumEntrys = 10; - private const string TextSongName = "TextSongName"; - private const string TextSongMode = "TextSongMode"; - private string[] TextNumber; - private string[] TextName; - private string[] TextScore; - private string[] TextDate; - private string[] ParticleEffectNew; + private const int _NumEntrys = 10; + private const string _TextSongName = "TextSongName"; + private const string _TextSongMode = "TextSongMode"; + private string[] _TextNumber; + private string[] _TextName; + private string[] _TextScore; + private string[] _TextDate; + private string[] _ParticleEffectNew; private List[] _Scores; private List _NewEntryIDs; @@ -35,48 +35,48 @@ namespace Vocaluxe.Screens base.Init(); List texts = new List(); - texts.Add(TextSongName); - texts.Add(TextSongMode); + texts.Add(_TextSongName); + texts.Add(_TextSongMode); - TextNumber = new string[NumEntrys]; - for (int i = 0; i < NumEntrys; i++) + _TextNumber = new string[_NumEntrys]; + for (int i = 0; i < _NumEntrys; i++) { - TextNumber[i] = "TextNumber" + (i + 1).ToString(); - texts.Add(TextNumber[i]); + _TextNumber[i] = "TextNumber" + (i + 1).ToString(); + texts.Add(_TextNumber[i]); } - TextName = new string[NumEntrys]; - for (int i = 0; i < NumEntrys; i++) + _TextName = new string[_NumEntrys]; + for (int i = 0; i < _NumEntrys; i++) { - TextName[i] = "TextName" + (i + 1).ToString(); - texts.Add(TextName[i]); + _TextName[i] = "TextName" + (i + 1).ToString(); + texts.Add(_TextName[i]); } - TextScore = new string[NumEntrys]; - for (int i = 0; i < NumEntrys; i++) + _TextScore = new string[_NumEntrys]; + for (int i = 0; i < _NumEntrys; i++) { - TextScore[i] = "TextScore" + (i + 1).ToString(); - texts.Add(TextScore[i]); + _TextScore[i] = "TextScore" + (i + 1).ToString(); + texts.Add(_TextScore[i]); } - TextDate = new string[NumEntrys]; - for (int i = 0; i < NumEntrys; i++) + _TextDate = new string[_NumEntrys]; + for (int i = 0; i < _NumEntrys; i++) { - TextDate[i] = "TextDate" + (i + 1).ToString(); - texts.Add(TextDate[i]); + _TextDate[i] = "TextDate" + (i + 1).ToString(); + texts.Add(_TextDate[i]); } - ParticleEffectNew = new string[NumEntrys]; - for (int i = 0; i < NumEntrys; i++) - ParticleEffectNew[i] = "ParticleEffectNew" + (i + 1).ToString(); + _ParticleEffectNew = new string[_NumEntrys]; + for (int i = 0; i < _NumEntrys; i++) + _ParticleEffectNew[i] = "ParticleEffectNew" + (i + 1).ToString(); _ThemeTexts = texts.ToArray(); - _ThemeParticleEffects = ParticleEffectNew; + _ThemeParticleEffects = _ParticleEffectNew; _NewEntryIDs = new List(); } - public override bool HandleInput(KeyEvent keyEvent) + public override bool HandleInput(SKeyEvent keyEvent) { if (keyEvent.KeyPressed && !Char.IsControl(keyEvent.Unicode)) {} else @@ -86,23 +86,23 @@ namespace Vocaluxe.Screens case Keys.Escape: case Keys.Back: case Keys.Enter: - LeaveScreen(); + _LeaveScreen(); break; case Keys.Down: - ChangePos(1); + _ChangePos(1); break; case Keys.Up: - ChangePos(-1); + _ChangePos(-1); break; case Keys.Left: - ChangeRound(-1); + _ChangeRound(-1); break; case Keys.Right: - ChangeRound(1); + _ChangeRound(1); break; } } @@ -110,65 +110,65 @@ namespace Vocaluxe.Screens return true; } - public override bool HandleMouse(MouseEvent mouseEvent) + public override bool HandleMouse(SMouseEvent mouseEvent) { if (mouseEvent.LB && IsMouseOver(mouseEvent)) {} if (mouseEvent.LB) - LeaveScreen(); + _LeaveScreen(); if (mouseEvent.RB) - LeaveScreen(); + _LeaveScreen(); if (mouseEvent.MB) { - int LastRound = _Round; - ChangeRound(1); - if (LastRound == _Round) + int lastRound = _Round; + _ChangeRound(1); + if (lastRound == _Round) { _Round = 0; - UpdateRound(); + _UpdateRound(); } } - ChangePos(mouseEvent.Wheel); + _ChangePos(mouseEvent.Wheel); return true; } public override bool UpdateGame() { - for (int p = 0; p < NumEntrys; p++) + for (int p = 0; p < _NumEntrys; p++) { if (_Pos + p < _Scores[_Round].Count) { - Texts[TextNumber[p]].Visible = true; - Texts[TextName[p]].Visible = true; - Texts[TextScore[p]].Visible = true; - Texts[TextDate[p]].Visible = true; + Texts[_TextNumber[p]].Visible = true; + Texts[_TextName[p]].Visible = true; + Texts[_TextScore[p]].Visible = true; + Texts[_TextDate[p]].Visible = true; - Texts[TextNumber[p]].Text = (_Pos + p + 1).ToString(); + Texts[_TextNumber[p]].Text = (_Pos + p + 1).ToString(); string name = _Scores[_Round][_Pos + p].Name; name += " [" + CLanguage.Translate(Enum.GetName(typeof(EGameDifficulty), _Scores[_Round][_Pos + p].Difficulty)) + "]"; if (_IsDuet) name += " (P" + (_Scores[_Round][_Pos + p].LineNr + 1).ToString() + ")"; - Texts[TextName[p]].Text = name; + Texts[_TextName[p]].Text = name; - Texts[TextScore[p]].Text = _Scores[_Round][_Pos + p].Score.ToString("00000"); - Texts[TextDate[p]].Text = _Scores[_Round][_Pos + p].Date; + Texts[_TextScore[p]].Text = _Scores[_Round][_Pos + p].Score.ToString("00000"); + Texts[_TextDate[p]].Text = _Scores[_Round][_Pos + p].Date; - if (isNewEntry(_Scores[_Round][_Pos + p].ID)) - ParticleEffects[ParticleEffectNew[p]].Visible = true; + if (_IsNewEntry(_Scores[_Round][_Pos + p].ID)) + ParticleEffects[_ParticleEffectNew[p]].Visible = true; else - ParticleEffects[ParticleEffectNew[p]].Visible = false; + ParticleEffects[_ParticleEffectNew[p]].Visible = false; } else { - Texts[TextNumber[p]].Visible = false; - Texts[TextName[p]].Visible = false; - Texts[TextScore[p]].Visible = false; - Texts[TextDate[p]].Visible = false; - ParticleEffects[ParticleEffectNew[p]].Visible = false; + Texts[_TextNumber[p]].Visible = false; + Texts[_TextName[p]].Visible = false; + Texts[_TextScore[p]].Visible = false; + Texts[_TextDate[p]].Visible = false; + ParticleEffects[_ParticleEffectNew[p]].Visible = false; } } return true; @@ -179,19 +179,19 @@ namespace Vocaluxe.Screens base.OnShow(); _Round = 0; _Pos = 0; - CPoints _Points = CGame.GetPoints(); - _Scores = new List[_Points.NumRounds]; + CPoints points = CGame.GetPoints(); + _Scores = new List[points.NumRounds]; for (int i = 0; i < _Scores.Length; i++) _Scores[i] = new List(); _NewEntryIDs.Clear(); - AddScoresToDB(); - LoadScores(); - UpdateRound(); + _AddScoresToDB(); + _LoadScores(); + _UpdateRound(); UpdateGame(); } - private bool isNewEntry(int id) + private bool _IsNewEntry(int id) { for (int i = 0; i < _NewEntryIDs.Count; i++) { @@ -202,7 +202,7 @@ namespace Vocaluxe.Screens return false; } - private void AddScoresToDB() + private void _AddScoresToDB() { CPoints points = CGame.GetPoints(); if (points == null) @@ -220,7 +220,7 @@ namespace Vocaluxe.Screens } } - private void LoadScores() + private void _LoadScores() { CPoints points = CGame.GetPoints(); if (points == null) @@ -234,7 +234,7 @@ namespace Vocaluxe.Screens } } - private void UpdateRound() + private void _UpdateRound() { _IsDuet = false; CPoints points = CGame.GetPoints(); @@ -243,65 +243,65 @@ namespace Vocaluxe.Screens if (song == null) return; - Texts[TextSongName].Text = song.Artist + " - " + song.Title; + Texts[_TextSongName].Text = song.Artist + " - " + song.Title; if (points.NumRounds > 1) - Texts[TextSongName].Text += " (" + (_Round + 1) + "/" + points.NumRounds + ")"; + Texts[_TextSongName].Text += " (" + (_Round + 1) + "/" + points.NumRounds + ")"; switch (CGame.GetGameMode(_Round)) { case EGameMode.TR_GAMEMODE_NORMAL: - Texts[TextSongMode].Text = "TR_GAMEMODE_NORMAL"; + Texts[_TextSongMode].Text = "TR_GAMEMODE_NORMAL"; break; case EGameMode.TR_GAMEMODE_MEDLEY: - Texts[TextSongMode].Text = "TR_GAMEMODE_MEDLEY"; + Texts[_TextSongMode].Text = "TR_GAMEMODE_MEDLEY"; break; case EGameMode.TR_GAMEMODE_DUET: - Texts[TextSongMode].Text = "TR_GAMEMODE_DUET"; + Texts[_TextSongMode].Text = "TR_GAMEMODE_DUET"; _IsDuet = true; break; case EGameMode.TR_GAMEMODE_SHORTSONG: - Texts[TextSongMode].Text = "TR_GAMEMODE_SHORTSONG"; + Texts[_TextSongMode].Text = "TR_GAMEMODE_SHORTSONG"; break; default: - Texts[TextSongMode].Text = "TR_GAMEMODE_NORMAL"; + Texts[_TextSongMode].Text = "TR_GAMEMODE_NORMAL"; break; } _Pos = 0; } - private void ChangePos(int Num) + private void _ChangePos(int num) { - if (Num > 0) + if (num > 0) { - if (_Pos + Num + NumEntrys < _Scores[_Round].Count) - _Pos += Num; + if (_Pos + num + _NumEntrys < _Scores[_Round].Count) + _Pos += num; } - if (Num < 0) + if (num < 0) { - _Pos += Num; + _Pos += num; if (_Pos < 0) _Pos = 0; } } - private void ChangeRound(int Num) + private void _ChangeRound(int num) { - CPoints _Points = CGame.GetPoints(); - if (_Round + Num < _Points.NumRounds && _Round + Num > -1) - _Round += Num; - else if (_Round + Num >= _Points.NumRounds) - _Round = _Points.NumRounds - 1; - else if (_Round + Num < 0) + CPoints points = CGame.GetPoints(); + if (_Round + num < points.NumRounds && _Round + num > -1) + _Round += num; + else if (_Round + num >= points.NumRounds) + _Round = points.NumRounds - 1; + else if (_Round + num < 0) _Round = 0; - UpdateRound(); + _UpdateRound(); } - private void LeaveScreen() + private void _LeaveScreen() { CParty.LeavingHighscore(); } diff --git a/Vocaluxe/Screens/CScreenLoad.cs b/Vocaluxe/Screens/CScreenLoad.cs index ae162cb8..3e81c722 100644 --- a/Vocaluxe/Screens/CScreenLoad.cs +++ b/Vocaluxe/Screens/CScreenLoad.cs @@ -13,18 +13,18 @@ namespace Vocaluxe.Screens { get { return 1; } } - private const float WaitTime = 0.5f; //wait time before starting first video + private const float _WaitTime = 0.5f; //wait time before starting first video - private const string TextStatus = "TextStatus"; + private const string _TextStatus = "TextStatus"; - private readonly string[] IntroVideo = new string[] {"IntroIn", "IntroMid", "IntroOut"}; + private readonly string[] _IntroVideo = new string[] {"IntroIn", "IntroMid", "IntroOut"}; private Thread _SongLoaderThread; - private Stopwatch _timer; + private Stopwatch _Timer; private bool _SkipIntro; private int _CurrentIntroVideoNr; private bool _IntroOutPlayed; - private VideoPlayer[] _Intros; + private CVideoPlayer[] _Intros; private bool _BGMusicStartet; @@ -32,14 +32,14 @@ namespace Vocaluxe.Screens { base.Init(); - _ThemeTexts = new string[] {TextStatus}; - _Intros = new VideoPlayer[IntroVideo.Length]; + _ThemeTexts = new string[] {_TextStatus}; + _Intros = new CVideoPlayer[_IntroVideo.Length]; for (int i = 0; i < _Intros.Length; i++) - _Intros[i] = new VideoPlayer(); - _timer = new Stopwatch(); + _Intros[i] = new CVideoPlayer(); + _Timer = new Stopwatch(); } - public override bool HandleInput(KeyEvent keyEvent) + public override bool HandleInput(SKeyEvent keyEvent) { base.HandleInput(keyEvent); @@ -59,7 +59,7 @@ namespace Vocaluxe.Screens return true; } - public override bool HandleMouse(MouseEvent mouseEvent) + public override bool HandleMouse(SMouseEvent mouseEvent) { base.HandleMouse(mouseEvent); @@ -87,7 +87,7 @@ namespace Vocaluxe.Screens _SongLoaderThread = new Thread(CSongs.LoadSongs); _SongLoaderThread.Name = "SongLoader"; - Texts[TextStatus].Text = CLanguage.Translate("TR_SCREENLOAD_TOTAL") + ": 0 " + + Texts[_TextStatus].Text = CLanguage.Translate("TR_SCREENLOAD_TOTAL") + ": 0 " + CLanguage.Translate("TR_SCREENLOAD_SONGS") + " (0 " + CLanguage.Translate("TR_SCREENLOAD_LOADED") + ")"; @@ -98,7 +98,7 @@ namespace Vocaluxe.Screens if (CConfig.VideoBackgrounds == EOffOn.TR_CONFIG_ON) { for (int i = 0; i < _Intros.Length; i++) - _Intros[i].Load(IntroVideo[i]); + _Intros[i].Load(_IntroVideo[i]); } _BGMusicStartet = false; @@ -117,7 +117,7 @@ namespace Vocaluxe.Screens CLog.StartBenchmark(0, "Load Songs Full"); _SongLoaderThread.IsBackground = true; _SongLoaderThread.Start(); - _timer.Start(); + _Timer.Start(); if (CConfig.BackgroundMusic == EOffOn.TR_CONFIG_ON && CConfig.BackgroundMusicSource == EBackgroundMusicSource.TR_CONFIG_NO_OWN_MUSIC && !_BGMusicStartet) @@ -135,12 +135,12 @@ namespace Vocaluxe.Screens public override bool UpdateGame() { - CheckStartIntroVideos(); + _CheckStartIntroVideos(); if (CSettings.GameState == EGameState.EditTheme) - _timer.Stop(); + _Timer.Stop(); else - _timer.Start(); + _Timer.Start(); bool next = CConfig.CoverLoading != ECoverLoading.TR_CONFIG_COVERLOADING_ATSTART || CSongs.CoverLoaded; @@ -150,7 +150,7 @@ namespace Vocaluxe.Screens if (CSettings.GameState == EGameState.Normal) CGraphics.FadeTo(EScreens.ScreenMain); - Texts[TextStatus].Text = + Texts[_TextStatus].Text = CLanguage.Translate("TR_SCREENLOAD_TOTAL") + ": " + CSongs.NumAllSongs.ToString() + " " + CLanguage.Translate("TR_SCREENLOAD_SONGS") + " (" + CSongs.NumSongsWithCoverLoaded + " " + CLanguage.Translate("TR_SCREENLOAD_LOADED") + ")"; @@ -183,8 +183,8 @@ namespace Vocaluxe.Screens public override void OnClose() { base.OnClose(); - _timer.Stop(); - _timer.Reset(); + _Timer.Stop(); + _Timer.Reset(); for (int i = 0; i < _Intros.Length; i++) _Intros[i].Close(); @@ -199,7 +199,7 @@ namespace Vocaluxe.Screens CLog.StopBenchmark(0, "Init Playlists"); } - private void CheckStartIntroVideos() + private void _CheckStartIntroVideos() { if (_IntroOutPlayed) return; diff --git a/Vocaluxe/Screens/CScreenMain.cs b/Vocaluxe/Screens/CScreenMain.cs index b6a0cbd2..e9a4ac57 100644 --- a/Vocaluxe/Screens/CScreenMain.cs +++ b/Vocaluxe/Screens/CScreenMain.cs @@ -12,11 +12,11 @@ namespace Vocaluxe.Screens get { return 1; } } - private const string ButtonSing = "ButtonSing"; - private const string ButtonParty = "ButtonParty"; - private const string ButtonOptions = "ButtonOptions"; - private const string ButtonProfiles = "ButtonProfiles"; - private const string ButtonExit = "ButtonExit"; + private const string _ButtonSing = "ButtonSing"; + private const string _ButtonParty = "ButtonParty"; + private const string _ButtonOptions = "ButtonOptions"; + private const string _ButtonProfiles = "ButtonProfiles"; + private const string _ButtonExit = "ButtonExit"; //CParticleEffect Snowflakes; public override void Init() @@ -24,10 +24,10 @@ namespace Vocaluxe.Screens base.Init(); _ThemeStatics = new string[] {"StaticMenuBar"}; - _ThemeButtons = new string[] {ButtonSing, ButtonParty, ButtonOptions, ButtonProfiles, ButtonExit}; + _ThemeButtons = new string[] {_ButtonSing, _ButtonParty, _ButtonOptions, _ButtonProfiles, _ButtonExit}; } - public override bool HandleInput(KeyEvent keyEvent) + public override bool HandleInput(SKeyEvent keyEvent) { base.HandleInput(keyEvent); @@ -53,22 +53,22 @@ namespace Vocaluxe.Screens break; case Keys.Enter: - if (Buttons[ButtonSing].Selected) + if (Buttons[_ButtonSing].Selected) { CParty.SetNormalGameMode(); CGraphics.FadeTo(EScreens.ScreenSong); } - if (Buttons[ButtonParty].Selected) + if (Buttons[_ButtonParty].Selected) CGraphics.FadeTo(EScreens.ScreenParty); - if (Buttons[ButtonOptions].Selected) + if (Buttons[_ButtonOptions].Selected) CGraphics.FadeTo(EScreens.ScreenOptions); - if (Buttons[ButtonProfiles].Selected) + if (Buttons[_ButtonProfiles].Selected) CGraphics.FadeTo(EScreens.ScreenProfiles); - if (Buttons[ButtonExit].Selected) + if (Buttons[_ButtonExit].Selected) return false; break; @@ -77,28 +77,28 @@ namespace Vocaluxe.Screens return true; } - public override bool HandleMouse(MouseEvent mouseEvent) + public override bool HandleMouse(SMouseEvent mouseEvent) { base.HandleMouse(mouseEvent); if (mouseEvent.LB && IsMouseOver(mouseEvent)) { - if (Buttons[ButtonSing].Selected) + if (Buttons[_ButtonSing].Selected) { CParty.SetNormalGameMode(); CGraphics.FadeTo(EScreens.ScreenSong); } - if (Buttons[ButtonParty].Selected) + if (Buttons[_ButtonParty].Selected) CGraphics.FadeTo(EScreens.ScreenParty); - if (Buttons[ButtonOptions].Selected) + if (Buttons[_ButtonOptions].Selected) CGraphics.FadeTo(EScreens.ScreenOptions); - if (Buttons[ButtonProfiles].Selected) + if (Buttons[_ButtonProfiles].Selected) CGraphics.FadeTo(EScreens.ScreenProfiles); - if (Buttons[ButtonExit].Selected) + if (Buttons[_ButtonExit].Selected) return false; } diff --git a/Vocaluxe/Screens/CScreenNames.cs b/Vocaluxe/Screens/CScreenNames.cs index ef72207d..064c9b7d 100644 --- a/Vocaluxe/Screens/CScreenNames.cs +++ b/Vocaluxe/Screens/CScreenNames.cs @@ -14,33 +14,33 @@ namespace Vocaluxe.Screens get { return 3; } } - private CStatic chooseAvatarStatic; - private int OldMouseX; - private int OldMouseY; + private CStatic _ChooseAvatarStatic; + private int _OldMouseX; + private int _OldMouseY; - private const string SelectSlidePlayerNumber = "SelectSlidePlayerNumber"; - private const string NameSelection = "NameSelection"; - private const string ButtonBack = "ButtonBack"; - private const string ButtonStart = "ButtonStart"; - private const string TextWarningMics = "TextWarningMics"; - private const string StaticWarningMics = "StaticWarningMics"; - private const string TextWarningProfiles = "TextWarningProfiles"; - private const string StaticWarningProfiles = "StaticWarningProfiles"; - private readonly string[] StaticPlayer = new string[] {"StaticPlayer1", "StaticPlayer2", "StaticPlayer3", "StaticPlayer4", "StaticPlayer5", "StaticPlayer6"}; - private readonly string[] StaticPlayerAvatar = new string[] + private const string _SelectSlidePlayerNumber = "SelectSlidePlayerNumber"; + private const string _NameSelection = "NameSelection"; + private const string _ButtonBack = "ButtonBack"; + private const string _ButtonStart = "ButtonStart"; + private const string _TextWarningMics = "TextWarningMics"; + private const string _StaticWarningMics = "StaticWarningMics"; + private const string _TextWarningProfiles = "TextWarningProfiles"; + private const string _StaticWarningProfiles = "StaticWarningProfiles"; + private readonly string[] _StaticPlayer = new string[] {"StaticPlayer1", "StaticPlayer2", "StaticPlayer3", "StaticPlayer4", "StaticPlayer5", "StaticPlayer6"}; + private readonly string[] _StaticPlayerAvatar = new string[] {"StaticPlayerAvatar1", "StaticPlayerAvatar2", "StaticPlayerAvatar3", "StaticPlayerAvatar4", "StaticPlayerAvatar5", "StaticPlayerAvatar6"}; - private readonly string[] TextPlayer = new string[] {"TextPlayer1", "TextPlayer2", "TextPlayer3", "TextPlayer4", "TextPlayer5", "TextPlayer6"}; - private readonly string[] EqualizerPlayer = new string[] + private readonly string[] _TextPlayer = new string[] {"TextPlayer1", "TextPlayer2", "TextPlayer3", "TextPlayer4", "TextPlayer5", "TextPlayer6"}; + private readonly string[] _EqualizerPlayer = new string[] {"EqualizerPlayer1", "EqualizerPlayer2", "EqualizerPlayer3", "EqualizerPlayer4", "EqualizerPlayer5", "EqualizerPlayer6"}; - private readonly string[] SelectSlideDuetPlayer = new string[] + private readonly string[] _SelectSlideDuetPlayer = new string[] {"SelectSlideDuetPlayer1", "SelectSlideDuetPlayer2", "SelectSlideDuetPlayer3", "SelectSlideDuetPlayer4", "SelectSlideDuetPlayer5", "SelectSlideDuetPlayer6"}; - private readonly STexture[] OriginalPlayerAvatarTextures = new STexture[CSettings.MaxNumPlayer]; + private readonly STexture[] _OriginalPlayerAvatarTextures = new STexture[CSettings.MaxNumPlayer]; - private bool selectingMouseActive; - private bool selectingKeyboardActive; - private bool selectingKeyboardUnendless; - private int selectingKeyboardPlayerNr; - private int SelectedPlayerNr; + private bool _SelectingMouseActive; + private bool _SelectingKeyboardActive; + private bool _SelectingKeyboardUnendless; + private int _SelectingKeyboardPlayerNr; + private int _SelectedPlayerNr; private int[] _PlayerNr; @@ -49,291 +49,291 @@ namespace Vocaluxe.Screens base.Init(); List statics = new List(); - foreach (string text in StaticPlayer) + foreach (string text in _StaticPlayer) statics.Add(text); - foreach (string text in StaticPlayerAvatar) + foreach (string text in _StaticPlayerAvatar) statics.Add(text); - statics.Add(StaticWarningMics); - statics.Add(StaticWarningProfiles); + statics.Add(_StaticWarningMics); + statics.Add(_StaticWarningProfiles); _ThemeStatics = statics.ToArray(); List texts = new List(); - texts.Add(SelectSlidePlayerNumber); - texts.AddRange(SelectSlideDuetPlayer); + texts.Add(_SelectSlidePlayerNumber); + texts.AddRange(_SelectSlideDuetPlayer); _ThemeSelectSlides = texts.ToArray(); texts.Clear(); - texts.Add(TextWarningMics); - texts.Add(TextWarningProfiles); - foreach (string text in TextPlayer) + texts.Add(_TextWarningMics); + texts.Add(_TextWarningProfiles); + foreach (string text in _TextPlayer) texts.Add(text); _ThemeTexts = texts.ToArray(); texts.Clear(); - texts.Add(ButtonBack); - texts.Add(ButtonStart); + texts.Add(_ButtonBack); + texts.Add(_ButtonStart); _ThemeButtons = texts.ToArray(); texts.Clear(); - texts.Add(NameSelection); + texts.Add(_NameSelection); _ThemeNameSelections = texts.ToArray(); texts.Clear(); - texts.AddRange(EqualizerPlayer); + texts.AddRange(_EqualizerPlayer); _ThemeEqualizers = texts.ToArray(); - chooseAvatarStatic = GetNewStatic(); - chooseAvatarStatic.Visible = false; + _ChooseAvatarStatic = GetNewStatic(); + _ChooseAvatarStatic.Visible = false; } - public override void LoadTheme(string XmlPath) + public override void LoadTheme(string xmlPath) { - base.LoadTheme(XmlPath); + base.LoadTheme(xmlPath); _PlayerNr = new int[CSettings.MaxNumPlayer]; for (int i = 0; i < _PlayerNr.Length; i++) _PlayerNr[i] = i; for (int i = 0; i < CSettings.MaxNumPlayer; i++) - OriginalPlayerAvatarTextures[i] = Statics[StaticPlayerAvatar[i]].Texture; + _OriginalPlayerAvatarTextures[i] = Statics[_StaticPlayerAvatar[i]].Texture; for (int i = 1; i <= CSettings.MaxNumPlayer; i++) Equalizers["EqualizerPlayer" + i].ScreenHandles = true; } - public override bool HandleInput(KeyEvent keyEvent) + public override bool HandleInput(SKeyEvent keyEvent) { switch (keyEvent.Key) { case Keys.Add: if (CConfig.NumPlayer + 1 <= CSettings.MaxNumPlayer) { - SelectSlides[SelectSlidePlayerNumber].Selection = CConfig.NumPlayer; - UpdatePlayerNumber(); + SelectSlides[_SelectSlidePlayerNumber].Selection = CConfig.NumPlayer; + _UpdatePlayerNumber(); //Update Tiles-List - NameSelections[NameSelection].UpdateList(); + NameSelections[_NameSelection].UpdateList(); } break; case Keys.Subtract: if (CConfig.NumPlayer - 1 > 0) { - SelectSlides[SelectSlidePlayerNumber].Selection = CConfig.NumPlayer - 2; - UpdatePlayerNumber(); + SelectSlides[_SelectSlidePlayerNumber].Selection = CConfig.NumPlayer - 2; + _UpdatePlayerNumber(); //Update Tiles-List - NameSelections[NameSelection].UpdateList(); + NameSelections[_NameSelection].UpdateList(); } break; case Keys.P: - if (!selectingKeyboardActive) + if (!_SelectingKeyboardActive) { - selectingKeyboardPlayerNr = 1; - selectingKeyboardUnendless = true; + _SelectingKeyboardPlayerNr = 1; + _SelectingKeyboardUnendless = true; } else { - if (selectingKeyboardPlayerNr + 1 <= CGame.NumPlayer) - selectingKeyboardPlayerNr++; + if (_SelectingKeyboardPlayerNr + 1 <= CGame.NumPlayer) + _SelectingKeyboardPlayerNr++; else - selectingKeyboardPlayerNr = 1; - NameSelections[NameSelection].KeyboardSelection(true, selectingKeyboardPlayerNr); + _SelectingKeyboardPlayerNr = 1; + NameSelections[_NameSelection].KeyboardSelection(true, _SelectingKeyboardPlayerNr); } break; } //Check if selecting with keyboard is active - if (selectingKeyboardActive) + if (_SelectingKeyboardActive) { //Handle left/right/up/down - NameSelections[NameSelection].HandleInput(keyEvent); + NameSelections[_NameSelection].HandleInput(keyEvent); switch (keyEvent.Key) { case Keys.Enter: //Check, if a player is selected - if (NameSelections[NameSelection].Selection > -1) + if (NameSelections[_NameSelection].Selection > -1) { - SelectedPlayerNr = NameSelections[NameSelection].Selection; + _SelectedPlayerNr = NameSelections[_NameSelection].Selection; //Update Game-infos with new player - CGame.Player[selectingKeyboardPlayerNr - 1].Name = CProfiles.Profiles[SelectedPlayerNr].PlayerName; - CGame.Player[selectingKeyboardPlayerNr - 1].Difficulty = CProfiles.Profiles[SelectedPlayerNr].Difficulty; - CGame.Player[selectingKeyboardPlayerNr - 1].ProfileID = SelectedPlayerNr; + CGame.Player[_SelectingKeyboardPlayerNr - 1].Name = CProfiles.Profiles[_SelectedPlayerNr].PlayerName; + CGame.Player[_SelectingKeyboardPlayerNr - 1].Difficulty = CProfiles.Profiles[_SelectedPlayerNr].Difficulty; + CGame.Player[_SelectingKeyboardPlayerNr - 1].ProfileID = _SelectedPlayerNr; //Update config for default players. - CConfig.Players[selectingKeyboardPlayerNr - 1] = CProfiles.Profiles[SelectedPlayerNr].ProfileFile; + CConfig.Players[_SelectingKeyboardPlayerNr - 1] = CProfiles.Profiles[_SelectedPlayerNr].ProfileFile; CConfig.SaveConfig(); //Update texture and name - Statics[StaticPlayerAvatar[selectingKeyboardPlayerNr - 1]].Texture = CProfiles.Profiles[SelectedPlayerNr].Avatar.Texture; - Texts[TextPlayer[selectingKeyboardPlayerNr - 1]].Text = CProfiles.Profiles[SelectedPlayerNr].PlayerName; + Statics[_StaticPlayerAvatar[_SelectingKeyboardPlayerNr - 1]].Texture = CProfiles.Profiles[_SelectedPlayerNr].Avatar.Texture; + Texts[_TextPlayer[_SelectingKeyboardPlayerNr - 1]].Text = CProfiles.Profiles[_SelectedPlayerNr].PlayerName; //Update profile-warning - CheckPlayers(); + _CheckPlayers(); //Update Tiles-List - NameSelections[NameSelection].UpdateList(); - SetInteractionToButton(Buttons[ButtonStart]); + NameSelections[_NameSelection].UpdateList(); + SetInteractionToButton(Buttons[_ButtonStart]); } //Started selecting with 'P' - if (selectingKeyboardUnendless) + if (_SelectingKeyboardUnendless) { - if (selectingKeyboardPlayerNr == CGame.NumPlayer) + if (_SelectingKeyboardPlayerNr == CGame.NumPlayer) { //Reset all values - selectingKeyboardPlayerNr = 0; - selectingKeyboardActive = false; - NameSelections[NameSelection].KeyboardSelection(false, -1); + _SelectingKeyboardPlayerNr = 0; + _SelectingKeyboardActive = false; + NameSelections[_NameSelection].KeyboardSelection(false, -1); } else { - selectingKeyboardPlayerNr++; - NameSelections[NameSelection].KeyboardSelection(true, selectingKeyboardPlayerNr); + _SelectingKeyboardPlayerNr++; + NameSelections[_NameSelection].KeyboardSelection(true, _SelectingKeyboardPlayerNr); } } else { //Reset all values - selectingKeyboardPlayerNr = 0; - selectingKeyboardActive = false; - NameSelections[NameSelection].KeyboardSelection(false, -1); + _SelectingKeyboardPlayerNr = 0; + _SelectingKeyboardActive = false; + NameSelections[_NameSelection].KeyboardSelection(false, -1); } break; case Keys.D1: case Keys.NumPad1: - if (selectingKeyboardPlayerNr == 1) + if (_SelectingKeyboardPlayerNr == 1) { //Reset all values - selectingKeyboardPlayerNr = 0; - selectingKeyboardActive = false; - NameSelections[NameSelection].KeyboardSelection(false, -1); + _SelectingKeyboardPlayerNr = 0; + _SelectingKeyboardActive = false; + NameSelections[_NameSelection].KeyboardSelection(false, -1); } else { - selectingKeyboardPlayerNr = 1; - NameSelections[NameSelection].KeyboardSelection(true, 1); + _SelectingKeyboardPlayerNr = 1; + NameSelections[_NameSelection].KeyboardSelection(true, 1); } - selectingKeyboardUnendless = false; + _SelectingKeyboardUnendless = false; break; case Keys.D2: case Keys.NumPad2: - if (selectingKeyboardPlayerNr == 2) + if (_SelectingKeyboardPlayerNr == 2) { //Reset all values - selectingKeyboardPlayerNr = 0; - selectingKeyboardActive = false; - NameSelections[NameSelection].KeyboardSelection(false, -1); + _SelectingKeyboardPlayerNr = 0; + _SelectingKeyboardActive = false; + NameSelections[_NameSelection].KeyboardSelection(false, -1); } else { - selectingKeyboardPlayerNr = 2; - NameSelections[NameSelection].KeyboardSelection(true, 2); + _SelectingKeyboardPlayerNr = 2; + NameSelections[_NameSelection].KeyboardSelection(true, 2); } - selectingKeyboardUnendless = false; + _SelectingKeyboardUnendless = false; break; case Keys.D3: case Keys.NumPad3: - if (selectingKeyboardPlayerNr == 3) + if (_SelectingKeyboardPlayerNr == 3) { //Reset all values - selectingKeyboardPlayerNr = 0; - selectingKeyboardActive = false; - NameSelections[NameSelection].KeyboardSelection(false, -1); + _SelectingKeyboardPlayerNr = 0; + _SelectingKeyboardActive = false; + NameSelections[_NameSelection].KeyboardSelection(false, -1); } else { - selectingKeyboardPlayerNr = 3; - NameSelections[NameSelection].KeyboardSelection(true, 3); + _SelectingKeyboardPlayerNr = 3; + NameSelections[_NameSelection].KeyboardSelection(true, 3); } - selectingKeyboardUnendless = false; + _SelectingKeyboardUnendless = false; break; case Keys.D4: case Keys.NumPad4: - if (selectingKeyboardPlayerNr == 4) + if (_SelectingKeyboardPlayerNr == 4) { //Reset all values - selectingKeyboardPlayerNr = 0; - selectingKeyboardActive = false; - NameSelections[NameSelection].KeyboardSelection(false, -1); + _SelectingKeyboardPlayerNr = 0; + _SelectingKeyboardActive = false; + NameSelections[_NameSelection].KeyboardSelection(false, -1); } else { - selectingKeyboardPlayerNr = 4; - NameSelections[NameSelection].KeyboardSelection(true, 4); + _SelectingKeyboardPlayerNr = 4; + NameSelections[_NameSelection].KeyboardSelection(true, 4); } - selectingKeyboardUnendless = false; + _SelectingKeyboardUnendless = false; break; case Keys.D5: case Keys.NumPad5: - if (selectingKeyboardPlayerNr == 5) + if (_SelectingKeyboardPlayerNr == 5) { //Reset all values - selectingKeyboardPlayerNr = 0; - selectingKeyboardActive = false; - NameSelections[NameSelection].KeyboardSelection(false, -1); + _SelectingKeyboardPlayerNr = 0; + _SelectingKeyboardActive = false; + NameSelections[_NameSelection].KeyboardSelection(false, -1); } else { - selectingKeyboardPlayerNr = 5; - NameSelections[NameSelection].KeyboardSelection(true, 5); + _SelectingKeyboardPlayerNr = 5; + NameSelections[_NameSelection].KeyboardSelection(true, 5); } - selectingKeyboardUnendless = false; + _SelectingKeyboardUnendless = false; break; case Keys.D6: case Keys.NumPad6: - if (selectingKeyboardPlayerNr == 6) + if (_SelectingKeyboardPlayerNr == 6) { //Reset all values - selectingKeyboardPlayerNr = 0; - selectingKeyboardActive = false; - NameSelections[NameSelection].KeyboardSelection(false, -1); + _SelectingKeyboardPlayerNr = 0; + _SelectingKeyboardActive = false; + NameSelections[_NameSelection].KeyboardSelection(false, -1); } else { - selectingKeyboardPlayerNr = 6; - NameSelections[NameSelection].KeyboardSelection(true, 6); + _SelectingKeyboardPlayerNr = 6; + NameSelections[_NameSelection].KeyboardSelection(true, 6); } - selectingKeyboardUnendless = false; + _SelectingKeyboardUnendless = false; break; case Keys.Escape: //Reset all values - selectingKeyboardPlayerNr = 0; - selectingKeyboardActive = false; - selectingKeyboardUnendless = false; - NameSelections[NameSelection].KeyboardSelection(false, -1); + _SelectingKeyboardPlayerNr = 0; + _SelectingKeyboardActive = false; + _SelectingKeyboardUnendless = false; + NameSelections[_NameSelection].KeyboardSelection(false, -1); break; case Keys.Delete: //Delete profile-selection - CGame.Player[selectingKeyboardPlayerNr - 1].ProfileID = -1; - CGame.Player[selectingKeyboardPlayerNr - 1].Name = String.Empty; - CGame.Player[selectingKeyboardPlayerNr - 1].Difficulty = EGameDifficulty.TR_CONFIG_EASY; + CGame.Player[_SelectingKeyboardPlayerNr - 1].ProfileID = -1; + CGame.Player[_SelectingKeyboardPlayerNr - 1].Name = String.Empty; + CGame.Player[_SelectingKeyboardPlayerNr - 1].Difficulty = EGameDifficulty.TR_CONFIG_EASY; //Update config for default players. - CConfig.Players[selectingKeyboardPlayerNr - 1] = String.Empty; + CConfig.Players[_SelectingKeyboardPlayerNr - 1] = String.Empty; CConfig.SaveConfig(); //Update texture and name - Statics[StaticPlayerAvatar[selectingKeyboardPlayerNr - 1]].Texture = OriginalPlayerAvatarTextures[selectingKeyboardPlayerNr - 1]; - Texts[TextPlayer[selectingKeyboardPlayerNr - 1]].Text = CLanguage.Translate("TR_SCREENNAMES_PLAYER") + " " + selectingKeyboardPlayerNr.ToString(); + Statics[_StaticPlayerAvatar[_SelectingKeyboardPlayerNr - 1]].Texture = _OriginalPlayerAvatarTextures[_SelectingKeyboardPlayerNr - 1]; + Texts[_TextPlayer[_SelectingKeyboardPlayerNr - 1]].Text = CLanguage.Translate("TR_SCREENNAMES_PLAYER") + " " + _SelectingKeyboardPlayerNr.ToString(); //Update profile-warning - CheckPlayers(); + _CheckPlayers(); //Reset all values - selectingKeyboardPlayerNr = 0; - selectingKeyboardActive = false; - NameSelections[NameSelection].KeyboardSelection(false, -1); + _SelectingKeyboardPlayerNr = 0; + _SelectingKeyboardActive = false; + NameSelections[_NameSelection].KeyboardSelection(false, -1); //Update Tiles-List - NameSelections[NameSelection].UpdateList(); + NameSelections[_NameSelection].UpdateList(); break; case Keys.F10: if (CGame.GetNumSongs() == 1 && CGame.GetSong(1).IsDuet) { - if (SelectSlides[SelectSlideDuetPlayer[selectingKeyboardPlayerNr - 1]].Selection == 0) - SelectSlides[SelectSlideDuetPlayer[selectingKeyboardPlayerNr - 1]].Selection = 1; + if (SelectSlides[_SelectSlideDuetPlayer[_SelectingKeyboardPlayerNr - 1]].Selection == 0) + SelectSlides[_SelectSlideDuetPlayer[_SelectingKeyboardPlayerNr - 1]].Selection = 1; else - SelectSlides[SelectSlideDuetPlayer[selectingKeyboardPlayerNr - 1]].Selection = 0; + SelectSlides[_SelectSlideDuetPlayer[_SelectingKeyboardPlayerNr - 1]].Selection = 0; //Reset all values - selectingKeyboardPlayerNr = 0; - selectingKeyboardActive = false; - selectingKeyboardUnendless = false; - NameSelections[NameSelection].KeyboardSelection(false, -1); - SetInteractionToButton(Buttons[ButtonStart]); + _SelectingKeyboardPlayerNr = 0; + _SelectingKeyboardActive = false; + _SelectingKeyboardUnendless = false; + NameSelections[_NameSelection].KeyboardSelection(false, -1); + SetInteractionToButton(Buttons[_ButtonStart]); } break; } @@ -352,7 +352,7 @@ namespace Vocaluxe.Screens case Keys.Enter: - if (!processed && Buttons[ButtonBack].Selected) + if (!processed && Buttons[_ButtonBack].Selected) { processed = true; CGraphics.FadeTo(EScreens.ScreenSong); @@ -361,132 +361,132 @@ namespace Vocaluxe.Screens if (!processed /* && Buttons[ButtonStart].Selected */) { processed = true; - StartSong(); + _StartSong(); } break; case Keys.D1: case Keys.NumPad1: - selectingKeyboardPlayerNr = 1; + _SelectingKeyboardPlayerNr = 1; break; case Keys.D2: case Keys.NumPad2: - selectingKeyboardPlayerNr = 2; + _SelectingKeyboardPlayerNr = 2; break; case Keys.D3: case Keys.NumPad3: - selectingKeyboardPlayerNr = 3; + _SelectingKeyboardPlayerNr = 3; break; case Keys.D4: case Keys.NumPad4: - selectingKeyboardPlayerNr = 4; + _SelectingKeyboardPlayerNr = 4; break; case Keys.D5: case Keys.NumPad5: - selectingKeyboardPlayerNr = 5; + _SelectingKeyboardPlayerNr = 5; break; case Keys.D6: case Keys.NumPad6: - selectingKeyboardPlayerNr = 6; + _SelectingKeyboardPlayerNr = 6; break; } if (!processed) - UpdatePlayerNumber(); + _UpdatePlayerNumber(); - if (selectingKeyboardPlayerNr > 0 && selectingKeyboardPlayerNr <= CConfig.NumPlayer) + if (_SelectingKeyboardPlayerNr > 0 && _SelectingKeyboardPlayerNr <= CConfig.NumPlayer) { - selectingKeyboardActive = true; - NameSelections[NameSelection].KeyboardSelection(true, selectingKeyboardPlayerNr); + _SelectingKeyboardActive = true; + NameSelections[_NameSelection].KeyboardSelection(true, _SelectingKeyboardPlayerNr); } } return true; } - public override bool HandleMouse(MouseEvent mouseEvent) + public override bool HandleMouse(SMouseEvent mouseEvent) { base.HandleMouse(mouseEvent); //Check if LeftButton is hold and Select-Mode inactive - if (mouseEvent.LBH && !selectingMouseActive) + if (mouseEvent.LBH && !_SelectingMouseActive) { //Save mouse-coords - OldMouseX = mouseEvent.X; - OldMouseY = mouseEvent.Y; + _OldMouseX = mouseEvent.X; + _OldMouseY = mouseEvent.Y; //Check if mouse if over tile - if (NameSelections[NameSelection].isOverTile(mouseEvent)) + if (NameSelections[_NameSelection].IsOverTile(mouseEvent)) { //Get player-number of tile - SelectedPlayerNr = NameSelections[NameSelection].TilePlayerNr(mouseEvent); - if (SelectedPlayerNr != -1) + _SelectedPlayerNr = NameSelections[_NameSelection].TilePlayerNr(mouseEvent); + if (_SelectedPlayerNr != -1) { //Activate mouse-selecting - selectingMouseActive = true; + _SelectingMouseActive = true; //Update of Drag/Drop-Texture - CStatic SelectedPlayer = NameSelections[NameSelection].TilePlayerAvatar(mouseEvent); - chooseAvatarStatic.Visible = true; - chooseAvatarStatic.Rect = SelectedPlayer.Rect; - chooseAvatarStatic.Rect.Z = CSettings.ZNear; - chooseAvatarStatic.Color = new SColorF(1, 1, 1, 1); - chooseAvatarStatic.Texture = SelectedPlayer.Texture; + CStatic selectedPlayer = NameSelections[_NameSelection].TilePlayerAvatar(mouseEvent); + _ChooseAvatarStatic.Visible = true; + _ChooseAvatarStatic.Rect = selectedPlayer.Rect; + _ChooseAvatarStatic.Rect.Z = CSettings.ZNear; + _ChooseAvatarStatic.Color = new SColorF(1, 1, 1, 1); + _ChooseAvatarStatic.Texture = selectedPlayer.Texture; } } } //Check if LeftButton is hold and Select-Mode active - if (mouseEvent.LBH && selectingMouseActive) + if (mouseEvent.LBH && _SelectingMouseActive) { //Update coords for Drag/Drop-Texture - chooseAvatarStatic.Rect.X += mouseEvent.X - OldMouseX; - chooseAvatarStatic.Rect.Y += mouseEvent.Y - OldMouseY; - OldMouseX = mouseEvent.X; - OldMouseY = mouseEvent.Y; + _ChooseAvatarStatic.Rect.X += mouseEvent.X - _OldMouseX; + _ChooseAvatarStatic.Rect.Y += mouseEvent.Y - _OldMouseY; + _OldMouseX = mouseEvent.X; + _OldMouseY = mouseEvent.Y; } - // LeftButton isn't hold anymore, but Selec-Mode is still active -> "Drop" of Avatar - else if (selectingMouseActive) + // LeftButton isn't hold anymore, but Selec-Mode is still active -> "ReplacedStr:::0:::" of Avatar + else if (_SelectingMouseActive) { //Check if really a player was selected - if (SelectedPlayerNr != -1) + if (_SelectedPlayerNr != -1) { //Foreach Drop-Area - for (int i = 0; i < StaticPlayer.Length; i++) + for (int i = 0; i < _StaticPlayer.Length; i++) { - //Check first, if area is "active" - if (Statics[StaticPlayer[i]].Visible) + //Check first, if area is "ReplacedStr:::1:::" + if (Statics[_StaticPlayer[i]].Visible) { //Check if Mouse is in area - if (CHelper.IsInBounds(Statics[StaticPlayer[i]].Rect, mouseEvent)) + if (CHelper.IsInBounds(Statics[_StaticPlayer[i]].Rect, mouseEvent)) { //Update Game-infos with new player - CGame.Player[i].Name = CProfiles.Profiles[SelectedPlayerNr].PlayerName; - CGame.Player[i].Difficulty = CProfiles.Profiles[SelectedPlayerNr].Difficulty; - CGame.Player[i].ProfileID = SelectedPlayerNr; + CGame.Player[i].Name = CProfiles.Profiles[_SelectedPlayerNr].PlayerName; + CGame.Player[i].Difficulty = CProfiles.Profiles[_SelectedPlayerNr].Difficulty; + CGame.Player[i].ProfileID = _SelectedPlayerNr; //Update config for default players. - CConfig.Players[i] = CProfiles.Profiles[SelectedPlayerNr].ProfileFile; + CConfig.Players[i] = CProfiles.Profiles[_SelectedPlayerNr].ProfileFile; CConfig.SaveConfig(); //Update texture and name - Statics[StaticPlayerAvatar[i]].Texture = chooseAvatarStatic.Texture; - Texts[TextPlayer[i]].Text = CProfiles.Profiles[SelectedPlayerNr].PlayerName; + Statics[_StaticPlayerAvatar[i]].Texture = _ChooseAvatarStatic.Texture; + Texts[_TextPlayer[i]].Text = CProfiles.Profiles[_SelectedPlayerNr].PlayerName; //Update profile-warning - CheckPlayers(); + _CheckPlayers(); //Update Tiles-List - NameSelections[NameSelection].UpdateList(); + NameSelections[_NameSelection].UpdateList(); } } } - SelectedPlayerNr = -1; + _SelectedPlayerNr = -1; } //Reset variables - selectingMouseActive = false; - chooseAvatarStatic.Visible = false; + _SelectingMouseActive = false; + _ChooseAvatarStatic.Visible = false; } if (mouseEvent.LB && IsMouseOver(mouseEvent)) {} @@ -495,22 +495,22 @@ namespace Vocaluxe.Screens { bool processed = false; - if (!processed && Buttons[ButtonBack].Selected) + if (!processed && Buttons[_ButtonBack].Selected) { processed = true; CGraphics.FadeTo(EScreens.ScreenSong); } - if (!processed && Buttons[ButtonStart].Selected) + if (!processed && Buttons[_ButtonStart].Selected) { processed = true; - StartSong(); + _StartSong(); } if (!processed) - UpdatePlayerNumber(); + _UpdatePlayerNumber(); //Update Tiles-List - NameSelections[NameSelection].UpdateList(); + NameSelections[_NameSelection].UpdateList(); } if (mouseEvent.RB) @@ -519,7 +519,7 @@ namespace Vocaluxe.Screens //Remove profile-selection for (int i = 0; i < CConfig.NumPlayer; i++) { - if (CHelper.IsInBounds(Statics[StaticPlayer[i]].Rect, mouseEvent)) + if (CHelper.IsInBounds(Statics[_StaticPlayer[i]].Rect, mouseEvent)) { CGame.Player[i].ProfileID = -1; CGame.Player[i].Name = String.Empty; @@ -528,12 +528,12 @@ namespace Vocaluxe.Screens CConfig.Players[i] = String.Empty; CConfig.SaveConfig(); //Update texture and name - Statics[StaticPlayerAvatar[i]].Texture = OriginalPlayerAvatarTextures[i]; - Texts[TextPlayer[i]].Text = CLanguage.Translate("TR_SCREENNAMES_PLAYER") + " " + (i + 1).ToString(); + Statics[_StaticPlayerAvatar[i]].Texture = _OriginalPlayerAvatarTextures[i]; + Texts[_TextPlayer[i]].Text = CLanguage.Translate("TR_SCREENNAMES_PLAYER") + " " + (i + 1).ToString(); //Update profile-warning - CheckPlayers(); + _CheckPlayers(); //Update Tiles-List - NameSelections[NameSelection].UpdateList(); + NameSelections[_NameSelection].UpdateList(); exit = false; } } @@ -544,10 +544,10 @@ namespace Vocaluxe.Screens //Check mouse-wheel for scrolling if (mouseEvent.Wheel != 0) { - if (CHelper.IsInBounds(NameSelections[NameSelection].Rect, mouseEvent)) + if (CHelper.IsInBounds(NameSelections[_NameSelection].Rect, mouseEvent)) { - int offset = NameSelections[NameSelection]._Offset + mouseEvent.Wheel; - NameSelections[NameSelection].UpdateList(offset); + int offset = NameSelections[_NameSelection].Offset + mouseEvent.Wheel; + NameSelections[_NameSelection].UpdateList(offset); } } return true; @@ -568,12 +568,12 @@ namespace Vocaluxe.Screens base.OnShow(); CSound.RecordStart(); - NameSelections[NameSelection].Init(); + NameSelections[_NameSelection].Init(); - UpdateSlides(); - UpdatePlayerNumber(); - CheckMics(); - CheckPlayers(); + _UpdateSlides(); + _UpdatePlayerNumber(); + _CheckMics(); + _CheckPlayers(); for (int i = 0; i < CSettings.MaxNumPlayer; i++) { @@ -582,29 +582,29 @@ namespace Vocaluxe.Screens { if (CGame.Player[i].ProfileID > -1 && CProfiles.NumProfiles > CGame.Player[i].ProfileID) { - Statics[StaticPlayerAvatar[i]].Texture = CProfiles.Profiles[CGame.Player[i].ProfileID].Avatar.Texture; - Texts[TextPlayer[i]].Text = CProfiles.Profiles[CGame.Player[i].ProfileID].PlayerName; + Statics[_StaticPlayerAvatar[i]].Texture = CProfiles.Profiles[CGame.Player[i].ProfileID].Avatar.Texture; + Texts[_TextPlayer[i]].Text = CProfiles.Profiles[CGame.Player[i].ProfileID].PlayerName; } } if (CGame.GetNumSongs() == 1 && CGame.GetSong(1).IsDuet) { - SelectSlides[SelectSlideDuetPlayer[i]].Clear(); + SelectSlides[_SelectSlideDuetPlayer[i]].Clear(); if (i + 1 <= CGame.NumPlayer) - SelectSlides[SelectSlideDuetPlayer[i]].Visible = true; + SelectSlides[_SelectSlideDuetPlayer[i]].Visible = true; else - SelectSlides[SelectSlideDuetPlayer[i]].Visible = false; - SelectSlides[SelectSlideDuetPlayer[i]].AddValue(CGame.GetSong(1).DuetPart1); - SelectSlides[SelectSlideDuetPlayer[i]].AddValue(CGame.GetSong(1).DuetPart2); + SelectSlides[_SelectSlideDuetPlayer[i]].Visible = false; + SelectSlides[_SelectSlideDuetPlayer[i]].AddValue(CGame.GetSong(1).DuetPart1); + SelectSlides[_SelectSlideDuetPlayer[i]].AddValue(CGame.GetSong(1).DuetPart2); if ((i + 1) % 2 == 0) - SelectSlides[SelectSlideDuetPlayer[i]].Selection = 1; + SelectSlides[_SelectSlideDuetPlayer[i]].Selection = 1; else - SelectSlides[SelectSlideDuetPlayer[i]].Selection = 0; + SelectSlides[_SelectSlideDuetPlayer[i]].Selection = 0; } else - SelectSlides[SelectSlideDuetPlayer[i]].Visible = false; + SelectSlides[_SelectSlideDuetPlayer[i]].Visible = false; } - SetInteractionToButton(Buttons[ButtonStart]); + SetInteractionToButton(Buttons[_ButtonStart]); } public override void OnClose() @@ -617,14 +617,14 @@ namespace Vocaluxe.Screens { base.Draw(); - if (chooseAvatarStatic.Visible) - chooseAvatarStatic.Draw(); + if (_ChooseAvatarStatic.Visible) + _ChooseAvatarStatic.Draw(); for (int i = 1; i <= CGame.NumPlayer; i++) Equalizers["EqualizerPlayer" + i].Draw(); return true; } - private void StartSong() + private void _StartSong() { for (int i = 0; i < CGame.NumPlayer; i++) { @@ -641,24 +641,24 @@ namespace Vocaluxe.Screens CGame.Player[i].Name = ""; } if (CGame.GetNumSongs() == 1 && CGame.GetSong(1).IsDuet) - CGame.Player[i].LineNr = SelectSlides[SelectSlideDuetPlayer[i]].Selection; + CGame.Player[i].LineNr = SelectSlides[_SelectSlideDuetPlayer[i]].Selection; } CGraphics.FadeTo(EScreens.ScreenSing); } - private void UpdateSlides() + private void _UpdateSlides() { - SelectSlides[SelectSlidePlayerNumber].Clear(); + 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].AddValue(CLanguage.Translate("TR_SCREENNAMES_" + i + "PLAYER")); + SelectSlides[_SelectSlidePlayerNumber].Selection = CConfig.NumPlayer - 1; } - private void UpdatePlayerNumber() + private void _UpdatePlayerNumber() { - CConfig.NumPlayer = SelectSlides[SelectSlidePlayerNumber].Selection + 1; - CGame.NumPlayer = SelectSlides[SelectSlidePlayerNumber].Selection + 1; + CConfig.NumPlayer = SelectSlides[_SelectSlidePlayerNumber].Selection + 1; + CGame.NumPlayer = SelectSlides[_SelectSlidePlayerNumber].Selection + 1; for (int i = 1; i <= CSettings.MaxNumPlayer; i++) { if (i <= CGame.NumPlayer) @@ -682,84 +682,84 @@ namespace Vocaluxe.Screens } } CConfig.SaveConfig(); - CheckMics(); - CheckPlayers(); + _CheckMics(); + _CheckPlayers(); } - private void CheckMics() + private void _CheckMics() { - List _PlayerWithoutMicro = new List(); + List playerWithoutMicro = new List(); for (int player = 0; player < CConfig.NumPlayer; player++) { if (!CConfig.IsMicConfig(player + 1)) - _PlayerWithoutMicro.Add(player + 1); + playerWithoutMicro.Add(player + 1); } - if (_PlayerWithoutMicro.Count > 0) + if (playerWithoutMicro.Count > 0) { - Statics[StaticWarningMics].Visible = true; - Texts[TextWarningMics].Visible = true; + Statics[_StaticWarningMics].Visible = true; + Texts[_TextWarningMics].Visible = true; - if (_PlayerWithoutMicro.Count > 1) + if (playerWithoutMicro.Count > 1) { - string PlayerNums = string.Empty; - for (int i = 0; i < _PlayerWithoutMicro.Count; i++) + string playerNums = string.Empty; + for (int i = 0; i < playerWithoutMicro.Count; i++) { - if (_PlayerWithoutMicro.Count - 1 == i) - PlayerNums += _PlayerWithoutMicro[i].ToString(); - else if (_PlayerWithoutMicro.Count - 2 == i) - PlayerNums += _PlayerWithoutMicro[i].ToString() + " " + CLanguage.Translate("TR_GENERAL_AND") + " "; + if (playerWithoutMicro.Count - 1 == i) + playerNums += playerWithoutMicro[i].ToString(); + else if (playerWithoutMicro.Count - 2 == i) + playerNums += playerWithoutMicro[i].ToString() + " " + CLanguage.Translate("TR_GENERAL_AND") + " "; else - PlayerNums += _PlayerWithoutMicro[i].ToString() + ", "; + playerNums += playerWithoutMicro[i].ToString() + ", "; } - Texts[TextWarningMics].Text = CLanguage.Translate("TR_SCREENNAMES_WARNING_MICS_PL").Replace("%v", PlayerNums); + Texts[_TextWarningMics].Text = CLanguage.Translate("TR_SCREENNAMES_WARNING_MICS_PL").Replace("%v", playerNums); } else - Texts[TextWarningMics].Text = CLanguage.Translate("TR_SCREENNAMES_WARNING_MICS_SG").Replace("%v", _PlayerWithoutMicro[0].ToString()); + Texts[_TextWarningMics].Text = CLanguage.Translate("TR_SCREENNAMES_WARNING_MICS_SG").Replace("%v", playerWithoutMicro[0].ToString()); } else { - Statics[StaticWarningMics].Visible = false; - Texts[TextWarningMics].Visible = false; + Statics[_StaticWarningMics].Visible = false; + Texts[_TextWarningMics].Visible = false; } } - private void CheckPlayers() + private void _CheckPlayers() { - List _PlayerWithoutProfile = new List(); + List playerWithoutProfile = new List(); for (int player = 0; player < CConfig.NumPlayer; player++) { if (CGame.Player[player].ProfileID < 0) - _PlayerWithoutProfile.Add(player + 1); + playerWithoutProfile.Add(player + 1); } - if (_PlayerWithoutProfile.Count > 0) + if (playerWithoutProfile.Count > 0) { - Statics[StaticWarningProfiles].Visible = true; - Texts[TextWarningProfiles].Visible = true; + Statics[_StaticWarningProfiles].Visible = true; + Texts[_TextWarningProfiles].Visible = true; - if (_PlayerWithoutProfile.Count > 1) + if (playerWithoutProfile.Count > 1) { - string PlayerNums = string.Empty; - for (int i = 0; i < _PlayerWithoutProfile.Count; i++) + string playerNums = string.Empty; + for (int i = 0; i < playerWithoutProfile.Count; i++) { - if (_PlayerWithoutProfile.Count - 1 == i) - PlayerNums += _PlayerWithoutProfile[i].ToString(); - else if (_PlayerWithoutProfile.Count - 2 == i) - PlayerNums += _PlayerWithoutProfile[i].ToString() + " " + CLanguage.Translate("TR_GENERAL_AND") + " "; + if (playerWithoutProfile.Count - 1 == i) + playerNums += playerWithoutProfile[i].ToString(); + else if (playerWithoutProfile.Count - 2 == i) + playerNums += playerWithoutProfile[i].ToString() + " " + CLanguage.Translate("TR_GENERAL_AND") + " "; else - PlayerNums += _PlayerWithoutProfile[i].ToString() + ", "; + playerNums += playerWithoutProfile[i].ToString() + ", "; } - Texts[TextWarningProfiles].Text = CLanguage.Translate("TR_SCREENNAMES_WARNING_PROFILES_PL").Replace("%v", PlayerNums); + Texts[_TextWarningProfiles].Text = CLanguage.Translate("TR_SCREENNAMES_WARNING_PROFILES_PL").Replace("%v", playerNums); } else - Texts[TextWarningProfiles].Text = CLanguage.Translate("TR_SCREENNAMES_WARNING_PROFILES_SG").Replace("%v", _PlayerWithoutProfile[0].ToString()); + Texts[_TextWarningProfiles].Text = CLanguage.Translate("TR_SCREENNAMES_WARNING_PROFILES_SG").Replace("%v", playerWithoutProfile[0].ToString()); } else { - Statics[StaticWarningProfiles].Visible = false; - Texts[TextWarningProfiles].Visible = false; + Statics[_StaticWarningProfiles].Visible = false; + Texts[_TextWarningProfiles].Visible = false; } } } diff --git a/Vocaluxe/Screens/CScreenOptions.cs b/Vocaluxe/Screens/CScreenOptions.cs index 66d08271..4d324f53 100644 --- a/Vocaluxe/Screens/CScreenOptions.cs +++ b/Vocaluxe/Screens/CScreenOptions.cs @@ -12,21 +12,21 @@ namespace Vocaluxe.Screens get { return 1; } } - private const string ButtonOptionsGame = "ButtonOptionsGame"; - private const string ButtonOptionsSound = "ButtonOptionsSound"; - private const string ButtonOptionsRecord = "ButtonOptionsRecord"; - private const string ButtonOptionsVideo = "ButtonOptionsVideo"; - private const string ButtonOptionsLyrics = "ButtonOptionsLyrics"; - private const string ButtonOptionsTheme = "ButtonOptionsTheme"; + private const string _ButtonOptionsGame = "ButtonOptionsGame"; + private const string _ButtonOptionsSound = "ButtonOptionsSound"; + private const string _ButtonOptionsRecord = "ButtonOptionsRecord"; + private const string _ButtonOptionsVideo = "ButtonOptionsVideo"; + private const string _ButtonOptionsLyrics = "ButtonOptionsLyrics"; + private const string _ButtonOptionsTheme = "ButtonOptionsTheme"; public override void Init() { base.Init(); - _ThemeButtons = new string[] {ButtonOptionsGame, ButtonOptionsSound, ButtonOptionsRecord, ButtonOptionsVideo, ButtonOptionsLyrics, ButtonOptionsTheme}; + _ThemeButtons = new string[] {_ButtonOptionsGame, _ButtonOptionsSound, _ButtonOptionsRecord, _ButtonOptionsVideo, _ButtonOptionsLyrics, _ButtonOptionsTheme}; } - public override bool HandleInput(KeyEvent keyEvent) + public override bool HandleInput(SKeyEvent keyEvent) { base.HandleInput(keyEvent); @@ -46,22 +46,22 @@ namespace Vocaluxe.Screens break; case Keys.Enter: - if (Buttons[ButtonOptionsGame].Selected) + if (Buttons[_ButtonOptionsGame].Selected) CGraphics.FadeTo(EScreens.ScreenOptionsGame); - if (Buttons[ButtonOptionsSound].Selected) + if (Buttons[_ButtonOptionsSound].Selected) CGraphics.FadeTo(EScreens.ScreenOptionsSound); - if (Buttons[ButtonOptionsRecord].Selected) + if (Buttons[_ButtonOptionsRecord].Selected) CGraphics.FadeTo(EScreens.ScreenOptionsRecord); - if (Buttons[ButtonOptionsVideo].Selected) + if (Buttons[_ButtonOptionsVideo].Selected) CGraphics.FadeTo(EScreens.ScreenOptionsVideo); - if (Buttons[ButtonOptionsLyrics].Selected) + if (Buttons[_ButtonOptionsLyrics].Selected) CGraphics.FadeTo(EScreens.ScreenOptionsLyrics); - if (Buttons[ButtonOptionsTheme].Selected) + if (Buttons[_ButtonOptionsTheme].Selected) CGraphics.FadeTo(EScreens.ScreenOptionsTheme); break; @@ -70,28 +70,28 @@ namespace Vocaluxe.Screens return true; } - public override bool HandleMouse(MouseEvent mouseEvent) + public override bool HandleMouse(SMouseEvent mouseEvent) { base.HandleMouse(mouseEvent); if (mouseEvent.LB && IsMouseOver(mouseEvent)) { - if (Buttons[ButtonOptionsGame].Selected) + if (Buttons[_ButtonOptionsGame].Selected) CGraphics.FadeTo(EScreens.ScreenOptionsGame); - if (Buttons[ButtonOptionsSound].Selected) + if (Buttons[_ButtonOptionsSound].Selected) CGraphics.FadeTo(EScreens.ScreenOptionsSound); - if (Buttons[ButtonOptionsRecord].Selected) + if (Buttons[_ButtonOptionsRecord].Selected) CGraphics.FadeTo(EScreens.ScreenOptionsRecord); - if (Buttons[ButtonOptionsVideo].Selected) + if (Buttons[_ButtonOptionsVideo].Selected) CGraphics.FadeTo(EScreens.ScreenOptionsVideo); - if (Buttons[ButtonOptionsLyrics].Selected) + if (Buttons[_ButtonOptionsLyrics].Selected) CGraphics.FadeTo(EScreens.ScreenOptionsLyrics); - if (Buttons[ButtonOptionsTheme].Selected) + if (Buttons[_ButtonOptionsTheme].Selected) CGraphics.FadeTo(EScreens.ScreenOptionsTheme); } diff --git a/Vocaluxe/Screens/CScreenOptionsGame.cs b/Vocaluxe/Screens/CScreenOptionsGame.cs index d8f4a3b4..02371d0c 100644 --- a/Vocaluxe/Screens/CScreenOptionsGame.cs +++ b/Vocaluxe/Screens/CScreenOptionsGame.cs @@ -12,38 +12,38 @@ namespace Vocaluxe.Screens get { return 1; } } - private const string SelectSlideLanguage = "SelectSlideLanguage"; - private const string SelectSlideDebugLevel = "SelectSlideDebugLevel"; - private const string SelectSlideSongMenu = "SelectSlideSongMenu"; - private const string SelectSlideSongSorting = "SelectSlideSongSorting"; - private const string SelectSlideTabs = "SelectSlideTabs"; - private const string SelectSlideTimerMode = "SelectSlideTimerMode"; + private const string _SelectSlideLanguage = "SelectSlideLanguage"; + private const string _SelectSlideDebugLevel = "SelectSlideDebugLevel"; + private const string _SelectSlideSongMenu = "SelectSlideSongMenu"; + private const string _SelectSlideSongSorting = "SelectSlideSongSorting"; + private const string _SelectSlideTabs = "SelectSlideTabs"; + private const string _SelectSlideTimerMode = "SelectSlideTimerMode"; - private const string ButtonExit = "ButtonExit"; + private const string _ButtonExit = "ButtonExit"; public override void Init() { base.Init(); - _ThemeButtons = new string[] {ButtonExit}; - _ThemeSelectSlides = new string[] {SelectSlideLanguage, SelectSlideDebugLevel, SelectSlideSongMenu, SelectSlideSongSorting, SelectSlideTabs, SelectSlideTimerMode}; + _ThemeButtons = new string[] {_ButtonExit}; + _ThemeSelectSlides = new string[] {_SelectSlideLanguage, _SelectSlideDebugLevel, _SelectSlideSongMenu, _SelectSlideSongSorting, _SelectSlideTabs, _SelectSlideTimerMode}; } - public override void LoadTheme(string XmlPath) + public override void LoadTheme(string xmlPath) { - base.LoadTheme(XmlPath); + base.LoadTheme(xmlPath); - SelectSlides[SelectSlideLanguage].AddValues(CLanguage.GetLanguageNames()); - SelectSlides[SelectSlideLanguage].Selection = CLanguage.LanguageId; + SelectSlides[_SelectSlideLanguage].AddValues(CLanguage.GetLanguageNames()); + SelectSlides[_SelectSlideLanguage].Selection = CLanguage.LanguageId; - SelectSlides[SelectSlideDebugLevel].SetValues((int)CConfig.DebugLevel); - SelectSlides[SelectSlideSongMenu].SetValues((int)CConfig.SongMenu); - SelectSlides[SelectSlideSongSorting].SetValues((int)CConfig.SongSorting); - SelectSlides[SelectSlideTabs].SetValues((int)CConfig.Tabs); - SelectSlides[SelectSlideTimerMode].SetValues((int)CConfig.TimerMode); + SelectSlides[_SelectSlideDebugLevel].SetValues((int)CConfig.DebugLevel); + SelectSlides[_SelectSlideSongMenu].SetValues((int)CConfig.SongMenu); + SelectSlides[_SelectSlideSongSorting].SetValues((int)CConfig.SongSorting); + SelectSlides[_SelectSlideTabs].SetValues((int)CConfig.Tabs); + SelectSlides[_SelectSlideTimerMode].SetValues((int)CConfig.TimerMode); } - public override bool HandleInput(KeyEvent keyEvent) + public override bool HandleInput(SKeyEvent keyEvent) { base.HandleInput(keyEvent); @@ -53,7 +53,7 @@ namespace Vocaluxe.Screens { case Keys.Escape: case Keys.Back: - SaveConfig(); + _SaveConfig(); CGraphics.FadeTo(EScreens.ScreenOptions); break; @@ -63,39 +63,39 @@ namespace Vocaluxe.Screens break; case Keys.Enter: - if (Buttons[ButtonExit].Selected) + if (Buttons[_ButtonExit].Selected) { - SaveConfig(); + _SaveConfig(); CGraphics.FadeTo(EScreens.ScreenOptions); } break; case Keys.Left: - SaveConfig(); + _SaveConfig(); break; case Keys.Right: - SaveConfig(); + _SaveConfig(); break; } } return true; } - public override bool HandleMouse(MouseEvent mouseEvent) + public override bool HandleMouse(SMouseEvent mouseEvent) { base.HandleMouse(mouseEvent); if (mouseEvent.RB) { - SaveConfig(); + _SaveConfig(); CGraphics.FadeTo(EScreens.ScreenOptions); } if (mouseEvent.LB && IsMouseOver(mouseEvent)) { - SaveConfig(); - if (Buttons[ButtonExit].Selected) + _SaveConfig(); + if (Buttons[_ButtonExit].Selected) CGraphics.FadeTo(EScreens.ScreenOptions); } return true; @@ -112,15 +112,15 @@ namespace Vocaluxe.Screens return true; } - private void SaveConfig() + private void _SaveConfig() { - CLanguage.LanguageId = SelectSlides[SelectSlideLanguage].Selection; + CLanguage.LanguageId = SelectSlides[_SelectSlideLanguage].Selection; CConfig.Language = CLanguage.GetLanguageName(CLanguage.LanguageId); - CConfig.DebugLevel = (EDebugLevel)SelectSlides[SelectSlideDebugLevel].Selection; - CConfig.SongMenu = (ESongMenu)SelectSlides[SelectSlideSongMenu].Selection; - CConfig.SongSorting = (ESongSorting)SelectSlides[SelectSlideSongSorting].Selection; - CConfig.Tabs = (EOffOn)SelectSlides[SelectSlideTabs].Selection; - CConfig.TimerMode = (ETimerMode)SelectSlides[SelectSlideTimerMode].Selection; + CConfig.DebugLevel = (EDebugLevel)SelectSlides[_SelectSlideDebugLevel].Selection; + CConfig.SongMenu = (ESongMenu)SelectSlides[_SelectSlideSongMenu].Selection; + CConfig.SongSorting = (ESongSorting)SelectSlides[_SelectSlideSongSorting].Selection; + CConfig.Tabs = (EOffOn)SelectSlides[_SelectSlideTabs].Selection; + CConfig.TimerMode = (ETimerMode)SelectSlides[_SelectSlideTimerMode].Selection; CConfig.SaveConfig(); diff --git a/Vocaluxe/Screens/CScreenOptionsLyrics.cs b/Vocaluxe/Screens/CScreenOptionsLyrics.cs index 26f5ac1a..60fc0208 100644 --- a/Vocaluxe/Screens/CScreenOptionsLyrics.cs +++ b/Vocaluxe/Screens/CScreenOptionsLyrics.cs @@ -12,27 +12,27 @@ namespace Vocaluxe.Screens get { return 1; } } - private const string SelectSlideLyricStyle = "SelectSlideLyricStyle"; - private const string SelectSlideLyricsOnTop = "SelectSlideLyricsOnTop"; + private const string _SelectSlideLyricStyle = "SelectSlideLyricStyle"; + private const string _SelectSlideLyricsOnTop = "SelectSlideLyricsOnTop"; - private const string ButtonExit = "ButtonExit"; + private const string _ButtonExit = "ButtonExit"; public override void Init() { base.Init(); - _ThemeButtons = new string[] {ButtonExit}; - _ThemeSelectSlides = new string[] {SelectSlideLyricStyle, SelectSlideLyricsOnTop}; + _ThemeButtons = new string[] {_ButtonExit}; + _ThemeSelectSlides = new string[] {_SelectSlideLyricStyle, _SelectSlideLyricsOnTop}; } - public override void LoadTheme(string XmlPath) + public override void LoadTheme(string xmlPath) { - base.LoadTheme(XmlPath); - SelectSlides[SelectSlideLyricStyle].SetValues((int)CConfig.LyricStyle); - SelectSlides[SelectSlideLyricsOnTop].SetValues((int)CConfig.LyricsOnTop); + base.LoadTheme(xmlPath); + SelectSlides[_SelectSlideLyricStyle].SetValues((int)CConfig.LyricStyle); + SelectSlides[_SelectSlideLyricsOnTop].SetValues((int)CConfig.LyricsOnTop); } - public override bool HandleInput(KeyEvent keyEvent) + public override bool HandleInput(SKeyEvent keyEvent) { base.HandleInput(keyEvent); @@ -43,7 +43,7 @@ namespace Vocaluxe.Screens { case Keys.Escape: case Keys.Back: - SaveConfig(); + _SaveConfig(); CGraphics.FadeTo(EScreens.ScreenOptions); break; @@ -53,38 +53,38 @@ namespace Vocaluxe.Screens break; case Keys.Enter: - if (Buttons[ButtonExit].Selected) + if (Buttons[_ButtonExit].Selected) { - SaveConfig(); + _SaveConfig(); CGraphics.FadeTo(EScreens.ScreenOptions); } break; case Keys.Left: - SaveConfig(); + _SaveConfig(); break; case Keys.Right: - SaveConfig(); + _SaveConfig(); break; } } return true; } - public override bool HandleMouse(MouseEvent mouseEvent) + public override bool HandleMouse(SMouseEvent mouseEvent) { base.HandleMouse(mouseEvent); if (mouseEvent.RB) { - SaveConfig(); + _SaveConfig(); CGraphics.FadeTo(EScreens.ScreenOptions); } if (mouseEvent.LB && IsMouseOver(mouseEvent)) { - SaveConfig(); - if (Buttons[ButtonExit].Selected) + _SaveConfig(); + if (Buttons[_ButtonExit].Selected) CGraphics.FadeTo(EScreens.ScreenOptions); } return true; @@ -101,10 +101,10 @@ namespace Vocaluxe.Screens return true; } - private void SaveConfig() + private void _SaveConfig() { - CConfig.LyricsOnTop = (EOffOn)SelectSlides[SelectSlideLyricsOnTop].Selection; - CConfig.LyricStyle = (ELyricStyle)SelectSlides[SelectSlideLyricStyle].Selection; + CConfig.LyricsOnTop = (EOffOn)SelectSlides[_SelectSlideLyricsOnTop].Selection; + CConfig.LyricStyle = (ELyricStyle)SelectSlides[_SelectSlideLyricStyle].Selection; CConfig.SaveConfig(); } } diff --git a/Vocaluxe/Screens/CScreenOptionsRecord.cs b/Vocaluxe/Screens/CScreenOptionsRecord.cs index a34c7bd2..a44017b7 100644 --- a/Vocaluxe/Screens/CScreenOptionsRecord.cs +++ b/Vocaluxe/Screens/CScreenOptionsRecord.cs @@ -7,7 +7,7 @@ using VocaluxeLib.Menu; namespace Vocaluxe.Screens { - struct DelayTest + struct SDelayTest { public Stopwatch Timer; public float Delay; @@ -21,34 +21,34 @@ namespace Vocaluxe.Screens get { return 2; } } - private const float MaxDelayTime = 1f; - private const string SelectSlideRecordDevices = "SelectSlideRecordDevices"; - private const string SelectSlideRecordInputs = "SelectSlideRecordInputs"; + private const float _MaxDelayTime = 1f; + private const string _SelectSlideRecordDevices = "SelectSlideRecordDevices"; + private const string _SelectSlideRecordInputs = "SelectSlideRecordInputs"; - private const string SelectSlideRecordChannel1 = "SelectSlideRecordChannel1"; - private const string SelectSlideRecordChannel2 = "SelectSlideRecordChannel2"; - private const string SelectSlideDelay = "SelectSlideDelay"; + private const string _SelectSlideRecordChannel1 = "SelectSlideRecordChannel1"; + private const string _SelectSlideRecordChannel2 = "SelectSlideRecordChannel2"; + private const string _SelectSlideDelay = "SelectSlideDelay"; - private const string StaticWarning = "StaticWarning"; - private const string TextWarning = "TextWarning"; + private const string _StaticWarning = "StaticWarning"; + private const string _TextWarning = "TextWarning"; - private const string ButtonExit = "ButtonExit"; - private const string ButtonDelayTest = "ButtonDelayTest"; + private const string _ButtonExit = "ButtonExit"; + private const string _ButtonDelayTest = "ButtonDelayTest"; - private const string TextDelayChannel1 = "TextDelayChannel1"; - private const string TextDelayChannel2 = "TextDelayChannel2"; + private const string _TextDelayChannel1 = "TextDelayChannel1"; + private const string _TextDelayChannel2 = "TextDelayChannel2"; - private const string EqualizerChannel1 = "EqualizerChannel1"; - private const string EqualizerChannel2 = "EqualizerChannel2"; + private const string _EqualizerChannel1 = "EqualizerChannel1"; + private const string _EqualizerChannel2 = "EqualizerChannel2"; - private readonly string[] StaticEnergyChannel = new string[] {"StaticEnergyChannel1", "StaticEnergyChannel2"}; - private float[] ChannelEnergy; + private readonly string[] _StaticEnergyChannel = new string[] {"StaticEnergyChannel1", "StaticEnergyChannel2"}; + private float[] _ChannelEnergy; - private SRecordDevice[] _devices; + private SRecordDevice[] _Devices; private int _DeviceNr; private int _InputNr; - private DelayTest[] _DelayTest; + private SDelayTest[] _DelayTest; private bool _DelayTestRunning; private int _DelaySound; @@ -57,52 +57,52 @@ namespace Vocaluxe.Screens base.Init(); List values = new List(); - values.Add(StaticWarning); - values.AddRange(StaticEnergyChannel); + values.Add(_StaticWarning); + values.AddRange(_StaticEnergyChannel); _ThemeStatics = values.ToArray(); - _ThemeTexts = new string[] {TextWarning, TextDelayChannel1, TextDelayChannel2}; - _ThemeButtons = new string[] {ButtonExit, ButtonDelayTest}; - _ThemeSelectSlides = new string[] {SelectSlideRecordDevices, SelectSlideRecordInputs, SelectSlideRecordChannel1, SelectSlideRecordChannel2, SelectSlideDelay}; - _ThemeEqualizers = new string[] {EqualizerChannel1, EqualizerChannel2}; + _ThemeTexts = new string[] {_TextWarning, _TextDelayChannel1, _TextDelayChannel2}; + _ThemeButtons = new string[] {_ButtonExit, _ButtonDelayTest}; + _ThemeSelectSlides = new string[] {_SelectSlideRecordDevices, _SelectSlideRecordInputs, _SelectSlideRecordChannel1, _SelectSlideRecordChannel2, _SelectSlideDelay}; + _ThemeEqualizers = new string[] {_EqualizerChannel1, _EqualizerChannel2}; } - public override void LoadTheme(string XmlPath) + public override void LoadTheme(string xmlPath) { - base.LoadTheme(XmlPath); + base.LoadTheme(xmlPath); int max = CSettings.MaxNumPlayer + 1; if (max > 7) max = 7; - SelectSlides[SelectSlideRecordChannel1].NumVisible = max; - SelectSlides[SelectSlideRecordChannel2].NumVisible = max; + SelectSlides[_SelectSlideRecordChannel1].NumVisible = max; + SelectSlides[_SelectSlideRecordChannel2].NumVisible = max; - SelectSlides[SelectSlideRecordChannel1].AddValue(CLanguage.Translate("TR_CONFIG_OFF")); - SelectSlides[SelectSlideRecordChannel2].AddValue(CLanguage.Translate("TR_CONFIG_OFF")); + SelectSlides[_SelectSlideRecordChannel1].AddValue(CLanguage.Translate("TR_CONFIG_OFF")); + SelectSlides[_SelectSlideRecordChannel2].AddValue(CLanguage.Translate("TR_CONFIG_OFF")); for (int i = 1; i <= CSettings.MaxNumPlayer; i++) { - SelectSlides[SelectSlideRecordChannel1].AddValue(i.ToString()); - SelectSlides[SelectSlideRecordChannel2].AddValue(i.ToString()); + SelectSlides[_SelectSlideRecordChannel1].AddValue(i.ToString()); + SelectSlides[_SelectSlideRecordChannel2].AddValue(i.ToString()); } for (int i = 0; i < 26; i++) - SelectSlides[SelectSlideDelay].AddValue((i * 20).ToString() + " ms"); + SelectSlides[_SelectSlideDelay].AddValue((i * 20).ToString() + " ms"); - ChannelEnergy = new float[StaticEnergyChannel.Length]; + _ChannelEnergy = new float[_StaticEnergyChannel.Length]; - for (int i = 0; i < ChannelEnergy.Length; i++) + for (int i = 0; i < _ChannelEnergy.Length; i++) { - Statics[StaticEnergyChannel[i]].Visible = false; - ChannelEnergy[i] = 0f; + Statics[_StaticEnergyChannel[i]].Visible = false; + _ChannelEnergy[i] = 0f; } - Equalizers[EqualizerChannel1].ScreenHandles = true; - Equalizers[EqualizerChannel2].ScreenHandles = true; + Equalizers[_EqualizerChannel1].ScreenHandles = true; + Equalizers[_EqualizerChannel2].ScreenHandles = true; } - public override bool HandleInput(KeyEvent keyEvent) + public override bool HandleInput(SKeyEvent keyEvent) { base.HandleInput(keyEvent); @@ -113,7 +113,7 @@ namespace Vocaluxe.Screens { case Keys.Escape: case Keys.Back: - SaveMicConfig(); + _SaveMicConfig(); CGraphics.FadeTo(EScreens.ScreenOptions); break; @@ -123,88 +123,88 @@ namespace Vocaluxe.Screens break; case Keys.Enter: - if (Buttons[ButtonExit].Selected) + if (Buttons[_ButtonExit].Selected) { - SaveMicConfig(); + _SaveMicConfig(); CGraphics.FadeTo(EScreens.ScreenOptions); } - if (Buttons[ButtonDelayTest].Selected) - TestDelay(); + if (Buttons[_ButtonDelayTest].Selected) + _TestDelay(); break; case Keys.D: - TestDelay(); + _TestDelay(); break; case Keys.Left: - if (SelectSlides[SelectSlideRecordDevices].Selected) - OnDeviceEvent(); + if (SelectSlides[_SelectSlideRecordDevices].Selected) + _OnDeviceEvent(); - if (SelectSlides[SelectSlideRecordInputs].Selected) - OnInputEvent(); + if (SelectSlides[_SelectSlideRecordInputs].Selected) + _OnInputEvent(); - if (SelectSlides[SelectSlideRecordChannel1].Selected || - SelectSlides[SelectSlideRecordChannel2].Selected) - SetMicConfig(); + if (SelectSlides[_SelectSlideRecordChannel1].Selected || + SelectSlides[_SelectSlideRecordChannel2].Selected) + _SetMicConfig(); - if (SelectSlides[SelectSlideDelay].Selected) - SaveDelayConfig(); + if (SelectSlides[_SelectSlideDelay].Selected) + _SaveDelayConfig(); break; case Keys.Right: - if (SelectSlides[SelectSlideRecordDevices].Selected) - OnDeviceEvent(); + if (SelectSlides[_SelectSlideRecordDevices].Selected) + _OnDeviceEvent(); - if (SelectSlides[SelectSlideRecordInputs].Selected) - OnInputEvent(); + if (SelectSlides[_SelectSlideRecordInputs].Selected) + _OnInputEvent(); - if (SelectSlides[SelectSlideRecordChannel1].Selected || - SelectSlides[SelectSlideRecordChannel2].Selected) - SetMicConfig(); + if (SelectSlides[_SelectSlideRecordChannel1].Selected || + SelectSlides[_SelectSlideRecordChannel2].Selected) + _SetMicConfig(); - if (SelectSlides[SelectSlideDelay].Selected) - SaveDelayConfig(); + if (SelectSlides[_SelectSlideDelay].Selected) + _SaveDelayConfig(); break; } } return true; } - public override bool HandleMouse(MouseEvent mouseEvent) + public override bool HandleMouse(SMouseEvent mouseEvent) { base.HandleMouse(mouseEvent); if (mouseEvent.RB) { - SaveMicConfig(); + _SaveMicConfig(); CGraphics.FadeTo(EScreens.ScreenOptions); } if (mouseEvent.LB && IsMouseOver(mouseEvent)) { - if (SelectSlides[SelectSlideRecordDevices].Selected) - OnDeviceEvent(); + if (SelectSlides[_SelectSlideRecordDevices].Selected) + _OnDeviceEvent(); - if (SelectSlides[SelectSlideRecordInputs].Selected) - OnInputEvent(); + if (SelectSlides[_SelectSlideRecordInputs].Selected) + _OnInputEvent(); - if (SelectSlides[SelectSlideRecordChannel1].Selected || - SelectSlides[SelectSlideRecordChannel2].Selected) - SetMicConfig(); + if (SelectSlides[_SelectSlideRecordChannel1].Selected || + SelectSlides[_SelectSlideRecordChannel2].Selected) + _SetMicConfig(); - if (SelectSlides[SelectSlideDelay].Selected) - SaveDelayConfig(); + if (SelectSlides[_SelectSlideDelay].Selected) + _SaveDelayConfig(); - if (Buttons[ButtonExit].Selected) + if (Buttons[_ButtonExit].Selected) { - SaveMicConfig(); + _SaveMicConfig(); CGraphics.FadeTo(EScreens.ScreenOptions); } - if (Buttons[ButtonDelayTest].Selected) - TestDelay(); + if (Buttons[_ButtonDelayTest].Selected) + _TestDelay(); } return true; } @@ -230,12 +230,12 @@ namespace Vocaluxe.Screens { int player = 0; if (i == 0) - player = SelectSlides[SelectSlideRecordChannel1].Selection; + player = SelectSlides[_SelectSlideRecordChannel1].Selection; if (i == 1) - player = SelectSlides[SelectSlideRecordChannel2].Selection; + player = SelectSlides[_SelectSlideRecordChannel2].Selection; - if (_DelayTest[i].Timer.ElapsedMilliseconds > MaxDelayTime * 1000f || player == 0) + if (_DelayTest[i].Timer.ElapsedMilliseconds > _MaxDelayTime * 1000f || player == 0) { _DelayTest[i].Delay = 0f; _DelayTest[i].Timer.Stop(); @@ -250,39 +250,39 @@ namespace Vocaluxe.Screens } } } - Texts[TextDelayChannel1].Text = _DelayTest[0].Delay.ToString("000") + " ms"; - Texts[TextDelayChannel2].Text = _DelayTest[1].Delay.ToString("000") + " ms"; + Texts[_TextDelayChannel1].Text = _DelayTest[0].Delay.ToString("000") + " ms"; + Texts[_TextDelayChannel2].Text = _DelayTest[1].Delay.ToString("000") + " ms"; } - if (CheckMicConfig()) + if (_CheckMicConfig()) { - ChannelEnergy[0] = 0f; - int player = SelectSlides[SelectSlideRecordChannel1].Selection; + _ChannelEnergy[0] = 0f; + int player = SelectSlides[_SelectSlideRecordChannel1].Selection; if (player > 0) { - ChannelEnergy[0] = CSound.RecordGetMaxVolume(player - 1); - Equalizers[EqualizerChannel1].Update(CSound.ToneWeigth(player - 1)); + _ChannelEnergy[0] = CSound.RecordGetMaxVolume(player - 1); + Equalizers[_EqualizerChannel1].Update(CSound.ToneWeigth(player - 1)); } else - Equalizers[EqualizerChannel1].Reset(); + Equalizers[_EqualizerChannel1].Reset(); - ChannelEnergy[1] = 0f; - player = SelectSlides[SelectSlideRecordChannel2].Selection; + _ChannelEnergy[1] = 0f; + player = SelectSlides[_SelectSlideRecordChannel2].Selection; if (player > 0) { - ChannelEnergy[1] = CSound.RecordGetMaxVolume(player - 1); - Equalizers[EqualizerChannel2].Update(CSound.ToneWeigth(player - 1)); + _ChannelEnergy[1] = CSound.RecordGetMaxVolume(player - 1); + Equalizers[_EqualizerChannel2].Update(CSound.ToneWeigth(player - 1)); } else - Equalizers[EqualizerChannel2].Reset(); + Equalizers[_EqualizerChannel2].Reset(); } else { - for (int i = 0; i < ChannelEnergy.Length; i++) - ChannelEnergy[i] = 0f; - Equalizers[EqualizerChannel1].Reset(); - Equalizers[EqualizerChannel2].Reset(); + for (int i = 0; i < _ChannelEnergy.Length; i++) + _ChannelEnergy[i] = 0f; + Equalizers[_EqualizerChannel1].Reset(); + Equalizers[_EqualizerChannel2].Reset(); } return true; @@ -292,42 +292,42 @@ namespace Vocaluxe.Screens { base.OnShow(); - SelectSlides[SelectSlideRecordDevices].Clear(); - SelectSlides[SelectSlideRecordInputs].Clear(); + SelectSlides[_SelectSlideRecordDevices].Clear(); + SelectSlides[_SelectSlideRecordInputs].Clear(); - for (int i = 0; i < ChannelEnergy.Length; i++) - ChannelEnergy[i] = 0f; + for (int i = 0; i < _ChannelEnergy.Length; i++) + _ChannelEnergy[i] = 0f; _DeviceNr = -1; _InputNr = -1; - _devices = CSound.RecordGetDevices(); - if (_devices != null) + _Devices = CSound.RecordGetDevices(); + if (_Devices != null) { _DeviceNr = 0; _InputNr = 0; - GetFirstConfiguredRecordDevice(ref _DeviceNr, ref _InputNr); + _GetFirstConfiguredRecordDevice(ref _DeviceNr, ref _InputNr); - for (int dev = 0; dev < _devices.Length; dev++) - SelectSlides[SelectSlideRecordDevices].AddValue(_devices[dev].Name); - SelectSlides[SelectSlideRecordDevices].Selection = _DeviceNr; + for (int dev = 0; dev < _Devices.Length; dev++) + SelectSlides[_SelectSlideRecordDevices].AddValue(_Devices[dev].Name); + SelectSlides[_SelectSlideRecordDevices].Selection = _DeviceNr; - for (int inp = 0; inp < _devices[0].Inputs.Count; inp++) - SelectSlides[SelectSlideRecordInputs].AddValue(_devices[0].Inputs[inp].Name); - SelectSlides[SelectSlideRecordInputs].Selection = _InputNr; - UpdateChannels(); + for (int inp = 0; inp < _Devices[0].Inputs.Count; inp++) + SelectSlides[_SelectSlideRecordInputs].AddValue(_Devices[0].Inputs[inp].Name); + SelectSlides[_SelectSlideRecordInputs].Selection = _InputNr; + _UpdateChannels(); } - SelectSlides[SelectSlideRecordChannel1].Visible = _devices != null; - SelectSlides[SelectSlideRecordChannel2].Visible = _devices != null; + SelectSlides[_SelectSlideRecordChannel1].Visible = _Devices != null; + SelectSlides[_SelectSlideRecordChannel2].Visible = _Devices != null; - Statics[StaticWarning].Visible = false; - Texts[TextWarning].Visible = false; + Statics[_StaticWarning].Visible = false; + Texts[_TextWarning].Visible = false; _DelayTest = null; - if (_devices != null) + if (_Devices != null) { - _DelayTest = new DelayTest[2]; + _DelayTest = new SDelayTest[2]; for (int i = 0; i < _DelayTest.Length - 1; i++) { _DelayTest[i].Timer = new Stopwatch(); @@ -335,7 +335,7 @@ namespace Vocaluxe.Screens } } - SelectSlides[SelectSlideDelay].Selection = CConfig.MicDelay / 20; + SelectSlides[_SelectSlideDelay].Selection = CConfig.MicDelay / 20; _DelayTestRunning = false; _DelaySound = -1; @@ -351,34 +351,34 @@ namespace Vocaluxe.Screens { DrawBG(); - if (!CheckMicConfig()) + if (!_CheckMicConfig()) { - Statics[StaticWarning].Visible = true; - Texts[TextWarning].Visible = true; + Statics[_StaticWarning].Visible = true; + Texts[_TextWarning].Visible = true; } else { - Statics[StaticWarning].Visible = false; - Texts[TextWarning].Visible = false; + Statics[_StaticWarning].Visible = false; + Texts[_TextWarning].Visible = false; } - for (int i = 0; i < StaticEnergyChannel.Length; i++) + for (int i = 0; i < _StaticEnergyChannel.Length; i++) { - if (ChannelEnergy[i] > 0f) + if (_ChannelEnergy[i] > 0f) { - SRectF rect = new SRectF(Statics[StaticEnergyChannel[i]].Rect.X, - Statics[StaticEnergyChannel[i]].Rect.Y, - Statics[StaticEnergyChannel[i]].Rect.W * ChannelEnergy[i], - Statics[StaticEnergyChannel[i]].Rect.H, - Statics[StaticEnergyChannel[i]].Rect.Z); + SRectF rect = new SRectF(Statics[_StaticEnergyChannel[i]].Rect.X, + Statics[_StaticEnergyChannel[i]].Rect.Y, + Statics[_StaticEnergyChannel[i]].Rect.W * _ChannelEnergy[i], + Statics[_StaticEnergyChannel[i]].Rect.H, + Statics[_StaticEnergyChannel[i]].Rect.Z); - CDraw.DrawTexture(Statics[StaticEnergyChannel[i]].Texture, Statics[StaticEnergyChannel[i]].Rect, + CDraw.DrawTexture(Statics[_StaticEnergyChannel[i]].Texture, Statics[_StaticEnergyChannel[i]].Rect, new SColorF(1f, 1f, 1f, 1f), rect); } } - Equalizers[EqualizerChannel1].Draw(); - Equalizers[EqualizerChannel2].Draw(); + Equalizers[_EqualizerChannel1].Draw(); + Equalizers[_EqualizerChannel2].Draw(); DrawFG(); @@ -394,69 +394,69 @@ namespace Vocaluxe.Screens CBackgroundMusic.Disabled = false; } - private void OnDeviceEvent() + private void _OnDeviceEvent() { - if (SelectSlides[SelectSlideRecordDevices].Selection != _DeviceNr) + if (SelectSlides[_SelectSlideRecordDevices].Selection != _DeviceNr) { - SelectSlides[SelectSlideRecordInputs].Clear(); - _DeviceNr = SelectSlides[SelectSlideRecordDevices].Selection; + SelectSlides[_SelectSlideRecordInputs].Clear(); + _DeviceNr = SelectSlides[_SelectSlideRecordDevices].Selection; _InputNr = 0; - for (int inp = 0; inp < _devices[_DeviceNr].Inputs.Count; inp++) - SelectSlides[SelectSlideRecordInputs].AddValue(_devices[_DeviceNr].Inputs[inp].Name); + for (int inp = 0; inp < _Devices[_DeviceNr].Inputs.Count; inp++) + SelectSlides[_SelectSlideRecordInputs].AddValue(_Devices[_DeviceNr].Inputs[inp].Name); _InputNr = 0; - SelectSlides[SelectSlideRecordInputs].Selection = 0; - UpdateChannels(); + SelectSlides[_SelectSlideRecordInputs].Selection = 0; + _UpdateChannels(); } } - private void OnInputEvent() + private void _OnInputEvent() { - if (SelectSlides[SelectSlideRecordInputs].Selection != _InputNr) + if (SelectSlides[_SelectSlideRecordInputs].Selection != _InputNr) { - _InputNr = SelectSlides[SelectSlideRecordInputs].Selection; + _InputNr = SelectSlides[_SelectSlideRecordInputs].Selection; - UpdateChannels(); + _UpdateChannels(); } } - private void SaveDelayConfig() + private void _SaveDelayConfig() { - CConfig.MicDelay = SelectSlides[SelectSlideDelay].Selection * 20; + CConfig.MicDelay = SelectSlides[_SelectSlideDelay].Selection * 20; CConfig.SaveConfig(); } - private void SaveMicConfig() + private void _SaveMicConfig() { - if (_devices == null) + if (_Devices == null) return; CSound.RecordStop(); - SetMicConfig(); + _SetMicConfig(); - if (CheckMicConfig()) + if (_CheckMicConfig()) { for (int p = 0; p < CSettings.MaxNumPlayer; p++) CConfig.MicConfig[p].Channel = 0; - for (int dev = 0; dev < _devices.Length; dev++) + for (int dev = 0; dev < _Devices.Length; dev++) { - for (int inp = 0; inp < _devices[dev].Inputs.Count; inp++) + for (int inp = 0; inp < _Devices[dev].Inputs.Count; inp++) { - if (_devices[dev].Inputs[inp].PlayerChannel1 > 0) + if (_Devices[dev].Inputs[inp].PlayerChannel1 > 0) { - CConfig.MicConfig[_devices[dev].Inputs[inp].PlayerChannel1 - 1].Channel = 1; - CConfig.MicConfig[_devices[dev].Inputs[inp].PlayerChannel1 - 1].DeviceName = _devices[dev].Name; - CConfig.MicConfig[_devices[dev].Inputs[inp].PlayerChannel1 - 1].DeviceDriver = _devices[dev].Driver; - CConfig.MicConfig[_devices[dev].Inputs[inp].PlayerChannel1 - 1].InputName = _devices[dev].Inputs[inp].Name; + CConfig.MicConfig[_Devices[dev].Inputs[inp].PlayerChannel1 - 1].Channel = 1; + CConfig.MicConfig[_Devices[dev].Inputs[inp].PlayerChannel1 - 1].DeviceName = _Devices[dev].Name; + CConfig.MicConfig[_Devices[dev].Inputs[inp].PlayerChannel1 - 1].DeviceDriver = _Devices[dev].Driver; + CConfig.MicConfig[_Devices[dev].Inputs[inp].PlayerChannel1 - 1].InputName = _Devices[dev].Inputs[inp].Name; } - if (_devices[dev].Inputs[inp].PlayerChannel2 > 0) + if (_Devices[dev].Inputs[inp].PlayerChannel2 > 0) { - CConfig.MicConfig[_devices[dev].Inputs[inp].PlayerChannel2 - 1].Channel = 2; - CConfig.MicConfig[_devices[dev].Inputs[inp].PlayerChannel2 - 1].DeviceName = _devices[dev].Name; - CConfig.MicConfig[_devices[dev].Inputs[inp].PlayerChannel2 - 1].DeviceDriver = _devices[dev].Driver; - CConfig.MicConfig[_devices[dev].Inputs[inp].PlayerChannel2 - 1].InputName = _devices[dev].Inputs[inp].Name; + CConfig.MicConfig[_Devices[dev].Inputs[inp].PlayerChannel2 - 1].Channel = 2; + CConfig.MicConfig[_Devices[dev].Inputs[inp].PlayerChannel2 - 1].DeviceName = _Devices[dev].Name; + CConfig.MicConfig[_Devices[dev].Inputs[inp].PlayerChannel2 - 1].DeviceDriver = _Devices[dev].Driver; + CConfig.MicConfig[_Devices[dev].Inputs[inp].PlayerChannel2 - 1].InputName = _Devices[dev].Inputs[inp].Name; } } } @@ -465,60 +465,60 @@ namespace Vocaluxe.Screens CSound.RecordStart(); } - private void SetMicConfig() + private void _SetMicConfig() { if (_DeviceNr < 0) return; - SInput input = _devices[_DeviceNr].Inputs[_InputNr]; - input.PlayerChannel1 = SelectSlides[SelectSlideRecordChannel1].Selection; - input.PlayerChannel2 = SelectSlides[SelectSlideRecordChannel2].Selection; - _devices[_DeviceNr].Inputs[_InputNr] = input; + SInput input = _Devices[_DeviceNr].Inputs[_InputNr]; + input.PlayerChannel1 = SelectSlides[_SelectSlideRecordChannel1].Selection; + input.PlayerChannel2 = SelectSlides[_SelectSlideRecordChannel2].Selection; + _Devices[_DeviceNr].Inputs[_InputNr] = input; } - private void UpdateChannels() + private void _UpdateChannels() { - SelectSlides[SelectSlideRecordChannel1].Selection = _devices[_DeviceNr].Inputs[_InputNr].PlayerChannel1; - SelectSlides[SelectSlideRecordChannel2].Selection = _devices[_DeviceNr].Inputs[_InputNr].PlayerChannel2; + SelectSlides[_SelectSlideRecordChannel1].Selection = _Devices[_DeviceNr].Inputs[_InputNr].PlayerChannel1; + SelectSlides[_SelectSlideRecordChannel2].Selection = _Devices[_DeviceNr].Inputs[_InputNr].PlayerChannel2; - SaveMicConfig(); + _SaveMicConfig(); } - private bool CheckMicConfig() + private bool _CheckMicConfig() { - bool[] IsSet = new bool[CSettings.MaxNumPlayer]; + bool[] isSet = new bool[CSettings.MaxNumPlayer]; for (int i = 0; i < CSettings.MaxNumPlayer; i++) - IsSet[i] = false; + isSet[i] = false; - if (_devices == null) + if (_Devices == null) return true; - for (int dev = 0; dev < _devices.Length; dev++) + for (int dev = 0; dev < _Devices.Length; dev++) { - for (int inp = 0; inp < _devices[dev].Inputs.Count; inp++) + for (int inp = 0; inp < _Devices[dev].Inputs.Count; inp++) { - if (_devices[dev].Inputs[inp].PlayerChannel1 > 0) + if (_Devices[dev].Inputs[inp].PlayerChannel1 > 0) { - if (IsSet[_devices[dev].Inputs[inp].PlayerChannel1 - 1]) + if (isSet[_Devices[dev].Inputs[inp].PlayerChannel1 - 1]) return false; - IsSet[_devices[dev].Inputs[inp].PlayerChannel1 - 1] = true; + isSet[_Devices[dev].Inputs[inp].PlayerChannel1 - 1] = true; } - if (_devices[dev].Inputs[inp].PlayerChannel2 > 0) + if (_Devices[dev].Inputs[inp].PlayerChannel2 > 0) { - if (IsSet[_devices[dev].Inputs[inp].PlayerChannel2 - 1]) + if (isSet[_Devices[dev].Inputs[inp].PlayerChannel2 - 1]) return false; - IsSet[_devices[dev].Inputs[inp].PlayerChannel2 - 1] = true; + isSet[_Devices[dev].Inputs[inp].PlayerChannel2 - 1] = true; } } } return true; } - private void TestDelay() + private void _TestDelay() { - SaveMicConfig(); + _SaveMicConfig(); if (_DelayTest == null) return; @@ -527,26 +527,26 @@ namespace Vocaluxe.Screens _DelayTestRunning = true; } - private void GetFirstConfiguredRecordDevice(ref int Device, ref int Input) + private void _GetFirstConfiguredRecordDevice(ref int device, ref int input) { - if (_devices == null) + if (_Devices == null) return; if (CConfig.MicConfig == null) return; - for (int i = 0; i < _devices.Length; i++) + for (int i = 0; i < _Devices.Length; i++) { - if (_devices[i].Name == CConfig.MicConfig[0].DeviceName && _devices[i].Driver == CConfig.MicConfig[0].DeviceDriver) + if (_Devices[i].Name == CConfig.MicConfig[0].DeviceName && _Devices[i].Driver == CConfig.MicConfig[0].DeviceDriver) { - for (int j = 0; j < _devices[i].Inputs.Count; j++) + for (int j = 0; j < _Devices[i].Inputs.Count; j++) { - if (_devices[i].Inputs[j].Name == CConfig.MicConfig[0].InputName) + if (_Devices[i].Inputs[j].Name == CConfig.MicConfig[0].InputName) { if (CConfig.MicConfig[0].Channel > 0) { - Device = i; - Input = j; + device = i; + input = j; return; } } diff --git a/Vocaluxe/Screens/CScreenOptionsSound.cs b/Vocaluxe/Screens/CScreenOptionsSound.cs index 84b736ab..49886ea5 100644 --- a/Vocaluxe/Screens/CScreenOptionsSound.cs +++ b/Vocaluxe/Screens/CScreenOptionsSound.cs @@ -12,13 +12,13 @@ namespace Vocaluxe.Screens get { return 3; } } - private const string SelectSlideBackgroundMusic = "SelectSlideBackgroundMusic"; - private const string SelectSlideBackgroundMusicVolume = "SelectSlideBackgroundMusicVolume"; - private const string SelectSlideBackgroundMusicSource = "SelectSlideBackgroundMusicSource"; - private const string SelectSlidePreviewMusicVolume = "SelectSlidePreviewMusicVolume"; - private const string SelectSlideGameMusicVolume = "SelectSlideGameMusicVolume"; + private const string _SelectSlideBackgroundMusic = "SelectSlideBackgroundMusic"; + private const string _SelectSlideBackgroundMusicVolume = "SelectSlideBackgroundMusicVolume"; + private const string _SelectSlideBackgroundMusicSource = "SelectSlideBackgroundMusicSource"; + private const string _SelectSlidePreviewMusicVolume = "SelectSlidePreviewMusicVolume"; + private const string _SelectSlideGameMusicVolume = "SelectSlideGameMusicVolume"; - private const string ButtonExit = "ButtonExit"; + private const string _ButtonExit = "ButtonExit"; private int _BackgroundMusicVolume; private EOffOn _BackgroundMusic; @@ -27,29 +27,29 @@ namespace Vocaluxe.Screens { base.Init(); - _ThemeButtons = new string[] {ButtonExit}; + _ThemeButtons = new string[] {_ButtonExit}; _ThemeSelectSlides = new string[] - {SelectSlideBackgroundMusic, SelectSlideBackgroundMusicVolume, SelectSlideBackgroundMusicSource, SelectSlidePreviewMusicVolume, SelectSlideGameMusicVolume}; + {_SelectSlideBackgroundMusic, _SelectSlideBackgroundMusicVolume, _SelectSlideBackgroundMusicSource, _SelectSlidePreviewMusicVolume, _SelectSlideGameMusicVolume}; } - public override void LoadTheme(string XmlPath) + public override void LoadTheme(string xmlPath) { - base.LoadTheme(XmlPath); - SelectSlides[SelectSlideBackgroundMusic].SetValues((int)CConfig.BackgroundMusic); - SelectSlides[SelectSlideBackgroundMusicVolume].AddValues(new string[] + base.LoadTheme(xmlPath); + SelectSlides[_SelectSlideBackgroundMusic].SetValues((int)CConfig.BackgroundMusic); + SelectSlides[_SelectSlideBackgroundMusicVolume].AddValues(new string[] {"0", "5", "10", "15", "20", "25", "30", "35", "40", "45", "50", "55", "60", "65", "70", "75", "80", "85", "90", "95", "100"}); - SelectSlides[SelectSlideBackgroundMusicVolume].Selection = CConfig.BackgroundMusicVolume / 5; - SelectSlides[SelectSlideBackgroundMusicSource].SetValues((int)CConfig.BackgroundMusicSource); - SelectSlides[SelectSlideBackgroundMusicSource].Selection = (int)CConfig.BackgroundMusicSource; - SelectSlides[SelectSlidePreviewMusicVolume].AddValues(new string[] + SelectSlides[_SelectSlideBackgroundMusicVolume].Selection = CConfig.BackgroundMusicVolume / 5; + SelectSlides[_SelectSlideBackgroundMusicSource].SetValues((int)CConfig.BackgroundMusicSource); + SelectSlides[_SelectSlideBackgroundMusicSource].Selection = (int)CConfig.BackgroundMusicSource; + SelectSlides[_SelectSlidePreviewMusicVolume].AddValues(new string[] {"0", "5", "10", "15", "20", "25", "30", "35", "40", "45", "50", "55", "60", "65", "70", "75", "80", "85", "90", "95", "100"}); - SelectSlides[SelectSlidePreviewMusicVolume].Selection = CConfig.PreviewMusicVolume / 5; - SelectSlides[SelectSlideGameMusicVolume].AddValues(new string[] + SelectSlides[_SelectSlidePreviewMusicVolume].Selection = CConfig.PreviewMusicVolume / 5; + SelectSlides[_SelectSlideGameMusicVolume].AddValues(new string[] {"0", "5", "10", "15", "20", "25", "30", "35", "40", "45", "50", "55", "60", "65", "70", "75", "80", "85", "90", "95", "100"}); - SelectSlides[SelectSlideGameMusicVolume].Selection = CConfig.GameMusicVolume / 5; + SelectSlides[_SelectSlideGameMusicVolume].Selection = CConfig.GameMusicVolume / 5; } - public override bool HandleInput(KeyEvent keyEvent) + public override bool HandleInput(SKeyEvent keyEvent) { base.HandleInput(keyEvent); @@ -60,7 +60,7 @@ namespace Vocaluxe.Screens { case Keys.Escape: case Keys.Back: - SaveConfig(); + _SaveConfig(); CGraphics.FadeTo(EScreens.ScreenOptions); break; @@ -70,38 +70,38 @@ namespace Vocaluxe.Screens break; case Keys.Enter: - if (Buttons[ButtonExit].Selected) + if (Buttons[_ButtonExit].Selected) { - SaveConfig(); + _SaveConfig(); CGraphics.FadeTo(EScreens.ScreenOptions); } break; case Keys.Left: - SaveConfig(); + _SaveConfig(); break; case Keys.Right: - SaveConfig(); + _SaveConfig(); break; } } return true; } - public override bool HandleMouse(MouseEvent mouseEvent) + public override bool HandleMouse(SMouseEvent mouseEvent) { base.HandleMouse(mouseEvent); if (mouseEvent.RB) { - SaveConfig(); + _SaveConfig(); CGraphics.FadeTo(EScreens.ScreenOptions); } if (mouseEvent.LB && IsMouseOver(mouseEvent)) { - SaveConfig(); - if (Buttons[ButtonExit].Selected) + _SaveConfig(); + if (Buttons[_ButtonExit].Selected) CGraphics.FadeTo(EScreens.ScreenOptions); } return true; @@ -110,7 +110,7 @@ namespace Vocaluxe.Screens public override bool UpdateGame() { if (_BackgroundMusicVolume != CConfig.BackgroundMusicVolume) - SelectSlides[SelectSlideBackgroundMusicVolume].Selection = CConfig.BackgroundMusicVolume / 5; + SelectSlides[_SelectSlideBackgroundMusicVolume].Selection = CConfig.BackgroundMusicVolume / 5; return true; } @@ -126,21 +126,21 @@ namespace Vocaluxe.Screens _BackgroundMusic = CConfig.BackgroundMusic; _BackgroundMusicVolume = CConfig.BackgroundMusicVolume; - SelectSlides[SelectSlideGameMusicVolume].Selection = CConfig.GameMusicVolume / 5; - SelectSlides[SelectSlidePreviewMusicVolume].Selection = CConfig.PreviewMusicVolume / 5; + SelectSlides[_SelectSlideGameMusicVolume].Selection = CConfig.GameMusicVolume / 5; + SelectSlides[_SelectSlidePreviewMusicVolume].Selection = CConfig.PreviewMusicVolume / 5; } - private void SaveConfig() + private void _SaveConfig() { - CConfig.GameMusicVolume = SelectSlides[SelectSlideGameMusicVolume].Selection * 5; - CConfig.PreviewMusicVolume = SelectSlides[SelectSlidePreviewMusicVolume].Selection * 5; + CConfig.GameMusicVolume = SelectSlides[_SelectSlideGameMusicVolume].Selection * 5; + CConfig.PreviewMusicVolume = SelectSlides[_SelectSlidePreviewMusicVolume].Selection * 5; CConfig.SaveConfig(); - EOffOn NewOffOn = (EOffOn)SelectSlides[SelectSlideBackgroundMusic].Selection; - EBackgroundMusicSource NewSource = (EBackgroundMusicSource)SelectSlides[SelectSlideBackgroundMusicSource].Selection; - float NewVolume = SelectSlides[SelectSlideBackgroundMusicVolume].Selection * 5; + EOffOn newOffOn = (EOffOn)SelectSlides[_SelectSlideBackgroundMusic].Selection; + EBackgroundMusicSource newSource = (EBackgroundMusicSource)SelectSlides[_SelectSlideBackgroundMusicSource].Selection; + float newVolume = SelectSlides[_SelectSlideBackgroundMusicVolume].Selection * 5; - CBackgroundMusic.CheckAndApplyConfig(NewOffOn, NewSource, NewVolume); + CBackgroundMusic.CheckAndApplyConfig(newOffOn, newSource, newVolume); } } } \ No newline at end of file diff --git a/Vocaluxe/Screens/CScreenOptionsTheme.cs b/Vocaluxe/Screens/CScreenOptionsTheme.cs index 54592b5d..b2b28262 100644 --- a/Vocaluxe/Screens/CScreenOptionsTheme.cs +++ b/Vocaluxe/Screens/CScreenOptionsTheme.cs @@ -13,16 +13,16 @@ namespace Vocaluxe.Screens get { return 3; } } - private const string SelectSlideTheme = "SelectSlideTheme"; - private const string SelectSlideSkin = "SelectSlideSkin"; - private const string SelectSlideCover = "SelectSlideCover"; - private const string SelectSlideNoteLines = "SelectSlideNoteLines"; - private const string SelectSlideToneHelper = "SelectSlideToneHelper"; - private const string SelectSlideTimerLook = "SelectSlideTimerLook"; - private const string SelectSlideFadeInfo = "SelectSlideFadeInfo"; - private const string SelectSlideCoverLoading = "SelectSlideCoverLoading"; + private const string _SelectSlideTheme = "SelectSlideTheme"; + private const string _SelectSlideSkin = "SelectSlideSkin"; + private const string _SelectSlideCover = "SelectSlideCover"; + private const string _SelectSlideNoteLines = "SelectSlideNoteLines"; + private const string _SelectSlideToneHelper = "SelectSlideToneHelper"; + private const string _SelectSlideTimerLook = "SelectSlideTimerLook"; + private const string _SelectSlideFadeInfo = "SelectSlideFadeInfo"; + private const string _SelectSlideCoverLoading = "SelectSlideCoverLoading"; - private const string ButtonExit = "ButtonExit"; + private const string _ButtonExit = "ButtonExit"; private int _OldCoverTheme; private int _OldTheme; @@ -34,40 +34,40 @@ namespace Vocaluxe.Screens { base.Init(); - _ThemeButtons = new string[] {ButtonExit}; + _ThemeButtons = new string[] {_ButtonExit}; _ThemeSelectSlides = new string[] { - SelectSlideTheme, - SelectSlideSkin, - SelectSlideCover, - SelectSlideNoteLines, - SelectSlideToneHelper, - SelectSlideTimerLook, - SelectSlideFadeInfo, - SelectSlideCoverLoading + _SelectSlideTheme, + _SelectSlideSkin, + _SelectSlideCover, + _SelectSlideNoteLines, + _SelectSlideToneHelper, + _SelectSlideTimerLook, + _SelectSlideFadeInfo, + _SelectSlideCoverLoading }; } - public override void LoadTheme(string XmlPath) + public override void LoadTheme(string xmlPath) { - base.LoadTheme(XmlPath); + base.LoadTheme(xmlPath); - SelectSlides[SelectSlideTheme].AddValues(CTheme.ThemeNames); - SelectSlides[SelectSlideTheme].Selection = CTheme.GetThemeIndex(-1); + SelectSlides[_SelectSlideTheme].AddValues(CTheme.ThemeNames); + SelectSlides[_SelectSlideTheme].Selection = CTheme.GetThemeIndex(-1); - SelectSlides[SelectSlideSkin].AddValues(CTheme.SkinNames); - SelectSlides[SelectSlideSkin].Selection = CTheme.GetSkinIndex(-1); + SelectSlides[_SelectSlideSkin].AddValues(CTheme.SkinNames); + SelectSlides[_SelectSlideSkin].Selection = CTheme.GetSkinIndex(-1); - SelectSlides[SelectSlideCover].AddValues(CCover.CoverThemes); - SelectSlides[SelectSlideCover].Selection = CCover.GetCoverThemeIndex(); - SelectSlides[SelectSlideNoteLines].SetValues((int)CConfig.DrawNoteLines); - SelectSlides[SelectSlideToneHelper].SetValues((int)CConfig.DrawToneHelper); - SelectSlides[SelectSlideTimerLook].SetValues((int)CConfig.TimerLook); - SelectSlides[SelectSlideFadeInfo].SetValues((int)CConfig.FadePlayerInfo); - SelectSlides[SelectSlideCoverLoading].SetValues((int)CConfig.CoverLoading); + SelectSlides[_SelectSlideCover].AddValues(CCover.CoverThemes); + SelectSlides[_SelectSlideCover].Selection = CCover.GetCoverThemeIndex(); + SelectSlides[_SelectSlideNoteLines].SetValues((int)CConfig.DrawNoteLines); + SelectSlides[_SelectSlideToneHelper].SetValues((int)CConfig.DrawToneHelper); + SelectSlides[_SelectSlideTimerLook].SetValues((int)CConfig.TimerLook); + SelectSlides[_SelectSlideFadeInfo].SetValues((int)CConfig.FadePlayerInfo); + SelectSlides[_SelectSlideCoverLoading].SetValues((int)CConfig.CoverLoading); } - public override bool HandleInput(KeyEvent keyEvent) + public override bool HandleInput(SKeyEvent keyEvent) { base.HandleInput(keyEvent); @@ -78,7 +78,7 @@ namespace Vocaluxe.Screens { case Keys.Escape: case Keys.Back: - Close(); + _Close(); break; case Keys.S: @@ -87,35 +87,35 @@ namespace Vocaluxe.Screens break; case Keys.Enter: - if (Buttons[ButtonExit].Selected) - Close(); + if (Buttons[_ButtonExit].Selected) + _Close(); break; case Keys.Left: - OnChange(); + _OnChange(); break; case Keys.Right: - OnChange(); + _OnChange(); break; } } return true; } - public override bool HandleMouse(MouseEvent mouseEvent) + public override bool HandleMouse(SMouseEvent mouseEvent) { base.HandleMouse(mouseEvent); if (mouseEvent.RB) - Close(); + _Close(); if (mouseEvent.LB && IsMouseOver(mouseEvent)) { - if (Buttons[ButtonExit].Selected) - Close(); + if (Buttons[_ButtonExit].Selected) + _Close(); else - OnChange(); + _OnChange(); } return true; } @@ -141,26 +141,26 @@ namespace Vocaluxe.Screens return true; } - private void Close() + private void _Close() { - SaveConfig(); + _SaveConfig(); CGraphics.FadeTo(EScreens.ScreenOptions); } - private void SaveConfig() + private void _SaveConfig() { - CConfig.Theme = CTheme.ThemeNames[SelectSlides[SelectSlideTheme].Selection]; - CConfig.Skin = CTheme.SkinNames[SelectSlides[SelectSlideSkin].Selection]; - CConfig.CoverTheme = CCover.CoverThemes[SelectSlides[SelectSlideCover].Selection]; - CConfig.DrawNoteLines = (EOffOn)SelectSlides[SelectSlideNoteLines].Selection; - CConfig.DrawToneHelper = (EOffOn)SelectSlides[SelectSlideToneHelper].Selection; - CConfig.TimerLook = (ETimerLook)SelectSlides[SelectSlideTimerLook].Selection; - CConfig.FadePlayerInfo = (EFadePlayerInfo)SelectSlides[SelectSlideFadeInfo].Selection; - CConfig.CoverLoading = (ECoverLoading)SelectSlides[SelectSlideCoverLoading].Selection; + CConfig.Theme = CTheme.ThemeNames[SelectSlides[_SelectSlideTheme].Selection]; + CConfig.Skin = CTheme.SkinNames[SelectSlides[_SelectSlideSkin].Selection]; + CConfig.CoverTheme = CCover.CoverThemes[SelectSlides[_SelectSlideCover].Selection]; + CConfig.DrawNoteLines = (EOffOn)SelectSlides[_SelectSlideNoteLines].Selection; + CConfig.DrawToneHelper = (EOffOn)SelectSlides[_SelectSlideToneHelper].Selection; + CConfig.TimerLook = (ETimerLook)SelectSlides[_SelectSlideTimerLook].Selection; + CConfig.FadePlayerInfo = (EFadePlayerInfo)SelectSlides[_SelectSlideFadeInfo].Selection; + CConfig.CoverLoading = (ECoverLoading)SelectSlides[_SelectSlideCoverLoading].Selection; CConfig.SaveConfig(); - if (_OldCoverTheme != SelectSlides[SelectSlideCover].Selection) + if (_OldCoverTheme != SelectSlides[_SelectSlideCover].Selection) { CCover.ReloadCover(); CSongs.Filter.SearchString = String.Empty; @@ -168,10 +168,10 @@ namespace Vocaluxe.Screens CSongs.Categorizer.Tabs = CConfig.Tabs; } - if (_OldTheme != SelectSlides[SelectSlideTheme].Selection) + if (_OldTheme != SelectSlides[_SelectSlideTheme].Selection) { - CConfig.Theme = CTheme.ThemeNames[SelectSlides[SelectSlideTheme].Selection]; - _OldTheme = SelectSlides[SelectSlideTheme].Selection; + CConfig.Theme = CTheme.ThemeNames[SelectSlides[_SelectSlideTheme].Selection]; + _OldTheme = SelectSlides[_SelectSlideTheme].Selection; CTheme.UnloadSkins(); CFonts.UnloadThemeFonts(CConfig.Theme); @@ -189,12 +189,12 @@ namespace Vocaluxe.Screens } } - private void OnChange() + private void _OnChange() { - if (_OldTheme != SelectSlides[SelectSlideTheme].Selection) + if (_OldTheme != SelectSlides[_SelectSlideTheme].Selection) { - CConfig.Theme = CTheme.ThemeNames[SelectSlides[SelectSlideTheme].Selection]; - _OldTheme = SelectSlides[SelectSlideTheme].Selection; + CConfig.Theme = CTheme.ThemeNames[SelectSlides[_SelectSlideTheme].Selection]; + _OldTheme = SelectSlides[_SelectSlideTheme].Selection; CTheme.UnloadSkins(); CFonts.UnloadThemeFonts(CConfig.Theme); @@ -214,18 +214,18 @@ namespace Vocaluxe.Screens return; } - if (_TempSkin != SelectSlides[SelectSlideSkin].Selection) + if (_TempSkin != SelectSlides[_SelectSlideSkin].Selection) { - _TempSkin = SelectSlides[SelectSlideSkin].Selection; + _TempSkin = SelectSlides[_SelectSlideSkin].Selection; - PauseBG(); + _PauseBG(); CConfig.Skin = CTheme.SkinNames[_TempSkin]; CGraphics.ReloadSkin(); - ResumeBG(); + _ResumeBG(); } } - private void AfterSkinReload() + private void _AfterSkinReload() { _Active = true; } diff --git a/Vocaluxe/Screens/CScreenOptionsVideo.cs b/Vocaluxe/Screens/CScreenOptionsVideo.cs index c37ea343..0b91cd2a 100644 --- a/Vocaluxe/Screens/CScreenOptionsVideo.cs +++ b/Vocaluxe/Screens/CScreenOptionsVideo.cs @@ -14,16 +14,16 @@ namespace Vocaluxe.Screens get { return 3; } } - private const string SelectSlideVideoBackgrounds = "SelectSlideVideoBackgrounds"; - private const string SelectSlideVideoPreview = "SelectSlideVideoPreview"; - private const string SelectSlideVideosInSongs = "SelectSlideVideosInSongs"; - private const string SelectSlideVideosToBackground = "SelectSlideVideosToBackground"; - private const string SelectSlideWebcamDevices = "SelectSlideWebcamDevices"; - private const string SelectSlideWebcamCapabilities = "SelectSlideWebcamCapabilities"; + private const string _SelectSlideVideoBackgrounds = "SelectSlideVideoBackgrounds"; + private const string _SelectSlideVideoPreview = "SelectSlideVideoPreview"; + private const string _SelectSlideVideosInSongs = "SelectSlideVideosInSongs"; + private const string _SelectSlideVideosToBackground = "SelectSlideVideosToBackground"; + private const string _SelectSlideWebcamDevices = "SelectSlideWebcamDevices"; + private const string _SelectSlideWebcamCapabilities = "SelectSlideWebcamCapabilities"; - private const string StaticWebcamOutput = "StaticWebcamOutput"; + private const string _StaticWebcamOutput = "StaticWebcamOutput"; - private const string ButtonExit = "ButtonExit"; + private const string _ButtonExit = "ButtonExit"; private SWebcamConfig _Config; private STexture _WebcamTexture = new STexture(-1); @@ -34,26 +34,26 @@ namespace Vocaluxe.Screens { base.Init(); - _ThemeStatics = new string[] {StaticWebcamOutput}; - _ThemeButtons = new string[] {ButtonExit}; + _ThemeStatics = new string[] {_StaticWebcamOutput}; + _ThemeButtons = new string[] {_ButtonExit}; _ThemeSelectSlides = new string[] { - SelectSlideVideoBackgrounds, SelectSlideVideoPreview, SelectSlideVideosInSongs, SelectSlideVideosToBackground, SelectSlideWebcamDevices, - SelectSlideWebcamCapabilities + _SelectSlideVideoBackgrounds, _SelectSlideVideoPreview, _SelectSlideVideosInSongs, _SelectSlideVideosToBackground, _SelectSlideWebcamDevices, + _SelectSlideWebcamCapabilities }; } - public override void LoadTheme(string XmlPath) + public override void LoadTheme(string xmlPath) { - base.LoadTheme(XmlPath); + base.LoadTheme(xmlPath); - SelectSlides[SelectSlideVideoBackgrounds].SetValues((int)CConfig.VideoBackgrounds); - SelectSlides[SelectSlideVideoPreview].SetValues((int)CConfig.VideoPreview); - SelectSlides[SelectSlideVideosInSongs].SetValues((int)CConfig.VideosInSongs); - SelectSlides[SelectSlideVideosToBackground].SetValues((int)CConfig.VideosToBackground); + SelectSlides[_SelectSlideVideoBackgrounds].SetValues((int)CConfig.VideoBackgrounds); + SelectSlides[_SelectSlideVideoPreview].SetValues((int)CConfig.VideoPreview); + SelectSlides[_SelectSlideVideosInSongs].SetValues((int)CConfig.VideosInSongs); + SelectSlides[_SelectSlideVideosToBackground].SetValues((int)CConfig.VideosToBackground); } - public override bool HandleInput(KeyEvent keyEvent) + public override bool HandleInput(SKeyEvent keyEvent) { base.HandleInput(keyEvent); @@ -64,7 +64,7 @@ namespace Vocaluxe.Screens { case Keys.Escape: case Keys.Back: - SaveConfig(); + _SaveConfig(); CGraphics.FadeTo(EScreens.ScreenOptions); break; @@ -74,51 +74,51 @@ namespace Vocaluxe.Screens break; case Keys.Enter: - if (Buttons[ButtonExit].Selected) + if (Buttons[_ButtonExit].Selected) { - SaveConfig(); + _SaveConfig(); CGraphics.FadeTo(EScreens.ScreenOptions); } break; case Keys.Left: - if (SelectSlides[SelectSlideWebcamDevices].Selected) - OnDeviceEvent(); - if (SelectSlides[SelectSlideWebcamCapabilities].Selected) - OnCapabilitiesEvent(); - SaveConfig(); + if (SelectSlides[_SelectSlideWebcamDevices].Selected) + _OnDeviceEvent(); + if (SelectSlides[_SelectSlideWebcamCapabilities].Selected) + _OnCapabilitiesEvent(); + _SaveConfig(); break; case Keys.Right: - if (SelectSlides[SelectSlideWebcamDevices].Selected) - OnDeviceEvent(); - if (SelectSlides[SelectSlideWebcamCapabilities].Selected) - OnCapabilitiesEvent(); - SaveConfig(); + if (SelectSlides[_SelectSlideWebcamDevices].Selected) + _OnDeviceEvent(); + if (SelectSlides[_SelectSlideWebcamCapabilities].Selected) + _OnCapabilitiesEvent(); + _SaveConfig(); break; } } return true; } - public override bool HandleMouse(MouseEvent mouseEvent) + public override bool HandleMouse(SMouseEvent mouseEvent) { base.HandleMouse(mouseEvent); if (mouseEvent.RB) { - SaveConfig(); + _SaveConfig(); CGraphics.FadeTo(EScreens.ScreenOptions); } if (mouseEvent.LB && IsMouseOver(mouseEvent)) { - if (SelectSlides[SelectSlideWebcamDevices].Selected) - OnDeviceEvent(); - if (SelectSlides[SelectSlideWebcamCapabilities].Selected) - OnCapabilitiesEvent(); - SaveConfig(); - if (Buttons[ButtonExit].Selected) + if (SelectSlides[_SelectSlideWebcamDevices].Selected) + _OnDeviceEvent(); + if (SelectSlides[_SelectSlideWebcamCapabilities].Selected) + _OnCapabilitiesEvent(); + _SaveConfig(); + if (Buttons[_ButtonExit].Selected) CGraphics.FadeTo(EScreens.ScreenOptions); } return true; @@ -127,8 +127,8 @@ namespace Vocaluxe.Screens public override bool UpdateGame() { CWebcam.GetFrame(ref _WebcamTexture); - Statics[StaticWebcamOutput].Texture = _WebcamTexture; - SelectSlides[SelectSlideVideosToBackground].Selection = (int)CConfig.VideosToBackground; + Statics[_StaticWebcamOutput].Texture = _WebcamTexture; + SelectSlides[_SelectSlideVideosToBackground].Selection = (int)CConfig.VideosToBackground; return true; } @@ -148,8 +148,8 @@ namespace Vocaluxe.Screens public override void OnShow() { base.OnShow(); - SelectSlides[SelectSlideWebcamDevices].Clear(); - SelectSlides[SelectSlideWebcamCapabilities].Clear(); + SelectSlides[_SelectSlideWebcamDevices].Clear(); + SelectSlides[_SelectSlideWebcamCapabilities].Clear(); _DeviceNr = -1; _CapabilityNr = -1; @@ -164,18 +164,18 @@ namespace Vocaluxe.Screens { _DeviceNr = 0; _CapabilityNr = 0; - GetFirstConfiguredWebcamDevice(ref _DeviceNr, ref _CapabilityNr); + _GetFirstConfiguredWebcamDevice(ref _DeviceNr, ref _CapabilityNr); foreach (SWebcamDevice d in devices) - SelectSlides[SelectSlideWebcamDevices].AddValue(d.Name); - SelectSlides[SelectSlideWebcamDevices].Selection = _DeviceNr; + SelectSlides[_SelectSlideWebcamDevices].AddValue(d.Name); + SelectSlides[_SelectSlideWebcamDevices].Selection = _DeviceNr; foreach (SCapabilities c in devices[_DeviceNr].Capabilities) - SelectSlides[SelectSlideWebcamCapabilities].AddValue(c.Width.ToString() + " x " + c.Height.ToString() + " @ " + c.Framerate.ToString() + " FPS "); - _Config.MonikerString = devices[SelectSlides[SelectSlideWebcamDevices].Selection].MonikerString; - _Config.Width = devices[SelectSlides[SelectSlideWebcamDevices].Selection].Capabilities[SelectSlides[SelectSlideWebcamCapabilities].Selection].Width; - _Config.Height = devices[SelectSlides[SelectSlideWebcamDevices].Selection].Capabilities[SelectSlides[SelectSlideWebcamCapabilities].Selection].Height; - _Config.Framerate = devices[SelectSlides[SelectSlideWebcamDevices].Selection].Capabilities[SelectSlides[SelectSlideWebcamCapabilities].Selection].Framerate; + SelectSlides[_SelectSlideWebcamCapabilities].AddValue(c.Width.ToString() + " x " + c.Height.ToString() + " @ " + c.Framerate.ToString() + " FPS "); + _Config.MonikerString = devices[SelectSlides[_SelectSlideWebcamDevices].Selection].MonikerString; + _Config.Width = devices[SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[SelectSlides[_SelectSlideWebcamCapabilities].Selection].Width; + _Config.Height = devices[SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[SelectSlides[_SelectSlideWebcamCapabilities].Selection].Height; + _Config.Framerate = devices[SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[SelectSlides[_SelectSlideWebcamCapabilities].Selection].Framerate; CWebcam.Close(); CWebcam.Select(CConfig.WebcamConfig); CWebcam.Start(); @@ -188,17 +188,17 @@ namespace Vocaluxe.Screens devices = null; } - SelectSlides[SelectSlideWebcamDevices].Visible = devices != null && devices.Length > 0; - SelectSlides[SelectSlideWebcamCapabilities].Visible = devices != null && devices.Length > 0; - Statics[StaticWebcamOutput].Visible = devices != null && devices.Length > 0; + SelectSlides[_SelectSlideWebcamDevices].Visible = devices != null && devices.Length > 0; + SelectSlides[_SelectSlideWebcamCapabilities].Visible = devices != null && devices.Length > 0; + Statics[_StaticWebcamOutput].Visible = devices != null && devices.Length > 0; } - private void SaveConfig() + private void _SaveConfig() { - CConfig.VideoBackgrounds = (EOffOn)SelectSlides[SelectSlideVideoBackgrounds].Selection; - CConfig.VideoPreview = (EOffOn)SelectSlides[SelectSlideVideoPreview].Selection; - CConfig.VideosInSongs = (EOffOn)SelectSlides[SelectSlideVideosInSongs].Selection; - CConfig.VideosToBackground = (EOffOn)SelectSlides[SelectSlideVideosToBackground].Selection; + CConfig.VideoBackgrounds = (EOffOn)SelectSlides[_SelectSlideVideoBackgrounds].Selection; + CConfig.VideoPreview = (EOffOn)SelectSlides[_SelectSlideVideoPreview].Selection; + CConfig.VideosInSongs = (EOffOn)SelectSlides[_SelectSlideVideosInSongs].Selection; + CConfig.VideosToBackground = (EOffOn)SelectSlides[_SelectSlideVideosToBackground].Selection; CConfig.WebcamConfig = _Config; CBackgroundMusic.VideoEnabled = true; @@ -206,26 +206,26 @@ namespace Vocaluxe.Screens CConfig.SaveConfig(); } - private void OnDeviceEvent() + private void _OnDeviceEvent() { - if (SelectSlides[SelectSlideWebcamDevices].Selection != _DeviceNr) + if (SelectSlides[_SelectSlideWebcamDevices].Selection != _DeviceNr) { - SelectSlides[SelectSlideWebcamCapabilities].Clear(); - _DeviceNr = SelectSlides[SelectSlideWebcamDevices].Selection; + SelectSlides[_SelectSlideWebcamCapabilities].Clear(); + _DeviceNr = SelectSlides[_SelectSlideWebcamDevices].Selection; _CapabilityNr = 0; SWebcamDevice[] d = CWebcam.GetDevices(); - for (int i = 0; i < d[SelectSlides[SelectSlideWebcamDevices].Selection].Capabilities.Count; i++) + for (int i = 0; i < d[SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities.Count; i++) { - SelectSlides[SelectSlideWebcamCapabilities].AddValue(d[_DeviceNr].Capabilities[i].Width.ToString() + " x " + d[_DeviceNr].Capabilities[i].Height.ToString() + + SelectSlides[_SelectSlideWebcamCapabilities].AddValue(d[_DeviceNr].Capabilities[i].Width.ToString() + " x " + d[_DeviceNr].Capabilities[i].Height.ToString() + " @ " + d[_DeviceNr].Capabilities[i].Framerate.ToString() + "FPS"); } - SelectSlides[SelectSlideWebcamCapabilities].Selection = 0; + SelectSlides[_SelectSlideWebcamCapabilities].Selection = 0; - _Config.MonikerString = d[SelectSlides[SelectSlideWebcamDevices].Selection].MonikerString; - _Config.Width = d[SelectSlides[SelectSlideWebcamDevices].Selection].Capabilities[SelectSlides[SelectSlideWebcamCapabilities].Selection].Width; - _Config.Height = d[SelectSlides[SelectSlideWebcamDevices].Selection].Capabilities[SelectSlides[SelectSlideWebcamCapabilities].Selection].Height; - _Config.Framerate = d[SelectSlides[SelectSlideWebcamDevices].Selection].Capabilities[SelectSlides[SelectSlideWebcamCapabilities].Selection].Framerate; + _Config.MonikerString = d[SelectSlides[_SelectSlideWebcamDevices].Selection].MonikerString; + _Config.Width = d[SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[SelectSlides[_SelectSlideWebcamCapabilities].Selection].Width; + _Config.Height = d[SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[SelectSlides[_SelectSlideWebcamCapabilities].Selection].Height; + _Config.Framerate = d[SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[SelectSlides[_SelectSlideWebcamCapabilities].Selection].Framerate; CWebcam.Close(); CWebcam.Select(_Config); @@ -233,17 +233,17 @@ namespace Vocaluxe.Screens } } - private void OnCapabilitiesEvent() + private void _OnCapabilitiesEvent() { - if (SelectSlides[SelectSlideWebcamCapabilities].Selection != _CapabilityNr) + if (SelectSlides[_SelectSlideWebcamCapabilities].Selection != _CapabilityNr) { - _CapabilityNr = SelectSlides[SelectSlideWebcamCapabilities].Selection; + _CapabilityNr = SelectSlides[_SelectSlideWebcamCapabilities].Selection; SWebcamDevice[] d = CWebcam.GetDevices(); - _Config.MonikerString = d[SelectSlides[SelectSlideWebcamDevices].Selection].MonikerString; - _Config.Width = d[SelectSlides[SelectSlideWebcamDevices].Selection].Capabilities[SelectSlides[SelectSlideWebcamCapabilities].Selection].Width; - _Config.Height = d[SelectSlides[SelectSlideWebcamDevices].Selection].Capabilities[SelectSlides[SelectSlideWebcamCapabilities].Selection].Height; - _Config.Framerate = d[SelectSlides[SelectSlideWebcamDevices].Selection].Capabilities[SelectSlides[SelectSlideWebcamCapabilities].Selection].Framerate; + _Config.MonikerString = d[SelectSlides[_SelectSlideWebcamDevices].Selection].MonikerString; + _Config.Width = d[SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[SelectSlides[_SelectSlideWebcamCapabilities].Selection].Width; + _Config.Height = d[SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[SelectSlides[_SelectSlideWebcamCapabilities].Selection].Height; + _Config.Framerate = d[SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[SelectSlides[_SelectSlideWebcamCapabilities].Selection].Framerate; CWebcam.Close(); CWebcam.Select(_Config); @@ -251,7 +251,7 @@ namespace Vocaluxe.Screens } } - private void GetFirstConfiguredWebcamDevice(ref int Device, ref int Capabilities) + private void _GetFirstConfiguredWebcamDevice(ref int device, ref int capabilities) { SWebcamDevice[] devices = CWebcam.GetDevices(); @@ -267,8 +267,8 @@ namespace Vocaluxe.Screens if (devices[i].Capabilities[j].Framerate == CConfig.WebcamConfig.Framerate && devices[i].Capabilities[j].Width == CConfig.WebcamConfig.Width && devices[i].Capabilities[j].Height == CConfig.WebcamConfig.Height) { - Device = i; - Capabilities = j; + device = i; + capabilities = j; return; } } diff --git a/Vocaluxe/Screens/CScreenParty.cs b/Vocaluxe/Screens/CScreenParty.cs index 8610b257..0d3892e1 100644 --- a/Vocaluxe/Screens/CScreenParty.cs +++ b/Vocaluxe/Screens/CScreenParty.cs @@ -13,16 +13,16 @@ namespace Vocaluxe.Screens get { return 1; } } - private const string TextDescription = "TextDescription"; - private const string TextTargetAudience = "TextTargetAudience"; - private const string TextNumTeams = "TextNumTeams"; - private const string TextNumPlayers = "TextNumPlayers"; - private const string TextAuthor = "TextAuthor"; - private const string TextVersion = "TextVersion"; - private const string TextError = "TextError"; - private const string ButtonStart = "ButtonStart"; - private const string ButtonExit = "ButtonExit"; - private const string SelectSlideModes = "SelectSlideModes"; + private const string _TextDescription = "TextDescription"; + private const string _TextTargetAudience = "TextTargetAudience"; + private const string _TextNumTeams = "TextNumTeams"; + private const string _TextNumPlayers = "TextNumPlayers"; + private const string _TextAuthor = "TextAuthor"; + private const string _TextVersion = "TextVersion"; + private const string _TextError = "TextError"; + private const string _ButtonStart = "ButtonStart"; + private const string _ButtonExit = "ButtonExit"; + private const string _SelectSlideModes = "SelectSlideModes"; private List _PartyModeInfos; @@ -30,12 +30,12 @@ namespace Vocaluxe.Screens { base.Init(); - _ThemeTexts = new string[] {TextDescription, TextTargetAudience, TextNumTeams, TextNumPlayers, TextAuthor, TextVersion, TextError}; - _ThemeButtons = new string[] {ButtonStart, ButtonExit}; - _ThemeSelectSlides = new string[] {SelectSlideModes}; + _ThemeTexts = new string[] {_TextDescription, _TextTargetAudience, _TextNumTeams, _TextNumPlayers, _TextAuthor, _TextVersion, _TextError}; + _ThemeButtons = new string[] {_ButtonStart, _ButtonExit}; + _ThemeSelectSlides = new string[] {_SelectSlideModes}; } - public override bool HandleInput(KeyEvent keyEvent) + public override bool HandleInput(SKeyEvent keyEvent) { base.HandleInput(keyEvent); @@ -50,37 +50,37 @@ namespace Vocaluxe.Screens break; case Keys.Enter: - if (Buttons[ButtonStart].Selected) - StartPartyMode(); + if (Buttons[_ButtonStart].Selected) + _StartPartyMode(); - if (Buttons[ButtonExit].Selected) + if (Buttons[_ButtonExit].Selected) CGraphics.FadeTo(EScreens.ScreenMain); break; case Keys.Left: case Keys.Right: - if (SelectSlides[SelectSlideModes].Selected) - UpdateSelection(); + if (SelectSlides[_SelectSlideModes].Selected) + _UpdateSelection(); break; } } return true; } - public override bool HandleMouse(MouseEvent mouseEvent) + public override bool HandleMouse(SMouseEvent mouseEvent) { base.HandleMouse(mouseEvent); if (mouseEvent.LB && IsMouseOver(mouseEvent)) { - if (Buttons[ButtonStart].Selected) - StartPartyMode(); + if (Buttons[_ButtonStart].Selected) + _StartPartyMode(); - if (Buttons[ButtonExit].Selected) + if (Buttons[_ButtonExit].Selected) CGraphics.FadeTo(EScreens.ScreenMain); - if (SelectSlides[SelectSlideModes].Selected) - UpdateSelection(); + if (SelectSlides[_SelectSlideModes].Selected) + _UpdateSelection(); } if (mouseEvent.RB) @@ -95,13 +95,13 @@ namespace Vocaluxe.Screens _PartyModeInfos = CParty.GetPartyModeInfos(); - SelectSlides[SelectSlideModes].Clear(); + SelectSlides[_SelectSlideModes].Clear(); foreach (SPartyModeInfos info in _PartyModeInfos) - SelectSlides[SelectSlideModes].AddValue(info.Name, info.PartyModeID); - SelectSlides[SelectSlideModes].Selection = 0; - UpdateSelection(); + SelectSlides[_SelectSlideModes].AddValue(info.Name, info.PartyModeID); + SelectSlides[_SelectSlideModes].Selection = 0; + _UpdateSelection(); - SetInteractionToSelectSlide(SelectSlides[SelectSlideModes]); + SetInteractionToSelectSlide(SelectSlides[_SelectSlideModes]); } public override bool UpdateGame() @@ -116,63 +116,63 @@ namespace Vocaluxe.Screens return true; } - private void UpdateSelection() + private void _UpdateSelection() { if (_PartyModeInfos.Count == 0) return; - int index = SelectSlides[SelectSlideModes].Selection; + int index = SelectSlides[_SelectSlideModes].Selection; if (index >= _PartyModeInfos.Count) return; //Description - Texts[TextDescription].Text = _PartyModeInfos[index].Description; - Texts[TextDescription].TranslationID = _PartyModeInfos[index].PartyModeID; + Texts[_TextDescription].Text = _PartyModeInfos[index].Description; + Texts[_TextDescription].TranslationID = _PartyModeInfos[index].PartyModeID; //TargetAudience - Texts[TextTargetAudience].TranslationID = _PartyModeInfos[index].PartyModeID; - Texts[TextTargetAudience].Text = _PartyModeInfos[index].TargetAudience; + Texts[_TextTargetAudience].TranslationID = _PartyModeInfos[index].PartyModeID; + Texts[_TextTargetAudience].Text = _PartyModeInfos[index].TargetAudience; //NumTeams if (_PartyModeInfos[index].MaxTeams == 0) - Texts[TextNumTeams].Text = "TR_SCREENPARTY_NOTEAMS"; + Texts[_TextNumTeams].Text = "TR_SCREENPARTY_NOTEAMS"; else if (_PartyModeInfos[index].MaxTeams == _PartyModeInfos[index].MinTeams) - Texts[TextNumTeams].Text = _PartyModeInfos[index].MaxTeams.ToString(); + Texts[_TextNumTeams].Text = _PartyModeInfos[index].MaxTeams.ToString(); else if (_PartyModeInfos[index].MaxTeams > _PartyModeInfos[index].MinTeams) - Texts[TextNumTeams].Text = _PartyModeInfos[index].MinTeams + " - " + _PartyModeInfos[index].MaxTeams; + Texts[_TextNumTeams].Text = _PartyModeInfos[index].MinTeams + " - " + _PartyModeInfos[index].MaxTeams; //NumPlayers if (_PartyModeInfos[index].MaxPlayers == _PartyModeInfos[index].MinPlayers) - Texts[TextNumPlayers].Text = _PartyModeInfos[index].MaxTeams.ToString(); + Texts[_TextNumPlayers].Text = _PartyModeInfos[index].MaxTeams.ToString(); else if (_PartyModeInfos[index].MaxPlayers > _PartyModeInfos[index].MinPlayers) - Texts[TextNumPlayers].Text = _PartyModeInfos[index].MinPlayers + " - " + _PartyModeInfos[index].MaxPlayers; + Texts[_TextNumPlayers].Text = _PartyModeInfos[index].MinPlayers + " - " + _PartyModeInfos[index].MaxPlayers; //Author - Texts[TextAuthor].Text = _PartyModeInfos[index].Author; - Texts[TextAuthor].TranslationID = _PartyModeInfos[index].PartyModeID; + Texts[_TextAuthor].Text = _PartyModeInfos[index].Author; + Texts[_TextAuthor].TranslationID = _PartyModeInfos[index].PartyModeID; //Version - Texts[TextVersion].Text = _PartyModeInfos[index].VersionMajor + "." + _PartyModeInfos[index].VersionMinor; - Texts[TextVersion].TranslationID = _PartyModeInfos[index].PartyModeID; + Texts[_TextVersion].Text = _PartyModeInfos[index].VersionMajor + "." + _PartyModeInfos[index].VersionMinor; + Texts[_TextVersion].TranslationID = _PartyModeInfos[index].PartyModeID; if (!_PartyModeInfos[index].Playable) { - Buttons[ButtonStart].Visible = false; - Texts[TextError].Visible = true; + Buttons[_ButtonStart].Visible = false; + Texts[_TextError].Visible = true; } else { - Buttons[ButtonStart].Visible = true; - Texts[TextError].Visible = false; + Buttons[_ButtonStart].Visible = true; + Texts[_TextError].Visible = false; } } - private void StartPartyMode() + private void _StartPartyMode() { if (_PartyModeInfos.Count == 0) return; - int index = SelectSlides[SelectSlideModes].Selection; + int index = SelectSlides[_SelectSlideModes].Selection; if (index >= _PartyModeInfos.Count) return; diff --git a/Vocaluxe/Screens/CScreenProfiles.cs b/Vocaluxe/Screens/CScreenProfiles.cs index c8f840d3..cdf9b8ec 100644 --- a/Vocaluxe/Screens/CScreenProfiles.cs +++ b/Vocaluxe/Screens/CScreenProfiles.cs @@ -22,22 +22,22 @@ namespace Vocaluxe.Screens get { return 2; } } - private const string SelectSlideProfiles = "SelectSlideProfiles"; - private const string SelectSlideDifficulty = "SelectSlideDifficulty"; - private const string SelectSlideAvatars = "SelectSlideAvatars"; - private const string SelectSlideGuestProfile = "SelectSlideGuestProfile"; - private const string SelectSlideActive = "SelectSlideActive"; - private const string ButtonPlayerName = "ButtonPlayerName"; - private const string ButtonExit = "ButtonExit"; - private const string ButtonSave = "ButtonSave"; - private const string ButtonNew = "ButtonNew"; - private const string ButtonDelete = "ButtonDelete"; - private const string ButtonWebcam = "ButtonWebcam"; - private const string ButtonSaveSnapshot = "ButtonSaveSnapshot"; - private const string ButtonDiscardSnapshot = "ButtonDiscardSnapshot"; - private const string ButtonTakeSnapshot = "ButtonTakeSnapshot"; + private const string _SelectSlideProfiles = "SelectSlideProfiles"; + private const string _SelectSlideDifficulty = "SelectSlideDifficulty"; + private const string _SelectSlideAvatars = "SelectSlideAvatars"; + private const string _SelectSlideGuestProfile = "SelectSlideGuestProfile"; + private const string _SelectSlideActive = "SelectSlideActive"; + private const string _ButtonPlayerName = "ButtonPlayerName"; + private const string _ButtonExit = "ButtonExit"; + private const string _ButtonSave = "ButtonSave"; + private const string _ButtonNew = "ButtonNew"; + private const string _ButtonDelete = "ButtonDelete"; + private const string _ButtonWebcam = "ButtonWebcam"; + private const string _ButtonSaveSnapshot = "ButtonSaveSnapshot"; + private const string _ButtonDiscardSnapshot = "ButtonDiscardSnapshot"; + private const string _ButtonTakeSnapshot = "ButtonTakeSnapshot"; - private const string StaticAvatar = "StaticAvatar"; + private const string _StaticAvatar = "StaticAvatar"; private EEditMode _EditMode; @@ -49,30 +49,30 @@ namespace Vocaluxe.Screens base.Init(); _ThemeButtons = new string[] - {ButtonPlayerName, ButtonExit, ButtonSave, ButtonNew, ButtonDelete, ButtonWebcam, ButtonSaveSnapshot, ButtonDiscardSnapshot, ButtonTakeSnapshot}; - _ThemeSelectSlides = new string[] {SelectSlideProfiles, SelectSlideDifficulty, SelectSlideAvatars, SelectSlideGuestProfile, SelectSlideActive}; - _ThemeStatics = new string[] {StaticAvatar}; + {_ButtonPlayerName, _ButtonExit, _ButtonSave, _ButtonNew, _ButtonDelete, _ButtonWebcam, _ButtonSaveSnapshot, _ButtonDiscardSnapshot, _ButtonTakeSnapshot}; + _ThemeSelectSlides = new string[] {_SelectSlideProfiles, _SelectSlideDifficulty, _SelectSlideAvatars, _SelectSlideGuestProfile, _SelectSlideActive}; + _ThemeStatics = new string[] {_StaticAvatar}; _EditMode = EEditMode.None; } - public override void LoadTheme(string XmlPath) + public override void LoadTheme(string xmlPath) { - base.LoadTheme(XmlPath); + base.LoadTheme(xmlPath); - Buttons[ButtonSaveSnapshot].Visible = false; - Buttons[ButtonDiscardSnapshot].Visible = false; - Buttons[ButtonTakeSnapshot].Visible = false; + Buttons[_ButtonSaveSnapshot].Visible = false; + Buttons[_ButtonDiscardSnapshot].Visible = false; + Buttons[_ButtonTakeSnapshot].Visible = false; if (CWebcam.GetDevices().Length > 0) - Buttons[ButtonWebcam].Visible = true; + Buttons[_ButtonWebcam].Visible = true; else - Buttons[ButtonWebcam].Visible = false; - SelectSlides[SelectSlideDifficulty].SetValues(0); - SelectSlides[SelectSlideGuestProfile].SetValues(0); - SelectSlides[SelectSlideActive].SetValues(0); + Buttons[_ButtonWebcam].Visible = false; + SelectSlides[_SelectSlideDifficulty].SetValues(0); + SelectSlides[_SelectSlideGuestProfile].SetValues(0); + SelectSlides[_SelectSlideActive].SetValues(0); } - public override bool HandleInput(KeyEvent keyEvent) + public override bool HandleInput(SKeyEvent keyEvent) { if (_EditMode == EEditMode.None) base.HandleInput(keyEvent); @@ -84,8 +84,8 @@ namespace Vocaluxe.Screens case EEditMode.None: break; case EEditMode.PlayerName: - SelectSlides[SelectSlideProfiles].RenameValue( - CProfiles.AddGetPlayerName(SelectSlides[SelectSlideProfiles].Selection, keyEvent.Unicode)); + SelectSlides[_SelectSlideProfiles].RenameValue( + CProfiles.AddGetPlayerName(SelectSlides[_SelectSlideProfiles].Selection, keyEvent.Unicode)); break; } } @@ -98,122 +98,122 @@ namespace Vocaluxe.Screens break; case Keys.Enter: - if (Buttons[ButtonExit].Selected) + if (Buttons[_ButtonExit].Selected) CGraphics.FadeTo(EScreens.ScreenMain); - else if (Buttons[ButtonSave].Selected) - SaveProfiles(); - else if (Buttons[ButtonNew].Selected) - NewProfile(); - else if (Buttons[ButtonPlayerName].Selected) + else if (Buttons[_ButtonSave].Selected) + _SaveProfiles(); + else if (Buttons[_ButtonNew].Selected) + _NewProfile(); + else if (Buttons[_ButtonPlayerName].Selected) { if (CProfiles.NumProfiles > 0 && _EditMode != EEditMode.PlayerName) _EditMode = EEditMode.PlayerName; else _EditMode = EEditMode.None; } - else if (Buttons[ButtonDelete].Selected) - DeleteProfile(); - else if (Buttons[ButtonWebcam].Selected && CWebcam.GetDevices().Length > 0) - OnWebcam(); - else if (Buttons[ButtonSaveSnapshot].Selected && CWebcam.GetDevices().Length > 0) - OnSaveSnapshot(); - else if (Buttons[ButtonDiscardSnapshot].Selected && CWebcam.GetDevices().Length > 0) - OnDiscardSnapshot(); - else if (Buttons[ButtonTakeSnapshot].Selected && CWebcam.GetDevices().Length > 0) - OnTakeSnapshot(); + else if (Buttons[_ButtonDelete].Selected) + _DeleteProfile(); + else if (Buttons[_ButtonWebcam].Selected && CWebcam.GetDevices().Length > 0) + _OnWebcam(); + else if (Buttons[_ButtonSaveSnapshot].Selected && CWebcam.GetDevices().Length > 0) + _OnSaveSnapshot(); + else if (Buttons[_ButtonDiscardSnapshot].Selected && CWebcam.GetDevices().Length > 0) + _OnDiscardSnapshot(); + else if (Buttons[_ButtonTakeSnapshot].Selected && CWebcam.GetDevices().Length > 0) + _OnTakeSnapshot(); break; case Keys.Back: if (_EditMode == EEditMode.PlayerName) { - SelectSlides[SelectSlideProfiles].RenameValue( - CProfiles.GetDeleteCharInPlayerName(SelectSlides[SelectSlideProfiles].Selection)); + SelectSlides[_SelectSlideProfiles].RenameValue( + CProfiles.GetDeleteCharInPlayerName(SelectSlides[_SelectSlideProfiles].Selection)); } else CGraphics.FadeTo(EScreens.ScreenMain); break; case Keys.Delete: - DeleteProfile(); + _DeleteProfile(); break; } - if (SelectSlides[SelectSlideDifficulty].Selected) + if (SelectSlides[_SelectSlideDifficulty].Selected) { - CProfiles.SetDifficulty(SelectSlides[SelectSlideProfiles].Selection, - (EGameDifficulty)SelectSlides[SelectSlideDifficulty].Selection); + CProfiles.SetDifficulty(SelectSlides[_SelectSlideProfiles].Selection, + (EGameDifficulty)SelectSlides[_SelectSlideDifficulty].Selection); } - else if (SelectSlides[SelectSlideAvatars].Selected) + else if (SelectSlides[_SelectSlideAvatars].Selected) { - CProfiles.SetAvatar(SelectSlides[SelectSlideProfiles].Selection, - SelectSlides[SelectSlideAvatars].Selection); + CProfiles.SetAvatar(SelectSlides[_SelectSlideProfiles].Selection, + SelectSlides[_SelectSlideAvatars].Selection); } - else if (SelectSlides[SelectSlideGuestProfile].Selected) + else if (SelectSlides[_SelectSlideGuestProfile].Selected) { - CProfiles.SetGuestProfile(SelectSlides[SelectSlideProfiles].Selection, - (EOffOn)SelectSlides[SelectSlideGuestProfile].Selection); + CProfiles.SetGuestProfile(SelectSlides[_SelectSlideProfiles].Selection, + (EOffOn)SelectSlides[_SelectSlideGuestProfile].Selection); } - else if (SelectSlides[SelectSlideActive].Selected) + else if (SelectSlides[_SelectSlideActive].Selected) { - CProfiles.SetActive(SelectSlides[SelectSlideProfiles].Selection, - (EOffOn)SelectSlides[SelectSlideActive].Selection); + CProfiles.SetActive(SelectSlides[_SelectSlideProfiles].Selection, + (EOffOn)SelectSlides[_SelectSlideActive].Selection); } } return true; } - public override bool HandleMouse(MouseEvent mouseEvent) + public override bool HandleMouse(SMouseEvent mouseEvent) { if (_EditMode == EEditMode.None) base.HandleMouse(mouseEvent); if (mouseEvent.LB && IsMouseOver(mouseEvent)) { - if (Buttons[ButtonExit].Selected) + if (Buttons[_ButtonExit].Selected) CGraphics.FadeTo(EScreens.ScreenMain); - else if (Buttons[ButtonSave].Selected) - SaveProfiles(); - else if (Buttons[ButtonNew].Selected) - NewProfile(); - else if (Buttons[ButtonDelete].Selected) - DeleteProfile(); - else if (Buttons[ButtonPlayerName].Selected) + else if (Buttons[_ButtonSave].Selected) + _SaveProfiles(); + else if (Buttons[_ButtonNew].Selected) + _NewProfile(); + else if (Buttons[_ButtonDelete].Selected) + _DeleteProfile(); + else if (Buttons[_ButtonPlayerName].Selected) { if (CProfiles.NumProfiles > 0 && _EditMode != EEditMode.PlayerName) _EditMode = EEditMode.PlayerName; else _EditMode = EEditMode.None; } - else if (SelectSlides[SelectSlideDifficulty].Selected) + else if (SelectSlides[_SelectSlideDifficulty].Selected) { - CProfiles.SetDifficulty(SelectSlides[SelectSlideProfiles].Selection, - (EGameDifficulty)SelectSlides[SelectSlideDifficulty].Selection); + CProfiles.SetDifficulty(SelectSlides[_SelectSlideProfiles].Selection, + (EGameDifficulty)SelectSlides[_SelectSlideDifficulty].Selection); } - else if (SelectSlides[SelectSlideAvatars].Selected) + else if (SelectSlides[_SelectSlideAvatars].Selected) { - CProfiles.SetAvatar(SelectSlides[SelectSlideProfiles].Selection, - SelectSlides[SelectSlideAvatars].Selection); - if (CWebcam.GetDevices().Length > 0 && _WebcamTexture.index > 0) - OnDiscardSnapshot(); + CProfiles.SetAvatar(SelectSlides[_SelectSlideProfiles].Selection, + SelectSlides[_SelectSlideAvatars].Selection); + if (CWebcam.GetDevices().Length > 0 && _WebcamTexture.Index > 0) + _OnDiscardSnapshot(); } - else if (SelectSlides[SelectSlideGuestProfile].Selected) + else if (SelectSlides[_SelectSlideGuestProfile].Selected) { - CProfiles.SetGuestProfile(SelectSlides[SelectSlideProfiles].Selection, - (EOffOn)SelectSlides[SelectSlideGuestProfile].Selection); + CProfiles.SetGuestProfile(SelectSlides[_SelectSlideProfiles].Selection, + (EOffOn)SelectSlides[_SelectSlideGuestProfile].Selection); } - else if (SelectSlides[SelectSlideActive].Selected) + else if (SelectSlides[_SelectSlideActive].Selected) { - CProfiles.SetActive(SelectSlides[SelectSlideProfiles].Selection, - (EOffOn)SelectSlides[SelectSlideActive].Selection); + CProfiles.SetActive(SelectSlides[_SelectSlideProfiles].Selection, + (EOffOn)SelectSlides[_SelectSlideActive].Selection); } - else if (Buttons[ButtonWebcam].Selected && CWebcam.GetDevices().Length > 0) - OnWebcam(); - else if (Buttons[ButtonSaveSnapshot].Selected && CWebcam.GetDevices().Length > 0) - OnSaveSnapshot(); - else if (Buttons[ButtonDiscardSnapshot].Selected && CWebcam.GetDevices().Length > 0) - OnDiscardSnapshot(); - else if (Buttons[ButtonTakeSnapshot].Selected && CWebcam.GetDevices().Length > 0) - OnTakeSnapshot(); + else if (Buttons[_ButtonWebcam].Selected && CWebcam.GetDevices().Length > 0) + _OnWebcam(); + else if (Buttons[_ButtonSaveSnapshot].Selected && CWebcam.GetDevices().Length > 0) + _OnSaveSnapshot(); + else if (Buttons[_ButtonDiscardSnapshot].Selected && CWebcam.GetDevices().Length > 0) + _OnDiscardSnapshot(); + else if (Buttons[_ButtonTakeSnapshot].Selected && CWebcam.GetDevices().Length > 0) + _OnTakeSnapshot(); } if (mouseEvent.RB) @@ -221,35 +221,35 @@ namespace Vocaluxe.Screens return true; } - private void OnTakeSnapshot() + private void _OnTakeSnapshot() { - Buttons[ButtonSaveSnapshot].Visible = true; - Buttons[ButtonDiscardSnapshot].Visible = true; - Buttons[ButtonWebcam].Visible = false; - Buttons[ButtonTakeSnapshot].Visible = false; + Buttons[_ButtonSaveSnapshot].Visible = true; + Buttons[_ButtonDiscardSnapshot].Visible = true; + Buttons[_ButtonWebcam].Visible = false; + Buttons[_ButtonTakeSnapshot].Visible = false; _Snapshot = CWebcam.GetBitmap(); } - private void OnDiscardSnapshot() + private void _OnDiscardSnapshot() { CWebcam.Stop(); CDraw.RemoveTexture(ref _WebcamTexture); _Snapshot = null; - Buttons[ButtonSaveSnapshot].Visible = false; - Buttons[ButtonDiscardSnapshot].Visible = false; - Buttons[ButtonTakeSnapshot].Visible = false; - Buttons[ButtonWebcam].Visible = true; + Buttons[_ButtonSaveSnapshot].Visible = false; + Buttons[_ButtonDiscardSnapshot].Visible = false; + Buttons[_ButtonTakeSnapshot].Visible = false; + Buttons[_ButtonWebcam].Visible = true; } - private void OnSaveSnapshot() + private void _OnSaveSnapshot() { string filename = "snapshot"; int i = 0; - while (File.Exists(Path.Combine(CSettings.sFolderProfiles, filename + i + ".png"))) + while (File.Exists(Path.Combine(CSettings.FolderProfiles, filename + i + ".png"))) i++; - _Snapshot.Save(Path.Combine(CSettings.sFolderProfiles, filename + i + ".png"), ImageFormat.Png); + _Snapshot.Save(Path.Combine(CSettings.FolderProfiles, filename + i + ".png"), ImageFormat.Png); CProfiles.LoadAvatars(); - LoadAvatars(); + _LoadAvatars(); _Snapshot = null; CWebcam.Stop(); CDraw.RemoveTexture(ref _WebcamTexture); @@ -258,54 +258,54 @@ namespace Vocaluxe.Screens { if (CProfiles.Avatars[j].FileName == (filename + i + ".png")) { - CProfiles.SetAvatar(SelectSlides[SelectSlideProfiles].Selection, j); + CProfiles.SetAvatar(SelectSlides[_SelectSlideProfiles].Selection, j); break; } } - Buttons[ButtonSaveSnapshot].Visible = false; - Buttons[ButtonDiscardSnapshot].Visible = false; - Buttons[ButtonTakeSnapshot].Visible = false; - Buttons[ButtonWebcam].Visible = true; + Buttons[_ButtonSaveSnapshot].Visible = false; + Buttons[_ButtonDiscardSnapshot].Visible = false; + Buttons[_ButtonTakeSnapshot].Visible = false; + Buttons[_ButtonWebcam].Visible = true; } - private void OnWebcam() + private void _OnWebcam() { _Snapshot = null; CWebcam.Start(); CWebcam.GetFrame(ref _WebcamTexture); - Buttons[ButtonSaveSnapshot].Visible = false; - Buttons[ButtonDiscardSnapshot].Visible = false; - Buttons[ButtonTakeSnapshot].Visible = true; - Buttons[ButtonWebcam].Visible = false; + Buttons[_ButtonSaveSnapshot].Visible = false; + Buttons[_ButtonDiscardSnapshot].Visible = false; + Buttons[_ButtonTakeSnapshot].Visible = true; + Buttons[_ButtonWebcam].Visible = false; } public override bool UpdateGame() { - if (SelectSlides[SelectSlideProfiles].Selection > -1) + if (SelectSlides[_SelectSlideProfiles].Selection > -1) { - Buttons[ButtonPlayerName].Text.Text = CProfiles.GetPlayerName(SelectSlides[SelectSlideProfiles].Selection); + Buttons[_ButtonPlayerName].Text.Text = CProfiles.GetPlayerName(SelectSlides[_SelectSlideProfiles].Selection); if (_EditMode == EEditMode.PlayerName) - Buttons[ButtonPlayerName].Text.Text += "|"; + Buttons[_ButtonPlayerName].Text.Text += "|"; - SelectSlides[SelectSlideDifficulty].Selection = (int)CProfiles.GetDifficulty(SelectSlides[SelectSlideProfiles].Selection); - SelectSlides[SelectSlideGuestProfile].Selection = (int)CProfiles.GetGuestProfile(SelectSlides[SelectSlideProfiles].Selection); - SelectSlides[SelectSlideActive].Selection = (int)CProfiles.GetActive(SelectSlides[SelectSlideProfiles].Selection); + SelectSlides[_SelectSlideDifficulty].Selection = (int)CProfiles.GetDifficulty(SelectSlides[_SelectSlideProfiles].Selection); + SelectSlides[_SelectSlideGuestProfile].Selection = (int)CProfiles.GetGuestProfile(SelectSlides[_SelectSlideProfiles].Selection); + SelectSlides[_SelectSlideActive].Selection = (int)CProfiles.GetActive(SelectSlides[_SelectSlideProfiles].Selection); - int avatarNr = CProfiles.GetAvatarNr(SelectSlides[SelectSlideProfiles].Selection); - SelectSlides[SelectSlideAvatars].Selection = avatarNr; - if (CWebcam.GetDevices().Length > 0 && _WebcamTexture.index > 0) + int avatarNr = CProfiles.GetAvatarNr(SelectSlides[_SelectSlideProfiles].Selection); + SelectSlides[_SelectSlideAvatars].Selection = avatarNr; + if (CWebcam.GetDevices().Length > 0 && _WebcamTexture.Index > 0) { if (_Snapshot == null) CWebcam.GetFrame(ref _WebcamTexture); - Statics[StaticAvatar].Texture = _WebcamTexture; + Statics[_StaticAvatar].Texture = _WebcamTexture; - RectangleF bounds = new RectangleF(_WebcamTexture.rect.X, _WebcamTexture.rect.Y, _WebcamTexture.rect.W, _WebcamTexture.rect.H); - RectangleF rect = new RectangleF(0f, 0f, _WebcamTexture.rect.W, _WebcamTexture.rect.H); + RectangleF bounds = new RectangleF(_WebcamTexture.Rect.X, _WebcamTexture.Rect.Y, _WebcamTexture.Rect.W, _WebcamTexture.Rect.H); + RectangleF rect = new RectangleF(0f, 0f, _WebcamTexture.Rect.W, _WebcamTexture.Rect.H); CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, EAspect.Crop); } else - Statics[StaticAvatar].Texture = CProfiles.Avatars[avatarNr].Texture; + Statics[_StaticAvatar].Texture = CProfiles.Avatars[avatarNr].Texture; } return true; @@ -316,8 +316,8 @@ namespace Vocaluxe.Screens base.OnShow(); CProfiles.LoadProfiles(); - LoadAvatars(); - LoadProfiles(); + _LoadAvatars(); + _LoadProfiles(); UpdateGame(); } @@ -325,59 +325,59 @@ namespace Vocaluxe.Screens { base.OnClose(); - OnDiscardSnapshot(); + _OnDiscardSnapshot(); } - private void SaveProfiles() + private void _SaveProfiles() { _EditMode = EEditMode.None; CProfiles.SaveProfiles(); - LoadProfiles(); + _LoadProfiles(); UpdateGame(); } - private void DeleteProfile() + private void _DeleteProfile() { - CProfiles.DeleteProfile(SelectSlides[SelectSlideProfiles].Selection); - LoadProfiles(); + CProfiles.DeleteProfile(SelectSlides[_SelectSlideProfiles].Selection); + _LoadProfiles(); UpdateGame(); } - private void LoadProfiles() + private void _LoadProfiles() { _EditMode = EEditMode.None; - SelectSlides[SelectSlideProfiles].Clear(); + SelectSlides[_SelectSlideProfiles].Clear(); for (int i = 0; i < CProfiles.NumProfiles; i++) - SelectSlides[SelectSlideProfiles].AddValue(CProfiles.GetPlayerName(i)); + SelectSlides[_SelectSlideProfiles].AddValue(CProfiles.GetPlayerName(i)); if (CProfiles.NumProfiles > 0 && CProfiles.NumAvatars > 0) { - SelectSlides[SelectSlideDifficulty].Selection = (int)CProfiles.GetDifficulty(SelectSlides[SelectSlideProfiles].Selection); - SelectSlides[SelectSlideGuestProfile].Selection = (int)CProfiles.GetGuestProfile(SelectSlides[SelectSlideProfiles].Selection); - SelectSlides[SelectSlideActive].Selection = (int)CProfiles.GetActive(SelectSlides[SelectSlideProfiles].Selection); - SelectSlides[SelectSlideAvatars].Selection = CProfiles.GetAvatarNr(SelectSlides[SelectSlideProfiles].Selection); + SelectSlides[_SelectSlideDifficulty].Selection = (int)CProfiles.GetDifficulty(SelectSlides[_SelectSlideProfiles].Selection); + SelectSlides[_SelectSlideGuestProfile].Selection = (int)CProfiles.GetGuestProfile(SelectSlides[_SelectSlideProfiles].Selection); + SelectSlides[_SelectSlideActive].Selection = (int)CProfiles.GetActive(SelectSlides[_SelectSlideProfiles].Selection); + SelectSlides[_SelectSlideAvatars].Selection = CProfiles.GetAvatarNr(SelectSlides[_SelectSlideProfiles].Selection); } } - private void LoadAvatars() + private void _LoadAvatars() { - SelectSlides[SelectSlideAvatars].Clear(); + SelectSlides[_SelectSlideAvatars].Clear(); for (int i = 0; i < CProfiles.NumAvatars; i++) - SelectSlides[SelectSlideAvatars].AddValue(CProfiles.Avatars[i].FileName); + SelectSlides[_SelectSlideAvatars].AddValue(CProfiles.Avatars[i].FileName); } - private void NewProfile() + private void _NewProfile() { _EditMode = EEditMode.None; CProfiles.NewProfile(); - LoadProfiles(); - SelectSlides[SelectSlideProfiles].LastValue(); + _LoadProfiles(); + SelectSlides[_SelectSlideProfiles].LastValue(); - CProfiles.SetAvatar(SelectSlides[SelectSlideProfiles].Selection, - SelectSlides[SelectSlideAvatars].Selection); + CProfiles.SetAvatar(SelectSlides[_SelectSlideProfiles].Selection, + SelectSlides[_SelectSlideAvatars].Selection); - SetInteractionToButton(Buttons[ButtonPlayerName]); + SetInteractionToButton(Buttons[_ButtonPlayerName]); _EditMode = EEditMode.PlayerName; } } diff --git a/Vocaluxe/Screens/CScreenScore.cs b/Vocaluxe/Screens/CScreenScore.cs index f5a86341..9083e554 100644 --- a/Vocaluxe/Screens/CScreenScore.cs +++ b/Vocaluxe/Screens/CScreenScore.cs @@ -16,47 +16,47 @@ namespace Vocaluxe.Screens get { return 3; } } - private const string TextSong = "TextSong"; + private const string _TextSong = "TextSong"; - private const string ScreenSettingShortScore = "ScreenSettingShortScore"; - private const string ScreenSettingShortRating = "ScreenSettingShortRating"; - private const string ScreenSettingShortDifficulty = "ScreenSettingShortDifficulty"; - private const string ScreenSettingAnimationDirection = "ScreenSettingAnimationDirection"; + private const string _ScreenSettingShortScore = "ScreenSettingShortScore"; + private const string _ScreenSettingShortRating = "ScreenSettingShortRating"; + private const string _ScreenSettingShortDifficulty = "ScreenSettingShortDifficulty"; + private const string _ScreenSettingAnimationDirection = "ScreenSettingAnimationDirection"; - private string[,] TextNames; - private string[,] TextScores; - private string[,] TextRatings; - private string[,] TextDifficulty; - private string[,] StaticPointsBarBG; - private string[,] StaticPointsBar; - private string[,] StaticAvatar; - private double[] StaticPointsBarDrawnPoints; + private string[,] _TextNames; + private string[,] _TextScores; + private string[,] _TextRatings; + private string[,] _TextDifficulty; + private string[,] _StaticPointsBarBG; + private string[,] _StaticPointsBar; + private string[,] _StaticAvatar; + private double[] _StaticPointsBarDrawnPoints; private int _Round; private CPoints _Points; - private Stopwatch timer; + private Stopwatch _Timer; public override void Init() { base.Init(); List texts = new List(); - texts.Add(TextSong); + texts.Add(_TextSong); - BuildTextStrings(ref texts); + _BuildTextStrings(ref texts); _ThemeTexts = texts.ToArray(); List statics = new List(); - BuildStaticStrings(ref statics); + _BuildStaticStrings(ref statics); _ThemeStatics = statics.ToArray(); - _ThemeScreenSettings = new string[] {ScreenSettingShortScore, ScreenSettingShortRating, ScreenSettingShortDifficulty, ScreenSettingAnimationDirection}; + _ThemeScreenSettings = new string[] {_ScreenSettingShortScore, _ScreenSettingShortRating, _ScreenSettingShortDifficulty, _ScreenSettingAnimationDirection}; - StaticPointsBarDrawnPoints = new double[CSettings.MaxNumPlayer]; + _StaticPointsBarDrawnPoints = new double[CSettings.MaxNumPlayer]; } - public override bool HandleInput(KeyEvent keyEvent) + public override bool HandleInput(SKeyEvent keyEvent) { if (keyEvent.KeyPressed) {} else @@ -66,33 +66,33 @@ namespace Vocaluxe.Screens case Keys.Escape: case Keys.Back: case Keys.Enter: - LeaveScreen(); + _LeaveScreen(); break; case Keys.Left: - ChangeRound(-1); + _ChangeRound(-1); break; case Keys.Right: - ChangeRound(1); + _ChangeRound(1); break; } } return true; } - public override bool HandleMouse(MouseEvent mouseEvent) + public override bool HandleMouse(SMouseEvent mouseEvent) { base.HandleMouse(mouseEvent); if (mouseEvent.Wheel != 0) - ChangeRound(mouseEvent.Wheel); + _ChangeRound(mouseEvent.Wheel); if (mouseEvent.LB) - LeaveScreen(); + _LeaveScreen(); if (mouseEvent.RB) - LeaveScreen(); + _LeaveScreen(); return true; } @@ -106,8 +106,8 @@ namespace Vocaluxe.Screens _Round = 1; _Points = CGame.GetPoints(); - SetVisibility(); - UpdateRatings(); + _SetVisibility(); + _UpdateRatings(); } public override bool UpdateGame() @@ -128,28 +128,28 @@ namespace Vocaluxe.Screens } for (int p = 0; p < player.Length; p++) { - if (StaticPointsBarDrawnPoints[p] < player[p].Points) + if (_StaticPointsBarDrawnPoints[p] < player[p].Points) { if (CConfig.ScoreAnimationTime >= 1) { - StaticPointsBarDrawnPoints[p] = (timer.ElapsedMilliseconds / 1000f) / CConfig.ScoreAnimationTime * 10000; + _StaticPointsBarDrawnPoints[p] = (_Timer.ElapsedMilliseconds / 1000f) / CConfig.ScoreAnimationTime * 10000; - if (StaticPointsBarDrawnPoints[p] > player[p].Points) - StaticPointsBarDrawnPoints[p] = player[p].Points; - string direction = (string)ScreenSettings[ScreenSettingAnimationDirection].GetValue(); + if (_StaticPointsBarDrawnPoints[p] > player[p].Points) + _StaticPointsBarDrawnPoints[p] = player[p].Points; + string direction = (string)ScreenSettings[_ScreenSettingAnimationDirection].GetValue(); if (direction.ToLower() == "vertical") { - Statics[StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.W = ((float)StaticPointsBarDrawnPoints[p]) * - (Statics[StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.W / 10000); + Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.W = ((float)_StaticPointsBarDrawnPoints[p]) * + (Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.W / 10000); } else { - Statics[StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H = ((float)StaticPointsBarDrawnPoints[p]) * - (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; + Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H = ((float)_StaticPointsBarDrawnPoints[p]) * + (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; } } } @@ -190,12 +190,12 @@ namespace Vocaluxe.Screens return rating; } - private void BuildTextStrings(ref List texts) + private void _BuildTextStrings(ref List texts) { - TextNames = new string[CSettings.MaxNumPlayer,CSettings.MaxNumPlayer]; - TextScores = new string[CSettings.MaxNumPlayer,CSettings.MaxNumPlayer]; - TextRatings = new string[CSettings.MaxNumPlayer,CSettings.MaxNumPlayer]; - TextDifficulty = new string[CSettings.MaxNumPlayer,CSettings.MaxNumPlayer]; + _TextNames = new string[CSettings.MaxNumPlayer,CSettings.MaxNumPlayer]; + _TextScores = new string[CSettings.MaxNumPlayer,CSettings.MaxNumPlayer]; + _TextRatings = new string[CSettings.MaxNumPlayer,CSettings.MaxNumPlayer]; + _TextDifficulty = new string[CSettings.MaxNumPlayer,CSettings.MaxNumPlayer]; for (int numplayer = 0; numplayer < CSettings.MaxNumPlayer; numplayer++) { @@ -204,25 +204,25 @@ namespace Vocaluxe.Screens if (player <= numplayer) { string target = "P" + (player + 1).ToString() + "N" + (numplayer + 1).ToString(); - TextNames[player, numplayer] = "TextName" + target; - TextScores[player, numplayer] = "TextScore" + target; - TextRatings[player, numplayer] = "TextRating" + target; - TextDifficulty[player, numplayer] = "TextDifficulty" + target; + _TextNames[player, numplayer] = "TextName" + target; + _TextScores[player, numplayer] = "TextScore" + target; + _TextRatings[player, numplayer] = "TextRating" + target; + _TextDifficulty[player, numplayer] = "TextDifficulty" + target; - texts.Add(TextNames[player, numplayer]); - texts.Add(TextScores[player, numplayer]); - texts.Add(TextRatings[player, numplayer]); - texts.Add(TextDifficulty[player, numplayer]); + texts.Add(_TextNames[player, numplayer]); + texts.Add(_TextScores[player, numplayer]); + texts.Add(_TextRatings[player, numplayer]); + texts.Add(_TextDifficulty[player, numplayer]); } } } } - private void BuildStaticStrings(ref List statics) + private void _BuildStaticStrings(ref List statics) { - StaticPointsBar = new string[CSettings.MaxNumPlayer,CSettings.MaxNumPlayer]; - StaticPointsBarBG = new string[CSettings.MaxNumPlayer,CSettings.MaxNumPlayer]; - StaticAvatar = new string[CSettings.MaxNumPlayer,CSettings.MaxNumPlayer]; + _StaticPointsBar = new string[CSettings.MaxNumPlayer,CSettings.MaxNumPlayer]; + _StaticPointsBarBG = new string[CSettings.MaxNumPlayer,CSettings.MaxNumPlayer]; + _StaticAvatar = new string[CSettings.MaxNumPlayer,CSettings.MaxNumPlayer]; for (int numplayer = 0; numplayer < CSettings.MaxNumPlayer; numplayer++) { @@ -231,19 +231,19 @@ namespace Vocaluxe.Screens if (player <= numplayer) { string target = "P" + (player + 1).ToString() + "N" + (numplayer + 1).ToString(); - StaticPointsBarBG[player, numplayer] = "StaticPointsBarBG" + target; - StaticPointsBar[player, numplayer] = "StaticPointsBar" + target; - StaticAvatar[player, numplayer] = "StaticAvatar" + target; + _StaticPointsBarBG[player, numplayer] = "StaticPointsBarBG" + target; + _StaticPointsBar[player, numplayer] = "StaticPointsBar" + target; + _StaticAvatar[player, numplayer] = "StaticAvatar" + target; - statics.Add(StaticPointsBarBG[player, numplayer]); - statics.Add(StaticPointsBar[player, numplayer]); - statics.Add(StaticAvatar[player, numplayer]); + statics.Add(_StaticPointsBarBG[player, numplayer]); + statics.Add(_StaticPointsBar[player, numplayer]); + statics.Add(_StaticAvatar[player, numplayer]); } } } } - private void UpdateRatings() + private void _UpdateRatings() { CSong song = null; SPlayer[] player = new SPlayer[CGame.NumPlayer]; @@ -253,14 +253,14 @@ namespace Vocaluxe.Screens if (song == null) return; - Texts[TextSong].Text = song.Artist + " - " + song.Title; + Texts[_TextSong].Text = song.Artist + " - " + song.Title; if (_Points.NumRounds > 1) - Texts[TextSong].Text += " (" + _Round + "/" + _Points.NumRounds + ")"; + Texts[_TextSong].Text += " (" + _Round + "/" + _Points.NumRounds + ")"; player = _Points.GetPlayer(_Round - 1, CGame.NumPlayer); } else { - Texts[TextSong].Text = "TR_SCREENSCORE_OVERALLSCORE"; + Texts[_TextSong].Text = "TR_SCREENSCORE_OVERALLSCORE"; for (int i = 0; i < CGame.NumRounds; i++) { SPlayer[] points = _Points.GetPlayer(i, CGame.NumPlayer); @@ -284,68 +284,68 @@ namespace Vocaluxe.Screens if (song != null) { if (!song.IsDuet) - Texts[TextNames[p, CGame.NumPlayer - 1]].Text = player[p].Name; + Texts[_TextNames[p, CGame.NumPlayer - 1]].Text = player[p].Name; else if (player[p].LineNr == 0 && song.DuetPart1 != "Part 1") - Texts[TextNames[p, CGame.NumPlayer - 1]].Text = player[p].Name + " (" + song.DuetPart1 + ")"; + Texts[_TextNames[p, CGame.NumPlayer - 1]].Text = player[p].Name + " (" + song.DuetPart1 + ")"; else if (player[p].LineNr == 1 && song.DuetPart2 != "Part 2") - Texts[TextNames[p, CGame.NumPlayer - 1]].Text = player[p].Name + " (" + song.DuetPart2 + ")"; + Texts[_TextNames[p, CGame.NumPlayer - 1]].Text = player[p].Name + " (" + song.DuetPart2 + ")"; else - Texts[TextNames[p, CGame.NumPlayer - 1]].Text = player[p].Name; + Texts[_TextNames[p, CGame.NumPlayer - 1]].Text = player[p].Name; } else - Texts[TextNames[p, CGame.NumPlayer - 1]].Text = player[p].Name; + Texts[_TextNames[p, CGame.NumPlayer - 1]].Text = player[p].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"); + 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"); else - Texts[TextScores[p, CGame.NumPlayer - 1]].Text = ((int)Math.Round(player[p].Points)).ToString("0000"); - if (CGame.NumPlayer < (int)ScreenSettings[ScreenSettingShortDifficulty].GetValue()) + Texts[_TextScores[p, CGame.NumPlayer - 1]].Text = ((int)Math.Round(player[p].Points)).ToString("0000"); + if (CGame.NumPlayer < (int)ScreenSettings[_ScreenSettingShortDifficulty].GetValue()) { - Texts[TextDifficulty[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate("TR_SCREENSCORE_GAMEDIFFICULTY") + ": " + + Texts[_TextDifficulty[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate("TR_SCREENSCORE_GAMEDIFFICULTY") + ": " + CLanguage.Translate(player[p].Difficulty.ToString()); } else - Texts[TextDifficulty[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate(player[p].Difficulty.ToString()); - if (CGame.NumPlayer < (int)ScreenSettings[ScreenSettingShortRating].GetValue()) + Texts[_TextDifficulty[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate(player[p].Difficulty.ToString()); + if (CGame.NumPlayer < (int)ScreenSettings[_ScreenSettingShortRating].GetValue()) { - Texts[TextRatings[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate("TR_SCREENSCORE_RATING") + ": " + + Texts[_TextRatings[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate("TR_SCREENSCORE_RATING") + ": " + CLanguage.Translate(GetRating((int)Math.Round(player[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(player[p].Points))); - StaticPointsBarDrawnPoints[p] = 0.0; - string direction = (string)ScreenSettings[ScreenSettingAnimationDirection].GetValue(); + _StaticPointsBarDrawnPoints[p] = 0.0; + string direction = (string)ScreenSettings[_ScreenSettingAnimationDirection].GetValue(); if (direction.ToLower() == "vertical") - Statics[StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.W = 0; + Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.W = 0; else { - Statics[StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H = 0; - 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; + Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H = 0; + 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; } if (player[p].ProfileID >= 0 && player[p].ProfileID < CProfiles.NumProfiles) - Statics[StaticAvatar[p, CGame.NumPlayer - 1]].Texture = CProfiles.Profiles[player[p].ProfileID].Avatar.Texture; + Statics[_StaticAvatar[p, CGame.NumPlayer - 1]].Texture = CProfiles.Profiles[player[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.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; + 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.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; } } - timer = new Stopwatch(); - timer.Start(); + _Timer = new Stopwatch(); + _Timer.Start(); } - private void SetVisibility() + private void _SetVisibility() { for (int numplayer = 0; numplayer < CSettings.MaxNumPlayer; numplayer++) { @@ -353,35 +353,35 @@ 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.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; - Statics[StaticAvatar[player, numplayer]].Texture = new STexture(-1); + Statics[_StaticAvatar[player, numplayer]].Texture = new STexture(-1); } } } } - private void ChangeRound(int Num) + private void _ChangeRound(int num) { - if ((_Round + Num) <= _Points.NumRounds && (_Round + Num > 0)) + if ((_Round + num) <= _Points.NumRounds && (_Round + num > 0)) { - _Round += Num; - UpdateRatings(); + _Round += num; + _UpdateRatings(); } - else if (Num < 0 && _Round == 1 && CGame.NumRounds > 1) + else if (num < 0 && _Round == 1 && CGame.NumRounds > 1) { _Round = 0; - UpdateRatings(); + _UpdateRatings(); } } - private void LeaveScreen() + private void _LeaveScreen() { CParty.LeavingScore(); } diff --git a/Vocaluxe/Screens/CScreenSing.cs b/Vocaluxe/Screens/CScreenSing.cs index da563a10..115d70fe 100644 --- a/Vocaluxe/Screens/CScreenSing.cs +++ b/Vocaluxe/Screens/CScreenSing.cs @@ -19,53 +19,53 @@ namespace Vocaluxe.Screens get { return 6; } } - private struct TimeRect + private struct STimeRect { - public CStatic rect; - public float startBeat; - public float endBeat; + public CStatic Rect; + public float StartBeat; + public float EndBeat; } - private const string TextSongName = "TextSongName"; - private const string TextTime = "TextTime"; - private const string TextPause = "TextPause"; - private const string TextDuetName1 = "TextDuetName1"; - private const string TextDuetName2 = "TextDuetName2"; - private string[,] TextScores; - private string[,] TextNames; + private const string _TextSongName = "TextSongName"; + private const string _TextTime = "TextTime"; + private const string _TextPause = "TextPause"; + private const string _TextDuetName1 = "TextDuetName1"; + private const string _TextDuetName2 = "TextDuetName2"; + private string[,] _TextScores; + private string[,] _TextNames; - private const string StaticSongText = "StaticSongText"; - private const string StaticLyrics = "StaticLyrics"; - private const string StaticLyricsDuet = "StaticLyricsDuet"; - private const string StaticLyricsTop = "StaticLyricsTop"; - private const string StaticTimeBar = "StaticTimeBar"; - private const string StaticTimeLine = "StaticTimeLine"; - private const string StaticTimeLineExpandedNormal = "StaticTimeLineExpandedNormal"; - private const string StaticTimeLineExpandedHighlighted = "StaticTimeLineExpandedHighlighted"; - private const string StaticTimePointer = "StaticTimePointer"; - private const string StaticLyricHelper = "StaticLyricHelper"; - private const string StaticLyricHelperDuet = "StaticLyricHelperDuet"; - private const string StaticLyricHelperTop = "StaticLyricHelperTop"; - private const string StaticPauseBG = "StaticPauseBG"; + private const string _StaticSongText = "StaticSongText"; + private const string _StaticLyrics = "StaticLyrics"; + private const string _StaticLyricsDuet = "StaticLyricsDuet"; + private const string _StaticLyricsTop = "StaticLyricsTop"; + private const string _StaticTimeBar = "StaticTimeBar"; + private const string _StaticTimeLine = "StaticTimeLine"; + private const string _StaticTimeLineExpandedNormal = "StaticTimeLineExpandedNormal"; + private const string _StaticTimeLineExpandedHighlighted = "StaticTimeLineExpandedHighlighted"; + private const string _StaticTimePointer = "StaticTimePointer"; + private const string _StaticLyricHelper = "StaticLyricHelper"; + private const string _StaticLyricHelperDuet = "StaticLyricHelperDuet"; + private const string _StaticLyricHelperTop = "StaticLyricHelperTop"; + private const string _StaticPauseBG = "StaticPauseBG"; - private string[,] StaticScores; - private string[,] StaticAvatars; + private string[,] _StaticScores; + private string[,] _StaticAvatars; - private const string ButtonCancel = "ButtonCancel"; - private const string ButtonContinue = "ButtonContinue"; - private const string ButtonSkip = "ButtonSkip"; + private const string _ButtonCancel = "ButtonCancel"; + private const string _ButtonContinue = "ButtonContinue"; + private const string _ButtonSkip = "ButtonSkip"; - private const string LyricMain = "LyricMain"; - private const string LyricSub = "LyricSub"; - private const string LyricMainDuet = "LyricMainDuet"; - private const string LyricSubDuet = "LyricSubDuet"; - private const string LyricMainTop = "LyricMainTop"; - private const string LyricSubTop = "LyricSubTop"; + private const string _LyricMain = "LyricMain"; + private const string _LyricSub = "LyricSub"; + private const string _LyricMainDuet = "LyricMainDuet"; + private const string _LyricSubDuet = "LyricSubDuet"; + private const string _LyricMainTop = "LyricMainTop"; + private const string _LyricSubTop = "LyricSubTop"; - private const string SingBars = "SingBars"; + private const string _SingBars = "SingBars"; private SRectF _TimeLineRect; - private List _TimeRects; + private List _TimeRects; private bool _FadeOut; private int _CurrentBeat; @@ -86,7 +86,7 @@ namespace Vocaluxe.Screens private float _TimeToFirstNoteDuet; private float _RemainingTimeToFirstNoteDuet; - private readonly int[] NoteLines = new int[CSettings.MaxNumPlayer]; + private readonly int[] _NoteLines = new int[CSettings.MaxNumPlayer]; private Stopwatch _TimerSongText; private Stopwatch _TimerDuetText1; @@ -100,64 +100,64 @@ namespace Vocaluxe.Screens base.Init(); List texts = new List(); - texts.Add(TextSongName); - texts.Add(TextTime); - texts.Add(TextPause); - texts.Add(TextDuetName1); - texts.Add(TextDuetName2); - BuildTextStrings(ref texts); + texts.Add(_TextSongName); + texts.Add(_TextTime); + texts.Add(_TextPause); + texts.Add(_TextDuetName1); + texts.Add(_TextDuetName2); + _BuildTextStrings(ref texts); _ThemeTexts = texts.ToArray(); List statics = new List(); - statics.Add(StaticSongText); - statics.Add(StaticLyrics); - statics.Add(StaticLyricsDuet); - statics.Add(StaticLyricsTop); - statics.Add(StaticTimeBar); - statics.Add(StaticTimeLine); - statics.Add(StaticTimeLineExpandedNormal); - statics.Add(StaticTimeLineExpandedHighlighted); - statics.Add(StaticTimePointer); - statics.Add(StaticLyricHelper); - statics.Add(StaticLyricHelperDuet); - statics.Add(StaticLyricHelperTop); - statics.Add(StaticPauseBG); - BuildStaticStrings(ref statics); + statics.Add(_StaticSongText); + statics.Add(_StaticLyrics); + statics.Add(_StaticLyricsDuet); + statics.Add(_StaticLyricsTop); + statics.Add(_StaticTimeBar); + statics.Add(_StaticTimeLine); + statics.Add(_StaticTimeLineExpandedNormal); + statics.Add(_StaticTimeLineExpandedHighlighted); + statics.Add(_StaticTimePointer); + statics.Add(_StaticLyricHelper); + statics.Add(_StaticLyricHelperDuet); + statics.Add(_StaticLyricHelperTop); + statics.Add(_StaticPauseBG); + _BuildStaticStrings(ref statics); _ThemeStatics = statics.ToArray(); List buttons = new List(); - buttons.Add(ButtonCancel); - buttons.Add(ButtonContinue); - buttons.Add(ButtonSkip); + buttons.Add(_ButtonCancel); + buttons.Add(_ButtonContinue); + buttons.Add(_ButtonSkip); _ThemeButtons = buttons.ToArray(); - _ThemeLyrics = new string[] {LyricMain, LyricSub, LyricMainDuet, LyricSubDuet, LyricMainTop, LyricSubTop}; - _ThemeSingNotes = new string[] {SingBars}; + _ThemeLyrics = new string[] {_LyricMain, _LyricSub, _LyricMainDuet, _LyricSubDuet, _LyricMainTop, _LyricSubTop}; + _ThemeSingNotes = new string[] {_SingBars}; - _TimeRects = new List(); + _TimeRects = new List(); _TimerSongText = new Stopwatch(); _TimerDuetText1 = new Stopwatch(); _TimerDuetText2 = new Stopwatch(); } - public override void LoadTheme(string XmlPath) + public override void LoadTheme(string xmlPath) { - base.LoadTheme(XmlPath); + base.LoadTheme(xmlPath); - Statics[StaticTimeLine].Visible = false; - Statics[StaticTimeLineExpandedNormal].Visible = false; - Statics[StaticTimeLineExpandedHighlighted].Visible = false; - Statics[StaticPauseBG].Visible = false; - Texts[TextPause].Visible = false; + Statics[_StaticTimeLine].Visible = false; + Statics[_StaticTimeLineExpandedNormal].Visible = false; + Statics[_StaticTimeLineExpandedHighlighted].Visible = false; + Statics[_StaticPauseBG].Visible = false; + Texts[_TextPause].Visible = false; - Statics[StaticPauseBG].Visible = false; - Texts[TextPause].Visible = false; + Statics[_StaticPauseBG].Visible = false; + Texts[_TextPause].Visible = false; - Buttons[ButtonCancel].Visible = false; - Buttons[ButtonContinue].Visible = false; + Buttons[_ButtonCancel].Visible = false; + Buttons[_ButtonContinue].Visible = false; } - public override bool HandleInput(KeyEvent keyEvent) + public override bool HandleInput(SKeyEvent keyEvent) { base.HandleInput(keyEvent); @@ -170,15 +170,15 @@ namespace Vocaluxe.Screens switch (keyEvent.Key) { case Keys.Escape: - TogglePause(); + _TogglePause(); if (_Pause) - SetInteractionToButton(Buttons[ButtonCancel]); + SetInteractionToButton(Buttons[_ButtonCancel]); break; case Keys.P: - TogglePause(); + _TogglePause(); if (_Pause) - SetInteractionToButton(Buttons[ButtonContinue]); + SetInteractionToButton(Buttons[_ButtonContinue]); break; case Keys.T: @@ -198,16 +198,16 @@ namespace Vocaluxe.Screens mode = 0; CConfig.PlayerInfo = (EPlayerInfo)mode; CConfig.SaveConfig(); - SetVisibility(); + _SetVisibility(); if (CGame.GetSong() != null) - SetDuetLyricsVisibility(CGame.GetSong().IsDuet); //make sure duet lyrics remain visible + _SetDuetLyricsVisibility(CGame.GetSong().IsDuet); //make sure duet lyrics remain visible break; case Keys.S: if (CGame.NumRounds > CGame.RoundNr) { - if (keyEvent.ModCTRL) - LoadNextSong(); + if (keyEvent.ModCtrl) + _LoadNextSong(); } break; case Keys.W: @@ -221,20 +221,20 @@ namespace Vocaluxe.Screens } break; case Keys.Enter: - if (Buttons[ButtonContinue].Selected && _Pause) - TogglePause(); - if (Buttons[ButtonCancel].Selected && _Pause) - Stop(); - if (Buttons[ButtonSkip].Selected && _Pause) + if (Buttons[_ButtonContinue].Selected && _Pause) + _TogglePause(); + if (Buttons[_ButtonCancel].Selected && _Pause) + _Stop(); + if (Buttons[_ButtonSkip].Selected && _Pause) { - LoadNextSong(); - TogglePause(); + _LoadNextSong(); + _TogglePause(); } break; case Keys.Add: case Keys.PageUp: - if (keyEvent.ModSHIFT) + if (keyEvent.ModShift) { CConfig.GameMusicVolume = CConfig.GameMusicVolume + 5; if (CConfig.GameMusicVolume > 100) @@ -246,7 +246,7 @@ namespace Vocaluxe.Screens case Keys.Subtract: case Keys.PageDown: - if (keyEvent.ModSHIFT) + if (keyEvent.ModShift) { CConfig.GameMusicVolume = CConfig.GameMusicVolume - 5; if (CConfig.GameMusicVolume < 0) @@ -261,29 +261,29 @@ namespace Vocaluxe.Screens return true; } - public override bool HandleMouse(MouseEvent mouseEvent) + public override bool HandleMouse(SMouseEvent mouseEvent) { base.HandleMouse(mouseEvent); if (mouseEvent.RB) { - TogglePause(); + _TogglePause(); if (_Pause) - SetInteractionToButton(Buttons[ButtonContinue]); + SetInteractionToButton(Buttons[_ButtonContinue]); } if (mouseEvent.LB && IsMouseOver(mouseEvent) && _Pause) { - if (Buttons[ButtonContinue].Selected && _Pause) - TogglePause(); + if (Buttons[_ButtonContinue].Selected && _Pause) + _TogglePause(); - if (Buttons[ButtonCancel].Selected && _Pause) - Stop(); + if (Buttons[_ButtonCancel].Selected && _Pause) + _Stop(); - if (Buttons[ButtonSkip].Selected && _Pause) + if (Buttons[_ButtonSkip].Selected && _Pause) { - LoadNextSong(); - TogglePause(); + _LoadNextSong(); + _TogglePause(); } } @@ -293,75 +293,75 @@ namespace Vocaluxe.Screens public override bool UpdateGame() { - bool Finish = false; + bool finish = false; if (CSound.IsPlaying(_CurrentStream) || CSound.IsPaused(_CurrentStream)) { _CurrentTime = CSound.GetPosition(_CurrentStream); if (_FinishTime != 0 && _CurrentTime >= _FinishTime) - Finish = true; + finish = true; } else - Finish = true; + finish = true; - if (Finish) - LoadNextSong(); + if (finish) + _LoadNextSong(); - UpdateSongText(); - UpdateDuetText(); + _UpdateSongText(); + _UpdateDuetText(); if (_FadeOut) return true; - UpdateTimeLine(); + _UpdateTimeLine(); CGame.UpdatePoints(_CurrentTime); - UpdateLyrics(); + _UpdateLyrics(); - float[] Alpha = CalcFadingAlpha(); - if (Alpha != null) + float[] alpha = _CalcFadingAlpha(); + if (alpha != null) { - Lyrics[LyricMain].Alpha = Alpha[0]; - Lyrics[LyricSub].Alpha = Alpha[1]; + Lyrics[_LyricMain].Alpha = alpha[0]; + Lyrics[_LyricSub].Alpha = alpha[1]; - Lyrics[LyricMainTop].Alpha = Alpha[0]; - Lyrics[LyricSubTop].Alpha = Alpha[1]; + Lyrics[_LyricMainTop].Alpha = alpha[0]; + Lyrics[_LyricSubTop].Alpha = alpha[1]; - Statics[StaticLyrics].Alpha = Alpha[0]; - Statics[StaticLyricsTop].Alpha = Alpha[0]; + Statics[_StaticLyrics].Alpha = alpha[0]; + Statics[_StaticLyricsTop].Alpha = alpha[0]; - Statics[StaticLyricHelper].Alpha = Alpha[0]; - Statics[StaticLyricHelperTop].Alpha = Alpha[0]; + Statics[_StaticLyricHelper].Alpha = alpha[0]; + Statics[_StaticLyricHelperTop].Alpha = alpha[0]; for (int p = 0; p < CGame.NumPlayer; p++) { - SingNotes[SingBars].SetAlpha(NoteLines[p], Alpha[CGame.Player[p].LineNr * 2]); + SingNotes[_SingBars].SetAlpha(_NoteLines[p], alpha[CGame.Player[p].LineNr * 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.Player[p].LineNr * 2]; - Texts[TextNames[p, CGame.NumPlayer - 1]].Alpha = Alpha[CGame.Player[p].LineNr * 2]; + Statics[_StaticAvatars[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Player[p].LineNr * 2]; + Texts[_TextNames[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Player[p].LineNr * 2]; } if (CConfig.FadePlayerInfo == EFadePlayerInfo.TR_CONFIG_FADEPLAYERINFO_ALL) { - Statics[StaticScores[p, CGame.NumPlayer - 1]].Alpha = Alpha[CGame.Player[p].LineNr * 2]; - Statics[StaticAvatars[p, CGame.NumPlayer - 1]].Alpha = Alpha[CGame.Player[p].LineNr * 2]; - Texts[TextNames[p, CGame.NumPlayer - 1]].Alpha = Alpha[CGame.Player[p].LineNr * 2]; - Texts[TextScores[p, CGame.NumPlayer - 1]].Alpha = Alpha[CGame.Player[p].LineNr * 2]; + Statics[_StaticScores[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Player[p].LineNr * 2]; + Statics[_StaticAvatars[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Player[p].LineNr * 2]; + Texts[_TextNames[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Player[p].LineNr * 2]; + Texts[_TextScores[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Player[p].LineNr * 2]; } } - if (Alpha.Length > 2) + if (alpha.Length > 2) { - Lyrics[LyricMainDuet].Alpha = Alpha[0]; - Lyrics[LyricSubDuet].Alpha = Alpha[1]; + Lyrics[_LyricMainDuet].Alpha = alpha[0]; + Lyrics[_LyricSubDuet].Alpha = alpha[1]; - Statics[StaticLyricsDuet].Alpha = Alpha[0]; - Statics[StaticLyricHelperDuet].Alpha = Alpha[0]; + Statics[_StaticLyricsDuet].Alpha = alpha[0]; + Statics[_StaticLyricHelperDuet].Alpha = alpha[0]; - Lyrics[LyricMain].Alpha = Alpha[2]; - Lyrics[LyricSub].Alpha = Alpha[3]; + Lyrics[_LyricMain].Alpha = alpha[2]; + Lyrics[_LyricSub].Alpha = alpha[3]; - Statics[StaticLyrics].Alpha = Alpha[2]; - Statics[StaticLyricHelper].Alpha = Alpha[2]; + Statics[_StaticLyrics].Alpha = alpha[2]; + Statics[_StaticLyricHelper].Alpha = alpha[2]; } } @@ -369,9 +369,9 @@ namespace Vocaluxe.Screens for (int p = 0; p < CGame.NumPlayer; p++) { if (CGame.Player[p].Points < 10000) - Texts[TextScores[p, CGame.NumPlayer - 1]].Text = CGame.Player[p].Points.ToString("0000"); + Texts[_TextScores[p, CGame.NumPlayer - 1]].Text = CGame.Player[p].Points.ToString("0000"); else - Texts[TextScores[p, CGame.NumPlayer - 1]].Text = CGame.Player[p].Points.ToString("00000"); + Texts[_TextScores[p, CGame.NumPlayer - 1]].Text = CGame.Player[p].Points.ToString("00000"); } if (_CurrentVideo != -1 && !_FadeOut && CConfig.VideosInSongs == EOffOn.TR_CONFIG_ON) @@ -404,22 +404,22 @@ namespace Vocaluxe.Screens _TimeRects.Clear(); - SingNotes[SingBars].Reset(); + SingNotes[_SingBars].Reset(); for (int i = 0; i < CSettings.MaxNumPlayer; i++) - NoteLines[i] = -1; + _NoteLines[i] = -1; 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; - SetVisibility(); + Statics[_StaticAvatars[p, CGame.NumPlayer - 1]].Aspect = EAspect.Crop; + _SetVisibility(); - UpdateAvatars(); - UpdateNames(); + _UpdateAvatars(); + _UpdateNames(); CBackgroundMusic.Disabled = true; - CloseSong(); + _CloseSong(); } public override void OnShowFinish() @@ -427,7 +427,7 @@ namespace Vocaluxe.Screens base.OnShowFinish(); CGame.Start(); - LoadNextSong(); + _LoadNextSong(); CBackgroundMusic.Disabled = true; } @@ -437,31 +437,31 @@ namespace Vocaluxe.Screens { if (_CurrentVideo != -1 && CConfig.VideosInSongs == EOffOn.TR_CONFIG_ON && !_Webcam) { - RectangleF bounds = new RectangleF(0, 0, CSettings.iRenderW, CSettings.iRenderH); - RectangleF rect = new RectangleF(0f, 0f, _CurrentVideoTexture.width, _CurrentVideoTexture.height); + RectangleF bounds = new RectangleF(0, 0, CSettings.RenderW, CSettings.RenderH); + RectangleF rect = new RectangleF(0f, 0f, _CurrentVideoTexture.Width, _CurrentVideoTexture.Height); CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, _VideoAspect); CDraw.DrawTexture(_CurrentVideoTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, 0f), - _CurrentVideoTexture.color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f), false); + _CurrentVideoTexture.Color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f), false); } else if (_Webcam) { - RectangleF bounds = new RectangleF(0, 0, CSettings.iRenderW, CSettings.iRenderH); - RectangleF rect = new RectangleF(0f, 0f, _CurrentWebcamFrameTexture.width, _CurrentWebcamFrameTexture.height); + RectangleF bounds = new RectangleF(0, 0, CSettings.RenderW, CSettings.RenderH); + RectangleF rect = new RectangleF(0f, 0f, _CurrentWebcamFrameTexture.Width, _CurrentWebcamFrameTexture.Height); CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, _VideoAspect); CDraw.DrawTexture(_CurrentWebcamFrameTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, 0f), - _CurrentVideoTexture.color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f), false); + _CurrentVideoTexture.Color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f), false); } else { // Draw Background - RectangleF bounds = new RectangleF(0, 0, CSettings.iRenderW, CSettings.iRenderH); - RectangleF rect = new RectangleF(0f, 0f, _Background.width, _Background.height); + RectangleF bounds = new RectangleF(0, 0, CSettings.RenderW, CSettings.RenderH); + RectangleF rect = new RectangleF(0f, 0f, _Background.Width, _Background.Height); CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, EAspect.Crop); CDraw.DrawTexture(_Background, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, 0f), - _Background.color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f), false); + _Background.Color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f), false); } } @@ -476,33 +476,33 @@ namespace Vocaluxe.Screens switch (CConfig.TimerLook) { case ETimerLook.TR_CONFIG_TIMERLOOK_NORMAL: - CDraw.DrawTexture(Statics[StaticTimeLine].Texture, Statics[StaticTimeLine].Rect, new SColorF(1, 1, 1, 1), _TimeLineRect); + CDraw.DrawTexture(Statics[_StaticTimeLine].Texture, Statics[_StaticTimeLine].Rect, new SColorF(1, 1, 1, 1), _TimeLineRect); break; case ETimerLook.TR_CONFIG_TIMERLOOK_EXPANDED: for (int i = 0; i < _TimeRects.Count; i++) - CDraw.DrawTexture(_TimeRects[i].rect.Texture, Statics[StaticTimeLine].Rect, _TimeRects[i].rect.Color, _TimeRects[i].rect.Rect); + CDraw.DrawTexture(_TimeRects[i].Rect.Texture, Statics[_StaticTimeLine].Rect, _TimeRects[i].Rect.Color, _TimeRects[i].Rect.Rect); break; } - Lyrics[LyricSub].Draw(-100); - Lyrics[LyricMain].Draw(CGame.Beat); + Lyrics[_LyricSub].Draw(-100); + Lyrics[_LyricMain].Draw(CGame.Beat); - Lyrics[LyricSubDuet].Draw(-100); - Lyrics[LyricMainDuet].Draw(CGame.Beat); + Lyrics[_LyricSubDuet].Draw(-100); + Lyrics[_LyricMainDuet].Draw(CGame.Beat); - Lyrics[LyricSubTop].Draw(-100); - Lyrics[LyricMainTop].Draw(CGame.Beat); + Lyrics[_LyricSubTop].Draw(-100); + Lyrics[_LyricMainTop].Draw(CGame.Beat); for (int i = 0; i < CGame.NumPlayer; i++) - SingNotes[SingBars].Draw(NoteLines[i], CGame.Player[i].SingLine, i); + SingNotes[_SingBars].Draw(_NoteLines[i], CGame.Player[i].SingLine, i); - DrawLyricHelper(); + _DrawLyricHelper(); if (_Pause) { - Statics[StaticPauseBG].ForceDraw(); - Texts[TextPause].ForceDraw(); + Statics[_StaticPauseBG].ForceDraw(); + Texts[_TextPause].ForceDraw(); foreach (CButton button in Buttons) button.Draw(); @@ -518,7 +518,7 @@ namespace Vocaluxe.Screens { base.OnClose(); CBackgroundMusic.Disabled = false; - CloseSong(); + _CloseSong(); } public override void ApplyVolume() @@ -526,7 +526,7 @@ namespace Vocaluxe.Screens CSound.SetStreamVolumeMax(_CurrentStream, CConfig.GameMusicVolume); } - private void CloseSong() + private void _CloseSong() { CSound.FadeAndStop(_CurrentStream, 0f, 0.5f); CSound.RecordStop(); @@ -538,27 +538,27 @@ namespace Vocaluxe.Screens } CDraw.RemoveTexture(ref _Background); - Lyrics[LyricMain].Clear(); - Lyrics[LyricSub].Clear(); - Lyrics[LyricMainDuet].Clear(); - Lyrics[LyricSubDuet].Clear(); - Lyrics[LyricMainTop].Clear(); - Lyrics[LyricSubTop].Clear(); - Texts[TextSongName].Text = String.Empty; - Texts[TextDuetName1].Text = String.Empty; - Texts[TextDuetName2].Text = String.Empty; + Lyrics[_LyricMain].Clear(); + Lyrics[_LyricSub].Clear(); + Lyrics[_LyricMainDuet].Clear(); + Lyrics[_LyricSubDuet].Clear(); + Lyrics[_LyricMainTop].Clear(); + Lyrics[_LyricSubTop].Clear(); + Texts[_TextSongName].Text = String.Empty; + Texts[_TextDuetName1].Text = String.Empty; + Texts[_TextDuetName2].Text = String.Empty; GC.Collect(); } - private void LoadNextSong() + private void _LoadNextSong() { - CloseSong(); + _CloseSong(); CGame.NextRound(); if (CGame.IsFinished()) { - FinishedSinging(); + _FinishedSinging(); return; } @@ -577,7 +577,7 @@ namespace Vocaluxe.Screens int rounds = CGame.GetNumSongs(); if (rounds > 1) songname += " (" + CGame.RoundNr + "/" + rounds.ToString() + ")"; - Texts[TextSongName].Text = songname; + Texts[_TextSongName].Text = songname; _CurrentStream = CSound.Load(song.GetMP3(), true); CSound.SetStreamVolumeMax(_CurrentStream, CConfig.GameMusicVolume); @@ -587,12 +587,12 @@ namespace Vocaluxe.Screens _FinishTime = song.Finish; _TimeToFirstNote = 0f; _TimeToFirstNoteDuet = 0f; - int[] duet_player = new int[CGame.NumPlayer]; + int[] duetPlayer = new int[CGame.NumPlayer]; if (song.IsDuet) { //Save duet-assignment before resetting - for (int i = 0; i < duet_player.Length; i++) - duet_player[i] = CGame.Player[i].LineNr; + for (int i = 0; i < duetPlayer.Length; i++) + duetPlayer[i] = CGame.Player[i].LineNr; } CGame.ResetPlayer(); @@ -609,13 +609,13 @@ namespace Vocaluxe.Screens if (song.BackgroundFileName.Length > 0) _Background = CDraw.AddTexture(Path.Combine(song.Folder, song.BackgroundFileName)); - SingNotes[SingBars].Reset(); + SingNotes[_SingBars].Reset(); if (song.IsDuet) { - Texts[TextDuetName1].Text = song.DuetPart1; - Texts[TextDuetName2].Text = song.DuetPart2; + Texts[_TextDuetName1].Text = song.DuetPart1; + Texts[_TextDuetName2].Text = song.DuetPart2; //More than one song: Player is not assigned to line by user //Otherwise, this is done by CScreenNames if (CGame.GetNumSongs() > 1) @@ -631,15 +631,15 @@ namespace Vocaluxe.Screens else { for (int i = 0; i < CGame.NumPlayer; i++) - CGame.Player[i].LineNr = duet_player[i]; + CGame.Player[i].LineNr = duetPlayer[i]; } } - SetDuetLyricsVisibility(song.IsDuet); + _SetDuetLyricsVisibility(song.IsDuet); for (int p = 0; p < CGame.NumPlayer; p++) { - NoteLines[p] = SingNotes[SingBars].AddPlayer( - SingNotes[SingBars].BarPos[p, CGame.NumPlayer - 1], + _NoteLines[p] = SingNotes[_SingBars].AddPlayer( + SingNotes[_SingBars].BarPos[p, CGame.NumPlayer - 1], CTheme.GetPlayerColor(p + 1), p); } @@ -662,49 +662,49 @@ namespace Vocaluxe.Screens if (song.Notes.Lines.Length != 2) _TimerSongText.Start(); - StartSong(); + _StartSong(); } - private void SetDuetLyricsVisibility(bool isDuet) + private void _SetDuetLyricsVisibility(bool isDuet) { - Statics[StaticLyricsDuet].Visible = isDuet; - Lyrics[LyricMainDuet].Visible = isDuet; - Lyrics[LyricSubDuet].Visible = isDuet; + Statics[_StaticLyricsDuet].Visible = isDuet; + Lyrics[_LyricMainDuet].Visible = isDuet; + Lyrics[_LyricSubDuet].Visible = isDuet; if (isDuet) { - Lyrics[LyricMainTop].Visible = false; - Lyrics[LyricSubTop].Visible = false; - Statics[StaticLyricsTop].Visible = false; + Lyrics[_LyricMainTop].Visible = false; + Lyrics[_LyricSubTop].Visible = false; + Statics[_StaticLyricsTop].Visible = false; } else { - bool LyricsOnTop = (CGame.NumPlayer != 1) && CConfig.LyricsOnTop == EOffOn.TR_CONFIG_ON; - Lyrics[LyricMainTop].Visible = LyricsOnTop; - Lyrics[LyricSubTop].Visible = LyricsOnTop; - Statics[StaticLyricsTop].Visible = LyricsOnTop; + bool lyricsOnTop = (CGame.NumPlayer != 1) && CConfig.LyricsOnTop == EOffOn.TR_CONFIG_ON; + Lyrics[_LyricMainTop].Visible = lyricsOnTop; + Lyrics[_LyricSubTop].Visible = lyricsOnTop; + Statics[_StaticLyricsTop].Visible = lyricsOnTop; } } - private void StartSong() + private void _StartSong() { - PrepareTimeLine(); + _PrepareTimeLine(); CSound.Play(_CurrentStream); CSound.RecordStart(); if (_Webcam) CWebcam.Start(); } - private void Stop() + private void _Stop() { //Need this to set other songs to points-var while (!CGame.IsFinished()) CGame.NextRound(); - FinishedSinging(); + _FinishedSinging(); } - private void FinishedSinging() + private void _FinishedSinging() { _FadeOut = true; CParty.FinishedSinging(); @@ -713,23 +713,23 @@ namespace Vocaluxe.Screens CWebcam.Close(); } - private int FindCurrentLine(CLines lines, CLine[] line, CSong song) + private int _FindCurrentLine(CLines lines, CLine[] line, CSong song) { - float CurrentTime = _CurrentTime - song.Gap; + float currentTime = _CurrentTime - song.Gap; //We are only interested in the last matching line, so either do not check further after line[j].StartBeat > _CurrentBeat or go backwards! int j = lines.FindPreviousLine(_CurrentBeat); for (; j >= 0; j--) { - float FirstNoteTime = CGame.GetTimeFromBeats(line[j].FirstNoteBeat, song.BPM); + float firstNoteTime = CGame.GetTimeFromBeats(line[j].FirstNoteBeat, song.BPM); //Earlist possible line break is 10s before first note - if (FirstNoteTime <= CurrentTime + 10f) + if (firstNoteTime <= currentTime + 10f) { //First line has no predecessor or line has to be shown - if (j == 0 || FirstNoteTime - CConfig.MinLineBreakTime <= CurrentTime) + if (j == 0 || firstNoteTime - CConfig.MinLineBreakTime <= currentTime) return j; - float LastNoteTime = CGame.GetTimeFromBeats(line[j - 1].LastNoteBeat, song.BPM); + float lastNoteTime = CGame.GetTimeFromBeats(line[j - 1].LastNoteBeat, song.BPM); //No line break if last line is not fully evaluated (with 50% tolerance -> tested so notes are drawn) - if (LastNoteTime + CConfig.MicDelay / 1000f * 1.5f >= CurrentTime) + if (lastNoteTime + CConfig.MicDelay / 1000f * 1.5f >= currentTime) return j - 1; return j; } @@ -737,7 +737,7 @@ namespace Vocaluxe.Screens return -1; } - private void UpdateLyrics() + private void _UpdateLyrics() { if (_FadeOut) return; @@ -758,94 +758,94 @@ namespace Vocaluxe.Screens CLine[] line = lines.Line; // find current line - int nr = FindCurrentLine(lines, line, song); + int nr = _FindCurrentLine(lines, line, song); if (nr != -1) { for (int j = 0; j < CGame.NumPlayer; j++) { if (CGame.Player[j].LineNr == i) - SingNotes[SingBars].AddLine(NoteLines[j], line, nr, j); + SingNotes[_SingBars].AddLine(_NoteLines[j], line, nr, j); } if (i == 0 && !song.IsDuet || i == 1 && song.IsDuet) { - Lyrics[LyricMain].SetLine(line[nr]); - Lyrics[LyricMainTop].SetLine(line[nr]); + Lyrics[_LyricMain].SetLine(line[nr]); + Lyrics[_LyricMainTop].SetLine(line[nr]); _TimeToFirstNote = CGame.GetTimeFromBeats(line[nr].FirstNoteBeat - line[nr].StartBeat, song.BPM); _RemainingTimeToFirstNote = CGame.GetTimeFromBeats(line[nr].FirstNoteBeat - CGame.GetBeatFromTime(_CurrentTime, song.BPM, song.Gap), song.BPM); if (line.Length >= nr + 2) { - Lyrics[LyricSub].SetLine(line[nr + 1]); - Lyrics[LyricSubTop].SetLine(line[nr + 1]); + Lyrics[_LyricSub].SetLine(line[nr + 1]); + Lyrics[_LyricSubTop].SetLine(line[nr + 1]); } else { - Lyrics[LyricSub].Clear(); - Lyrics[LyricSubTop].Clear(); + Lyrics[_LyricSub].Clear(); + Lyrics[_LyricSubTop].Clear(); } } if (i == 0 && song.IsDuet) { - Lyrics[LyricMainDuet].SetLine(line[nr]); + Lyrics[_LyricMainDuet].SetLine(line[nr]); _TimeToFirstNoteDuet = CGame.GetTimeFromBeats(line[nr].FirstNoteBeat - line[nr].StartBeat, song.BPM); _RemainingTimeToFirstNoteDuet = CGame.GetTimeFromBeats(line[nr].FirstNoteBeat - CGame.GetBeatFromTime(_CurrentTime, song.BPM, song.Gap), song.BPM); if (line.Length >= nr + 2) - Lyrics[LyricSubDuet].SetLine(line[nr + 1]); + Lyrics[_LyricSubDuet].SetLine(line[nr + 1]); else - Lyrics[LyricSubDuet].Clear(); + Lyrics[_LyricSubDuet].Clear(); } } else { if (i == 0 && !song.IsDuet || i == 1 && song.IsDuet) { - Lyrics[LyricMain].Clear(); - Lyrics[LyricSub].Clear(); - Lyrics[LyricMainTop].Clear(); - Lyrics[LyricSubTop].Clear(); + Lyrics[_LyricMain].Clear(); + Lyrics[_LyricSub].Clear(); + Lyrics[_LyricMainTop].Clear(); + Lyrics[_LyricSubTop].Clear(); _TimeToFirstNote = 0f; } if (i == 0 && song.IsDuet) { - Lyrics[LyricMainDuet].Clear(); - Lyrics[LyricSubDuet].Clear(); + Lyrics[_LyricMainDuet].Clear(); + Lyrics[_LyricSubDuet].Clear(); _TimeToFirstNoteDuet = 0f; } } } } - private void TogglePause() + private void _TogglePause() { _Pause = !_Pause; if (_Pause) { - Buttons[ButtonCancel].Visible = true; - Buttons[ButtonContinue].Visible = true; + Buttons[_ButtonCancel].Visible = true; + Buttons[_ButtonContinue].Visible = true; if (CGame.NumRounds > CGame.RoundNr && CGame.NumRounds > 1) - Buttons[ButtonSkip].Visible = true; + Buttons[_ButtonSkip].Visible = true; else - Buttons[ButtonSkip].Visible = false; + Buttons[_ButtonSkip].Visible = false; CSound.Pause(_CurrentStream); } else { - Buttons[ButtonCancel].Visible = false; - Buttons[ButtonContinue].Visible = false; - Buttons[ButtonSkip].Visible = false; + Buttons[_ButtonCancel].Visible = false; + Buttons[_ButtonContinue].Visible = false; + Buttons[_ButtonSkip].Visible = false; CSound.Play(_CurrentStream); CWebcam.Start(); } } - private void BuildTextStrings(ref List texts) + private void _BuildTextStrings(ref List texts) { - TextScores = new string[CSettings.MaxNumPlayer,CSettings.MaxNumPlayer]; - TextNames = new string[CSettings.MaxNumPlayer,CSettings.MaxNumPlayer]; + _TextScores = new string[CSettings.MaxNumPlayer,CSettings.MaxNumPlayer]; + _TextNames = new string[CSettings.MaxNumPlayer,CSettings.MaxNumPlayer]; for (int numplayer = 0; numplayer < CSettings.MaxNumPlayer; numplayer++) { @@ -854,20 +854,20 @@ namespace Vocaluxe.Screens if (player <= numplayer) { string target = "P" + (player + 1).ToString() + "N" + (numplayer + 1).ToString(); - TextScores[player, numplayer] = "TextScore" + target; - TextNames[player, numplayer] = "TextName" + target; + _TextScores[player, numplayer] = "TextScore" + target; + _TextNames[player, numplayer] = "TextName" + target; - texts.Add(TextScores[player, numplayer]); - texts.Add(TextNames[player, numplayer]); + texts.Add(_TextScores[player, numplayer]); + texts.Add(_TextNames[player, numplayer]); } } } } - private void BuildStaticStrings(ref List statics) + private void _BuildStaticStrings(ref List statics) { - StaticScores = new string[CSettings.MaxNumPlayer,CSettings.MaxNumPlayer]; - StaticAvatars = new string[CSettings.MaxNumPlayer,CSettings.MaxNumPlayer]; + _StaticScores = new string[CSettings.MaxNumPlayer,CSettings.MaxNumPlayer]; + _StaticAvatars = new string[CSettings.MaxNumPlayer,CSettings.MaxNumPlayer]; for (int numplayer = 0; numplayer < CSettings.MaxNumPlayer; numplayer++) { @@ -876,29 +876,29 @@ namespace Vocaluxe.Screens if (player <= numplayer) { string target = "P" + (player + 1).ToString() + "N" + (numplayer + 1).ToString(); - StaticScores[player, numplayer] = "StaticScore" + target; - StaticAvatars[player, numplayer] = "StaticAvatar" + target; + _StaticScores[player, numplayer] = "StaticScore" + target; + _StaticAvatars[player, numplayer] = "StaticAvatar" + target; - statics.Add(StaticScores[player, numplayer]); - statics.Add(StaticAvatars[player, numplayer]); + statics.Add(_StaticScores[player, numplayer]); + statics.Add(_StaticAvatars[player, numplayer]); } } } } - private void SetVisibility() + private void _SetVisibility() { - Statics[StaticLyricsDuet].Visible = false; - Statics[StaticLyricHelper].Visible = false; - Statics[StaticLyricHelperDuet].Visible = false; - Statics[StaticLyricHelperTop].Visible = false; - Lyrics[LyricMainDuet].Visible = false; - Lyrics[LyricSubDuet].Visible = false; + Statics[_StaticLyricsDuet].Visible = false; + Statics[_StaticLyricHelper].Visible = false; + Statics[_StaticLyricHelperDuet].Visible = false; + Statics[_StaticLyricHelperTop].Visible = false; + Lyrics[_LyricMainDuet].Visible = false; + Lyrics[_LyricSubDuet].Visible = false; - Statics[StaticSongText].Visible = false; - Texts[TextSongName].Visible = false; - Texts[TextDuetName1].Visible = false; - Texts[TextDuetName2].Visible = false; + Statics[_StaticSongText].Visible = false; + Texts[_TextSongName].Visible = false; + Texts[_TextDuetName1].Visible = false; + Texts[_TextDuetName2].Visible = false; for (int numplayer = 0; numplayer < CSettings.MaxNumPlayer; numplayer++) { @@ -906,13 +906,13 @@ namespace Vocaluxe.Screens { if (player <= numplayer) { - Texts[TextScores[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer; - Texts[TextNames[player, numplayer]].Visible = (numplayer + 1 == CGame.NumPlayer) + Texts[_TextScores[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer; + Texts[_TextNames[player, numplayer]].Visible = (numplayer + 1 == CGame.NumPlayer) && (CConfig.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_BOTH || CConfig.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_NAME); - Statics[StaticScores[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer; - Statics[StaticAvatars[player, numplayer]].Visible = (numplayer + 1 == CGame.NumPlayer) + Statics[_StaticScores[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer; + Statics[_StaticAvatars[player, numplayer]].Visible = (numplayer + 1 == CGame.NumPlayer) && (CConfig.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_BOTH || CConfig.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_AVATAR); @@ -920,26 +920,26 @@ namespace Vocaluxe.Screens } } - Lyrics[LyricMain].Alpha = 0f; - Lyrics[LyricSub].Alpha = 0f; + Lyrics[_LyricMain].Alpha = 0f; + Lyrics[_LyricSub].Alpha = 0f; - Lyrics[LyricMainTop].Alpha = 0f; - Lyrics[LyricSubTop].Alpha = 0f; + Lyrics[_LyricMainTop].Alpha = 0f; + Lyrics[_LyricSubTop].Alpha = 0f; - Statics[StaticLyrics].Alpha = 0f; - Statics[StaticLyricsTop].Alpha = 0f; + Statics[_StaticLyrics].Alpha = 0f; + Statics[_StaticLyricsTop].Alpha = 0f; - Statics[StaticLyricHelper].Alpha = 0f; - Statics[StaticLyricHelperTop].Alpha = 0f; + Statics[_StaticLyricHelper].Alpha = 0f; + Statics[_StaticLyricHelperTop].Alpha = 0f; - Lyrics[LyricMainDuet].Alpha = 0f; - Lyrics[LyricSubDuet].Alpha = 0f; + Lyrics[_LyricMainDuet].Alpha = 0f; + Lyrics[_LyricSubDuet].Alpha = 0f; - Statics[StaticLyricsDuet].Alpha = 0f; - Statics[StaticLyricHelperDuet].Alpha = 0f; + Statics[_StaticLyricsDuet].Alpha = 0f; + Statics[_StaticLyricHelperDuet].Alpha = 0f; } - private void DrawLyricHelper() + private void _DrawLyricHelper() { if (_FadeOut) return; @@ -965,29 +965,29 @@ namespace Vocaluxe.Screens if (time > totaltime) time = totaltime; - SRectF Rect = Statics[StaticLyricHelper].Rect; - SColorF Color = new SColorF( - Statics[StaticLyricHelper].Color.R, - Statics[StaticLyricHelper].Color.G, - Statics[StaticLyricHelper].Color.B, - Statics[StaticLyricHelper].Color.A * Statics[StaticLyricHelper].Alpha * alpha); + SRectF rect = Statics[_StaticLyricHelper].Rect; + SColorF color = new SColorF( + Statics[_StaticLyricHelper].Color.R, + Statics[_StaticLyricHelper].Color.G, + Statics[_StaticLyricHelper].Color.B, + Statics[_StaticLyricHelper].Color.A * Statics[_StaticLyricHelper].Alpha * alpha); - float distance = Lyrics[LyricMain].GetCurrentLyricPosX() - Rect.X - Rect.W; - CDraw.DrawTexture(Statics[StaticLyricHelper].Texture, - new SRectF(Rect.X + distance * (1f - time / totaltime), Rect.Y, Rect.W, Rect.H, Rect.Z), Color); + float distance = Lyrics[_LyricMain].GetCurrentLyricPosX() - rect.X - rect.W; + CDraw.DrawTexture(Statics[_StaticLyricHelper].Texture, + new SRectF(rect.X + distance * (1f - time / totaltime), rect.Y, rect.W, rect.H, rect.Z), color); - if (Statics[StaticLyricsTop].Visible) + if (Statics[_StaticLyricsTop].Visible) { - Rect = Statics[StaticLyricHelperTop].Rect; - Color = new SColorF( - Statics[StaticLyricHelperTop].Color.R, - Statics[StaticLyricHelperTop].Color.G, - Statics[StaticLyricHelperTop].Color.B, - Statics[StaticLyricHelperTop].Color.A * Statics[StaticLyricHelper].Alpha * alpha); + rect = Statics[_StaticLyricHelperTop].Rect; + color = new SColorF( + Statics[_StaticLyricHelperTop].Color.R, + Statics[_StaticLyricHelperTop].Color.G, + Statics[_StaticLyricHelperTop].Color.B, + Statics[_StaticLyricHelperTop].Color.A * Statics[_StaticLyricHelper].Alpha * alpha); - distance = Lyrics[LyricMainTop].GetCurrentLyricPosX() - Rect.X - Rect.W; - CDraw.DrawTexture(Statics[StaticLyricHelperTop].Texture, - new SRectF(Rect.X + distance * (1f - time / totaltime), Rect.Y, Rect.W, Rect.H, Rect.Z), Color); + distance = Lyrics[_LyricMainTop].GetCurrentLyricPosX() - rect.X - rect.W; + CDraw.DrawTexture(Statics[_StaticLyricHelperTop].Texture, + new SRectF(rect.X + distance * (1f - time / totaltime), rect.Y, rect.W, rect.H, rect.Z), color); } } @@ -1004,160 +1004,160 @@ namespace Vocaluxe.Screens if (time > totaltime) time = totaltime; - SRectF Rect = Statics[StaticLyricHelperDuet].Rect; + SRectF rect = Statics[_StaticLyricHelperDuet].Rect; - SColorF Color = new SColorF( - Statics[StaticLyricHelperDuet].Color.R, - Statics[StaticLyricHelperDuet].Color.G, - Statics[StaticLyricHelperDuet].Color.B, - Statics[StaticLyricHelperDuet].Color.A * Statics[StaticLyricHelperDuet].Alpha * alpha); + SColorF color = new SColorF( + Statics[_StaticLyricHelperDuet].Color.R, + Statics[_StaticLyricHelperDuet].Color.G, + Statics[_StaticLyricHelperDuet].Color.B, + Statics[_StaticLyricHelperDuet].Color.A * Statics[_StaticLyricHelperDuet].Alpha * alpha); - float distance = Lyrics[LyricMainDuet].GetCurrentLyricPosX() - Rect.X - Rect.W; - CDraw.DrawTexture(Statics[StaticLyricHelperDuet].Texture, - new SRectF(Rect.X + distance * (1f - time / totaltime), Rect.Y, Rect.W, Rect.H, Rect.Z), - Color); + float distance = Lyrics[_LyricMainDuet].GetCurrentLyricPosX() - rect.X - rect.W; + CDraw.DrawTexture(Statics[_StaticLyricHelperDuet].Texture, + new SRectF(rect.X + distance * (1f - time / totaltime), rect.Y, rect.W, rect.H, rect.Z), + color); } } } - private float[] CalcFadingAlpha() + private float[] _CalcFadingAlpha() { float dt = 4f; float rt = dt * 0.8f; - CSong Song = CGame.GetSong(); - if (Song == null) + CSong song = CGame.GetSong(); + if (song == null) return null; - else if (!Song.NotesLoaded) + else if (!song.NotesLoaded) return null; - float[] Alpha = new float[Song.Notes.Lines.Length * 2]; - float CurrentTime = _CurrentTime - Song.Gap; + float[] alpha = new float[song.Notes.Lines.Length * 2]; + float currentTime = _CurrentTime - song.Gap; - for (int i = 0; i < Song.Notes.LinesCount; i++) + for (int i = 0; i < song.Notes.LinesCount; i++) { - CLines lines = Song.Notes.GetLines(i); + CLines lines = song.Notes.GetLines(i); CLine[] line = lines.Line; // find current line for lyric sub fading - int CurrentLineSub = FindCurrentLine(lines, line, Song); + int currentLineSub = _FindCurrentLine(lines, line, song); // find current line for lyric main fading - int CurrentLine = 0; + int currentLine = 0; for (int j = 0; j < line.Length; j++) { if (line[j].FirstNoteBeat <= _CurrentBeat) - CurrentLine = j; + currentLine = j; } // default values - Alpha[i * 2] = 1f; - Alpha[i * 2 + 1] = 1f; + alpha[i * 2] = 1f; + alpha[i * 2 + 1] = 1f; // main line alpha - if (CurrentLine == 0 && CurrentTime < CGame.GetTimeFromBeats(line[CurrentLine].FirstNoteBeat, Song.BPM)) + if (currentLine == 0 && currentTime < CGame.GetTimeFromBeats(line[currentLine].FirstNoteBeat, song.BPM)) { // first main line and fist note is not reached // => fade in - float diff = CGame.GetTimeFromBeats(line[CurrentLine].FirstNoteBeat, Song.BPM) - CurrentTime; + float diff = CGame.GetTimeFromBeats(line[currentLine].FirstNoteBeat, song.BPM) - currentTime; if (diff > dt) - Alpha[i * 2] = 1f - (diff - dt) / rt; + alpha[i * 2] = 1f - (diff - dt) / rt; } - else if (CurrentLine < line.Length - 1 && CGame.GetTimeFromBeats(line[CurrentLine].LastNoteBeat, Song.BPM) < CurrentTime && - CGame.GetTimeFromBeats(line[CurrentLine + 1].FirstNoteBeat, Song.BPM) > CurrentTime) + else if (currentLine < line.Length - 1 && CGame.GetTimeFromBeats(line[currentLine].LastNoteBeat, song.BPM) < currentTime && + CGame.GetTimeFromBeats(line[currentLine + 1].FirstNoteBeat, song.BPM) > currentTime) { // current position is between two lines // time between the to lines - float diff = CGame.GetTimeFromBeats(line[CurrentLine + 1].FirstNoteBeat, Song.BPM) - - CGame.GetTimeFromBeats(line[CurrentLine].LastNoteBeat, Song.BPM); + float diff = CGame.GetTimeFromBeats(line[currentLine + 1].FirstNoteBeat, song.BPM) - + CGame.GetTimeFromBeats(line[currentLine].LastNoteBeat, song.BPM); // fade only if there is enough time for fading if (diff > 3.3f * dt) { // time elapsed since last line - float last = CurrentTime - CGame.GetTimeFromBeats(line[CurrentLine].LastNoteBeat, Song.BPM); + float last = currentTime - CGame.GetTimeFromBeats(line[currentLine].LastNoteBeat, song.BPM); // time to next line - float next = CGame.GetTimeFromBeats(line[CurrentLine + 1].FirstNoteBeat, Song.BPM) - CurrentTime; + float next = CGame.GetTimeFromBeats(line[currentLine + 1].FirstNoteBeat, song.BPM) - currentTime; if (last < next) { // fade out - Alpha[i * 2] = 1f - last / rt; + alpha[i * 2] = 1f - last / rt; } else { // fade in if it is time for if (next > dt) - Alpha[i * 2] = 1f - (next - dt) / rt; + alpha[i * 2] = 1f - (next - dt) / rt; } } } - else if (CurrentLine == line.Length - 1 && CGame.GetTimeFromBeats(line[CurrentLine].LastNoteBeat, Song.BPM) < CurrentTime) + else if (currentLine == line.Length - 1 && CGame.GetTimeFromBeats(line[currentLine].LastNoteBeat, song.BPM) < currentTime) { // last main line and last note was reached // => fade out - float diff = CurrentTime - CGame.GetTimeFromBeats(line[CurrentLine].LastNoteBeat, Song.BPM); - Alpha[i * 2] = 1f - diff / rt; + float diff = currentTime - CGame.GetTimeFromBeats(line[currentLine].LastNoteBeat, song.BPM); + alpha[i * 2] = 1f - diff / rt; } // sub - if (CurrentLineSub < line.Length - 2) + if (currentLineSub < line.Length - 2) { float diff = 0f; - diff = CGame.GetTimeFromBeats(line[CurrentLineSub + 1].FirstNoteBeat, Song.BPM) - CurrentTime; + diff = CGame.GetTimeFromBeats(line[currentLineSub + 1].FirstNoteBeat, song.BPM) - currentTime; if (diff > dt) - Alpha[i * 2 + 1] = 1f - (diff - dt) / rt; + alpha[i * 2 + 1] = 1f - (diff - dt) / rt; } - if (Alpha[i * 2] < 0f) - Alpha[i * 2] = 0f; + if (alpha[i * 2] < 0f) + alpha[i * 2] = 0f; - if (Alpha[i * 2 + 1] < 0f) - Alpha[i * 2 + 1] = 0f; + if (alpha[i * 2 + 1] < 0f) + alpha[i * 2 + 1] = 0f; } - return Alpha; + return alpha; } - private void UpdateSongText() + private void _UpdateSongText() { - if (_TimerSongText.IsRunning && !Lyrics[LyricMainDuet].Visible && !Lyrics[LyricMainTop].Visible) + if (_TimerSongText.IsRunning && !Lyrics[_LyricMainDuet].Visible && !Lyrics[_LyricMainTop].Visible) { float t = _TimerSongText.ElapsedMilliseconds / 1000f; if (t < 10f) { - Statics[StaticSongText].Visible = true; - Texts[TextSongName].Visible = true; + Statics[_StaticSongText].Visible = true; + Texts[_TextSongName].Visible = true; if (t < 7f) { - Statics[StaticSongText].Color.A = 1f; - Texts[TextSongName].Color.A = 1f; + Statics[_StaticSongText].Color.A = 1f; + Texts[_TextSongName].Color.A = 1f; } else { - Statics[StaticSongText].Color.A = (3f - (t - 7f)) / 3f; - Texts[TextSongName].Color.A = (3f - (t - 7f)) / 3f; + Statics[_StaticSongText].Color.A = (3f - (t - 7f)) / 3f; + Texts[_TextSongName].Color.A = (3f - (t - 7f)) / 3f; } } else { - Statics[StaticSongText].Visible = false; - Texts[TextSongName].Visible = false; + Statics[_StaticSongText].Visible = false; + Texts[_TextSongName].Visible = false; _TimerSongText.Stop(); } } else { - Statics[StaticSongText].Visible = false; - Texts[TextSongName].Visible = false; + Statics[_StaticSongText].Visible = false; + Texts[_TextSongName].Visible = false; } } - private void UpdateDuetText() + private void _UpdateDuetText() { if (CGame.GetSong() != null) { @@ -1167,89 +1167,89 @@ namespace Vocaluxe.Screens float t = _TimerDuetText1.ElapsedMilliseconds / 1000f; if (t < 10f) { - Texts[TextDuetName1].Visible = true; + Texts[_TextDuetName1].Visible = true; if (t < 3f) - Texts[TextDuetName1].Color.A = (3f - (3f - t)) / 3f; + Texts[_TextDuetName1].Color.A = (3f - (3f - t)) / 3f; else if (t < 7f) - Texts[TextDuetName1].Color.A = 1f; + Texts[_TextDuetName1].Color.A = 1f; else - Texts[TextDuetName1].Color.A = (3f - (t - 7f)) / 3f; + Texts[_TextDuetName1].Color.A = (3f - (t - 7f)) / 3f; } else { - Texts[TextDuetName1].Visible = false; + Texts[_TextDuetName1].Visible = false; _TimerDuetText1.Stop(); } } - else if (!_TimerDuetText1.IsRunning && _TimerDuetText1.ElapsedMilliseconds == 0 && Lyrics[LyricMainDuet].Alpha > 0 && CGame.GetSong().IsDuet) + else if (!_TimerDuetText1.IsRunning && _TimerDuetText1.ElapsedMilliseconds == 0 && Lyrics[_LyricMainDuet].Alpha > 0 && CGame.GetSong().IsDuet) _TimerDuetText1.Start(); else - Texts[TextDuetName1].Visible = false; + Texts[_TextDuetName1].Visible = false; //Timer for second duet-part if (_TimerDuetText2.IsRunning) { float t = _TimerDuetText2.ElapsedMilliseconds / 1000f; if (t < 10f) { - Texts[TextDuetName2].Visible = true; + Texts[_TextDuetName2].Visible = true; if (t < 3f) - Texts[TextDuetName2].Color.A = (3f - (3f - t)) / 3f; + Texts[_TextDuetName2].Color.A = (3f - (3f - t)) / 3f; else if (t < 7f) - Texts[TextDuetName2].Color.A = 1f; + Texts[_TextDuetName2].Color.A = 1f; else - Texts[TextDuetName2].Color.A = (3f - (t - 7f)) / 3f; + Texts[_TextDuetName2].Color.A = (3f - (t - 7f)) / 3f; } else { - Texts[TextDuetName2].Visible = false; + Texts[_TextDuetName2].Visible = false; _TimerDuetText2.Stop(); } } - else if (!_TimerDuetText2.IsRunning && _TimerDuetText2.ElapsedMilliseconds == 0 && Lyrics[LyricMain].Alpha > 0 && CGame.GetSong().IsDuet) + else if (!_TimerDuetText2.IsRunning && _TimerDuetText2.ElapsedMilliseconds == 0 && Lyrics[_LyricMain].Alpha > 0 && CGame.GetSong().IsDuet) _TimerDuetText2.Start(); else - Texts[TextDuetName2].Visible = false; + Texts[_TextDuetName2].Visible = false; } } - private void UpdateTimeLine() + private void _UpdateTimeLine() { CSong song = CGame.GetSong(); if (song == null) return; - float TotalTime = CSound.GetLength(_CurrentStream); + float totalTime = CSound.GetLength(_CurrentStream); if (song.Finish != 0) - TotalTime = song.Finish; + totalTime = song.Finish; - float RemainingTime = TotalTime - _CurrentTime; - TotalTime -= song.Start; - float CurrentTime = _CurrentTime - song.Start; + float remainingTime = totalTime - _CurrentTime; + totalTime -= song.Start; + float currentTime = _CurrentTime - song.Start; - if (TotalTime <= 0f) + if (totalTime <= 0f) return; switch (CConfig.TimerMode) { case ETimerMode.TR_CONFIG_TIMERMODE_CURRENT: - int min = (int)Math.Floor(CurrentTime / 60f); - int sec = (int)(CurrentTime - min * 60f); - Texts[TextTime].Text = min.ToString("00") + ":" + sec.ToString("00"); + int min = (int)Math.Floor(currentTime / 60f); + int sec = (int)(currentTime - min * 60f); + Texts[_TextTime].Text = min.ToString("00") + ":" + sec.ToString("00"); break; case ETimerMode.TR_CONFIG_TIMERMODE_REMAINING: - min = (int)Math.Floor(RemainingTime / 60f); - sec = (int)(RemainingTime - min * 60f); - Texts[TextTime].Text = "-" + min.ToString("00") + ":" + sec.ToString("00"); + min = (int)Math.Floor(remainingTime / 60f); + sec = (int)(remainingTime - min * 60f); + Texts[_TextTime].Text = "-" + min.ToString("00") + ":" + sec.ToString("00"); break; case ETimerMode.TR_CONFIG_TIMERMODE_TOTAL: - min = (int)Math.Floor(TotalTime / 60f); - sec = (int)(TotalTime - min * 60f); - Texts[TextTime].Text = "#" + min.ToString("00") + ":" + sec.ToString("00"); + min = (int)Math.Floor(totalTime / 60f); + sec = (int)(totalTime - min * 60f); + Texts[_TextTime].Text = "#" + min.ToString("00") + ":" + sec.ToString("00"); break; } @@ -1257,76 +1257,76 @@ namespace Vocaluxe.Screens switch (CConfig.TimerLook) { case ETimerLook.TR_CONFIG_TIMERLOOK_NORMAL: - _TimeLineRect.W = Statics[StaticTimeLine].Rect.W * (CurrentTime / TotalTime); + _TimeLineRect.W = Statics[_StaticTimeLine].Rect.W * (currentTime / totalTime); break; case ETimerLook.TR_CONFIG_TIMERLOOK_EXPANDED: - CStatic stat = Statics[StaticTimeLine]; - int CurrentBeat = CGame.CurrentBeat; + CStatic stat = Statics[_StaticTimeLine]; + int currentBeat = CGame.CurrentBeat; for (int i = 0; i < _TimeRects.Count; i++) { - if (CurrentBeat >= _TimeRects[i].startBeat && CurrentBeat <= _TimeRects[i].endBeat) + if (currentBeat >= _TimeRects[i].StartBeat && currentBeat <= _TimeRects[i].EndBeat) { - _TimeRects[i].rect.Texture = Statics[StaticTimeLineExpandedHighlighted].Texture; - _TimeRects[i].rect.Color = Statics[StaticTimeLineExpandedHighlighted].Color; + _TimeRects[i].Rect.Texture = Statics[_StaticTimeLineExpandedHighlighted].Texture; + _TimeRects[i].Rect.Color = Statics[_StaticTimeLineExpandedHighlighted].Color; } else { - _TimeRects[i].rect.Texture = Statics[StaticTimeLineExpandedNormal].Texture; - _TimeRects[i].rect.Color = Statics[StaticTimeLineExpandedNormal].Color; + _TimeRects[i].Rect.Texture = Statics[_StaticTimeLineExpandedNormal].Texture; + _TimeRects[i].Rect.Color = Statics[_StaticTimeLineExpandedNormal].Color; } } - Statics[StaticTimePointer].Rect.X = stat.Rect.X + stat.Rect.W * (CurrentTime / TotalTime); + Statics[_StaticTimePointer].Rect.X = stat.Rect.X + stat.Rect.W * (currentTime / totalTime); break; } } - private void PrepareTimeLine() + private void _PrepareTimeLine() { - CStatic stat = Statics[StaticTimeLine]; + CStatic stat = Statics[_StaticTimeLine]; switch (CConfig.TimerLook) { case ETimerLook.TR_CONFIG_TIMERLOOK_NORMAL: _TimeLineRect = new SRectF(stat.Rect.X, stat.Rect.Y, 0f, stat.Rect.H, stat.Rect.Z); - Statics[StaticTimePointer].Visible = false; + Statics[_StaticTimePointer].Visible = false; break; case ETimerLook.TR_CONFIG_TIMERLOOK_EXPANDED: _TimeRects.Clear(); - Statics[StaticTimePointer].Visible = true; + Statics[_StaticTimePointer].Visible = true; CSong song = CGame.GetSong(); if (song == null) return; - float TotalTime = CSound.GetLength(_CurrentStream); + float totalTime = CSound.GetLength(_CurrentStream); if (song.Finish != 0) - TotalTime = song.Finish; + totalTime = song.Finish; - TotalTime -= song.Start; + totalTime -= song.Start; - if (TotalTime <= 0f) + if (totalTime <= 0f) return; - CLines[] Lines = new CLines[song.Notes.Lines.Length]; - Lines = song.Notes.Lines; - for (int i = 0; i < Lines.Length; i++) + CLines[] lines = new CLines[song.Notes.Lines.Length]; + lines = song.Notes.Lines; + for (int i = 0; i < lines.Length; i++) { - CLine[] Line = Lines[i].Line; - for (int j = 0; j < Line.Length; j++) + CLine[] line = lines[i].Line; + for (int j = 0; j < line.Length; j++) { - if (Line[j].VisibleInTimeLine) + if (line[j].VisibleInTimeLine) { - TimeRect trect = new TimeRect(); - trect.startBeat = Line[j].FirstNoteBeat; - trect.endBeat = Line[j].EndBeat; - trect.rect = GetNewStatic(new STexture(-1), + STimeRect trect = new STimeRect(); + trect.StartBeat = line[j].FirstNoteBeat; + trect.EndBeat = line[j].EndBeat; + trect.Rect = GetNewStatic(new STexture(-1), new SColorF(1f, 1f, 1f, 1f), new SRectF( - stat.Rect.X + stat.Rect.W * ((CGame.GetTimeFromBeats(trect.startBeat, song.BPM) + song.Gap - song.Start) / TotalTime), + stat.Rect.X + stat.Rect.W * ((CGame.GetTimeFromBeats(trect.StartBeat, song.BPM) + song.Gap - song.Start) / totalTime), stat.Rect.Y, - stat.Rect.W * (CGame.GetTimeFromBeats(trect.endBeat - trect.startBeat, song.BPM) / TotalTime), + stat.Rect.W * (CGame.GetTimeFromBeats(trect.EndBeat - trect.StartBeat, song.BPM) / totalTime), stat.Rect.H, stat.Rect.Z)); @@ -1338,25 +1338,25 @@ namespace Vocaluxe.Screens } } - private void UpdateAvatars() + private void _UpdateAvatars() { for (int i = 0; i < CGame.NumPlayer; i++) { if (CGame.Player[i].ProfileID > -1 && CProfiles.NumProfiles > CGame.Player[i].ProfileID) - Statics[StaticAvatars[i, CGame.NumPlayer - 1]].Texture = CProfiles.Profiles[CGame.Player[i].ProfileID].Avatar.Texture; + Statics[_StaticAvatars[i, CGame.NumPlayer - 1]].Texture = CProfiles.Profiles[CGame.Player[i].ProfileID].Avatar.Texture; else - Statics[StaticAvatars[i, CGame.NumPlayer - 1]].Visible = false; + Statics[_StaticAvatars[i, CGame.NumPlayer - 1]].Visible = false; } } - private void UpdateNames() + private void _UpdateNames() { for (int i = 0; i < CGame.NumPlayer; i++) { if (CGame.Player[i].ProfileID > -1 && CProfiles.NumProfiles > CGame.Player[i].ProfileID) - Texts[TextNames[i, CGame.NumPlayer - 1]].Text = CProfiles.Profiles[CGame.Player[i].ProfileID].PlayerName; + Texts[_TextNames[i, CGame.NumPlayer - 1]].Text = CProfiles.Profiles[CGame.Player[i].ProfileID].PlayerName; else - Texts[TextNames[i, CGame.NumPlayer - 1]].Visible = false; + Texts[_TextNames[i, CGame.NumPlayer - 1]].Visible = false; } } } diff --git a/Vocaluxe/Screens/CScreenSong.cs b/Vocaluxe/Screens/CScreenSong.cs index 3ef9c575..b4c973af 100644 --- a/Vocaluxe/Screens/CScreenSong.cs +++ b/Vocaluxe/Screens/CScreenSong.cs @@ -24,52 +24,52 @@ namespace Vocaluxe.Screens get { return 5; } } - private const string TextCategory = "TextCategory"; - private const string TextSelection = "TextSelection"; - private const string TextSearchBarTitle = "TextSearchBarTitle"; - private const string TextSearchBar = "TextSearchBar"; - private const string TextOptionsTitle = "TextOptionsTitle"; + private const string _TextCategory = "TextCategory"; + private const string _TextSelection = "TextSelection"; + private const string _TextSearchBarTitle = "TextSearchBarTitle"; + private const string _TextSearchBar = "TextSearchBar"; + private const string _TextOptionsTitle = "TextOptionsTitle"; - private const string ButtonOpenOptions = "ButtonOpenOptions"; - private const string ButtonOptionsSing = "ButtonOptionsSing"; - private const string ButtonOptionsPlaylist = "ButtonOptionsPlaylist"; - private const string ButtonOptionsClose = "ButtonOptionsClose"; - private const string ButtonOptionsRandom = "ButtonOptionsRandom"; - private const string ButtonOptionsRandomCategory = "ButtonOptionsRandomCategory"; - private const string ButtonOptionsSingAll = "ButtonOptionsSingAll"; - private const string ButtonOptionsSingAllVisible = "ButtonOptionsSingAllVisible"; - private const string ButtonOptionsOpenSelectedItem = "ButtonOptionsOpenSelectedItem"; - private const string ButtonOptionsRandomMedley = "ButtonOptionsRandomMedley"; - private const string ButtonOptionsStartMedley = "ButtonOptionsStartMedley"; - private const string ButtonStart = "ButtonStart"; + private const string _ButtonOpenOptions = "ButtonOpenOptions"; + private const string _ButtonOptionsSing = "ButtonOptionsSing"; + private const string _ButtonOptionsPlaylist = "ButtonOptionsPlaylist"; + private const string _ButtonOptionsClose = "ButtonOptionsClose"; + private const string _ButtonOptionsRandom = "ButtonOptionsRandom"; + private const string _ButtonOptionsRandomCategory = "ButtonOptionsRandomCategory"; + private const string _ButtonOptionsSingAll = "ButtonOptionsSingAll"; + private const string _ButtonOptionsSingAllVisible = "ButtonOptionsSingAllVisible"; + private const string _ButtonOptionsOpenSelectedItem = "ButtonOptionsOpenSelectedItem"; + private const string _ButtonOptionsRandomMedley = "ButtonOptionsRandomMedley"; + private const string _ButtonOptionsStartMedley = "ButtonOptionsStartMedley"; + private const string _ButtonStart = "ButtonStart"; - private const string SelectSlideOptionsMode = "SelectSlideOptionsMode"; - private const string SelectSlideOptionsPlaylistAdd = "SelectSlideOptionsPlaylistAdd"; - private const string SelectSlideOptionsPlaylistOpen = "SelectSlideOptionsPlaylistOpen"; - private const string SelectSlideOptionsNumMedleySongs = "SelectSlideOptionsNumMedleySongs"; + private const string _SelectSlideOptionsMode = "SelectSlideOptionsMode"; + private const string _SelectSlideOptionsPlaylistAdd = "SelectSlideOptionsPlaylistAdd"; + private const string _SelectSlideOptionsPlaylistOpen = "SelectSlideOptionsPlaylistOpen"; + private const string _SelectSlideOptionsNumMedleySongs = "SelectSlideOptionsNumMedleySongs"; - private const string StaticSearchBar = "StaticSearchBar"; - private const string StaticOptionsBG = "StaticOptionsBG"; - private const string SongMenu = "SongMenu"; - private const string Playlist = "Playlist"; + private const string _StaticSearchBar = "StaticSearchBar"; + private const string _StaticOptionsBG = "StaticOptionsBG"; + private const string _SongMenu = "SongMenu"; + private const string _Playlist = "Playlist"; private string _SearchText = String.Empty; private bool _SearchActive; - private readonly List ButtonsJoker = new List(); - private readonly List TextsPlayer = new List(); + private readonly List _ButtonsJoker = new List(); + private readonly List _TextsPlayer = new List(); private bool _SongOptionsActive; private bool _PlaylistActive; private readonly List _AvailableGameModes; - private ScreenSongOptions _sso; + private SScreenSongOptions _Sso; - private CStatic DragAndDropCover; - private bool DragAndDropActive; - private int OldMousePosX; - private int OldMousePosY; + private CStatic _DragAndDropCover; + private bool _DragAndDropActive; + private int _OldMousePosX; + private int _OldMousePosY; - private int SelectedSongID; - private int SelectedCategoryIndex; + private int _SelectedSongID; + private int _SelectedCategoryIndex; public CScreenSong() { @@ -80,59 +80,59 @@ namespace Vocaluxe.Screens { base.Init(); - ButtonsJoker.Clear(); + _ButtonsJoker.Clear(); for (int i = 0; i < CMain.Settings.GetMaxNumPlayer(); i++) - ButtonsJoker.Add("ButtonJoker" + (i + 1)); + _ButtonsJoker.Add("ButtonJoker" + (i + 1)); List blist = new List(); - blist.AddRange(ButtonsJoker); - blist.Add(ButtonOptionsClose); - blist.Add(ButtonOptionsPlaylist); - blist.Add(ButtonOptionsSing); - blist.Add(ButtonOptionsRandom); - blist.Add(ButtonOptionsRandomCategory); - blist.Add(ButtonOptionsSingAll); - blist.Add(ButtonOptionsSingAllVisible); - blist.Add(ButtonOptionsOpenSelectedItem); - blist.Add(ButtonOpenOptions); - blist.Add(ButtonStart); - blist.Add(ButtonOptionsRandomMedley); - blist.Add(ButtonOptionsStartMedley); + blist.AddRange(_ButtonsJoker); + blist.Add(_ButtonOptionsClose); + blist.Add(_ButtonOptionsPlaylist); + blist.Add(_ButtonOptionsSing); + blist.Add(_ButtonOptionsRandom); + blist.Add(_ButtonOptionsRandomCategory); + blist.Add(_ButtonOptionsSingAll); + blist.Add(_ButtonOptionsSingAllVisible); + blist.Add(_ButtonOptionsOpenSelectedItem); + blist.Add(_ButtonOpenOptions); + blist.Add(_ButtonStart); + blist.Add(_ButtonOptionsRandomMedley); + blist.Add(_ButtonOptionsStartMedley); - TextsPlayer.Clear(); + _TextsPlayer.Clear(); for (int i = 0; i < CMain.Settings.GetMaxNumPlayer(); i++) - TextsPlayer.Add("TextPlayer" + (i + 1)); + _TextsPlayer.Add("TextPlayer" + (i + 1)); List tlist = new List(); - tlist.AddRange(TextsPlayer); - tlist.Add(TextCategory); - tlist.Add(TextSelection); - tlist.Add(TextSearchBarTitle); - tlist.Add(TextSearchBar); - tlist.Add(TextOptionsTitle); + tlist.AddRange(_TextsPlayer); + tlist.Add(_TextCategory); + tlist.Add(_TextSelection); + tlist.Add(_TextSearchBarTitle); + tlist.Add(_TextSearchBar); + tlist.Add(_TextOptionsTitle); - _ThemeStatics = new string[] {StaticSearchBar, StaticOptionsBG}; + _ThemeStatics = new string[] {_StaticSearchBar, _StaticOptionsBG}; _ThemeTexts = tlist.ToArray(); _ThemeButtons = blist.ToArray(); - _ThemeSelectSlides = new string[] {SelectSlideOptionsMode, SelectSlideOptionsPlaylistAdd, SelectSlideOptionsPlaylistOpen, SelectSlideOptionsNumMedleySongs}; - _ThemeSongMenus = new string[] {SongMenu}; - _ThemePlaylists = new string[] {Playlist}; + _ThemeSelectSlides = new string[] {_SelectSlideOptionsMode, _SelectSlideOptionsPlaylistAdd, _SelectSlideOptionsPlaylistOpen, _SelectSlideOptionsNumMedleySongs}; + _ThemeSongMenus = new string[] {_SongMenu}; + _ThemePlaylists = new string[] {_Playlist}; } - public override void LoadTheme(string XmlPath) + public override void LoadTheme(string xmlPath) { - base.LoadTheme(XmlPath); - ToggleSongOptions(ESongOptionsView.None); - Playlists[Playlist].Visible = false; + base.LoadTheme(xmlPath); + _ToggleSongOptions(ESongOptionsView.None); + Playlists[_Playlist].Visible = false; - DragAndDropCover = GetNewStatic(); + _DragAndDropCover = GetNewStatic(); - Playlists[Playlist].Init(); + Playlists[_Playlist].Init(); _AvailableGameModes.Clear(); ApplyVolume(); } - public override bool HandleInput(KeyEvent keyEvent) + public override bool HandleInput(SKeyEvent keyEvent) { base.HandleInput(keyEvent); if (keyEvent.Handled) @@ -140,7 +140,7 @@ namespace Vocaluxe.Screens if (_PlaylistActive) { - Playlists[Playlist].HandleInput(keyEvent); + Playlists[_Playlist].HandleInput(keyEvent); return true; } @@ -149,17 +149,17 @@ namespace Vocaluxe.Screens if (keyEvent.KeyPressed && !Char.IsControl(keyEvent.Unicode) && keyEvent.Mod != EModifier.Ctrl) { if (_SearchActive) - ApplyNewSearchFilter(_SearchText + keyEvent.Unicode); + _ApplyNewSearchFilter(_SearchText + keyEvent.Unicode); else { - JumpTo(keyEvent.Unicode); + _JumpTo(keyEvent.Unicode); return true; } } else { - SongMenus[SongMenu].HandleInput(ref keyEvent, _sso); - UpdatePartyModeOptions(); + SongMenus[_SongMenu].HandleInput(ref keyEvent, _Sso); + _UpdatePartyModeOptions(); if (keyEvent.Handled) return true; @@ -167,57 +167,57 @@ namespace Vocaluxe.Screens switch (keyEvent.Key) { case Keys.Escape: - if ((CSongs.Category < 0 || _sso.Sorting.Tabs == EOffOn.TR_CONFIG_OFF) && !_sso.Selection.PartyMode && !_SearchActive) + if ((CSongs.Category < 0 || _Sso.Sorting.Tabs == EOffOn.TR_CONFIG_OFF) && !_Sso.Selection.PartyMode && !_SearchActive) CGraphics.FadeTo(EScreens.ScreenMain); if (_SearchActive) { _SearchActive = false; _SearchText = String.Empty; - ApplyNewSearchFilter(_SearchText); + _ApplyNewSearchFilter(_SearchText); } break; case Keys.Enter: - if (_sso.Selection.RandomOnly && _sso.Selection.NumJokers != null) + if (_Sso.Selection.RandomOnly && _Sso.Selection.NumJokers != null) { - for (int i = 0; i < ButtonsJoker.Count; i++) + for (int i = 0; i < _ButtonsJoker.Count; i++) { - if (i < _sso.Selection.NumJokers.Length) + if (i < _Sso.Selection.NumJokers.Length) { - if (Buttons[ButtonsJoker[i]].Selected) + if (Buttons[_ButtonsJoker[i]].Selected) { - SelectNextRandom(i); + _SelectNextRandom(i); return true; } } } - if (Buttons[ButtonStart].Selected) - HandlePartySongSelection(SongMenus[SongMenu].GetSelectedSong()); + if (Buttons[_ButtonStart].Selected) + _HandlePartySongSelection(SongMenus[_SongMenu].GetSelectedSong()); } - if (CSongs.NumVisibleSongs > 0 && !_sso.Selection.PartyMode) + if (CSongs.NumVisibleSongs > 0 && !_Sso.Selection.PartyMode) { - if (SongMenus[SongMenu].GetSelectedSong() != -1 && !_SongOptionsActive) + if (SongMenus[_SongMenu].GetSelectedSong() != -1 && !_SongOptionsActive) { - if (!_sso.Selection.PartyMode) - ToggleSongOptions(ESongOptionsView.Song); + if (!_Sso.Selection.PartyMode) + _ToggleSongOptions(ESongOptionsView.Song); } } break; case Keys.Tab: - if (Playlists[Playlist].Visible) + if (Playlists[_Playlist].Visible) { _PlaylistActive = !_PlaylistActive; - Playlists[Playlist].Selected = _PlaylistActive; - SongMenus[SongMenu].SetActive(!_PlaylistActive); + Playlists[_Playlist].Selected = _PlaylistActive; + SongMenus[_SongMenu].SetActive(!_PlaylistActive); } break; case Keys.Back: if (_SearchActive && _SearchText.Length > 0) - ApplyNewSearchFilter(_SearchText.Remove(_SearchText.Length - 1)); + _ApplyNewSearchFilter(_SearchText.Remove(_SearchText.Length - 1)); - if ((CSongs.Category < 0 || _sso.Sorting.Tabs == EOffOn.TR_CONFIG_OFF) && !_sso.Selection.PartyMode && !_SearchActive) + if ((CSongs.Category < 0 || _Sso.Sorting.Tabs == EOffOn.TR_CONFIG_OFF) && !_Sso.Selection.PartyMode && !_SearchActive) CGraphics.FadeTo(EScreens.ScreenMain); break; @@ -227,9 +227,9 @@ namespace Vocaluxe.Screens { _SearchActive = false; _SearchText = String.Empty; - ApplyNewSearchFilter(_SearchText); + _ApplyNewSearchFilter(_SearchText); } - else if (!_sso.Selection.PartyMode) + else if (!_Sso.Selection.PartyMode) _SearchActive = true; break; } @@ -238,51 +238,51 @@ namespace Vocaluxe.Screens switch (keyEvent.Key) { case Keys.Space: - if (!_sso.Selection.PartyMode) - ToggleSongOptions(ESongOptionsView.General); + if (!_Sso.Selection.PartyMode) + _ToggleSongOptions(ESongOptionsView.General); break; case Keys.A: - if (keyEvent.Mod == EModifier.Ctrl && !_sso.Selection.PartyMode) - StartRandomAllSongs(); + if (keyEvent.Mod == EModifier.Ctrl && !_Sso.Selection.PartyMode) + _StartRandomAllSongs(); break; case Keys.V: - if (keyEvent.Mod == EModifier.Ctrl && !_sso.Selection.PartyMode) - StartRandomVisibleSongs(); + if (keyEvent.Mod == EModifier.Ctrl && !_Sso.Selection.PartyMode) + _StartRandomVisibleSongs(); break; case Keys.R: - if (keyEvent.Mod == EModifier.Ctrl && !_sso.Selection.RandomOnly) - SelectNextRandom(-1); + if (keyEvent.Mod == EModifier.Ctrl && !_Sso.Selection.RandomOnly) + _SelectNextRandom(-1); break; case Keys.S: - if (keyEvent.Mod == EModifier.Ctrl && CSongs.NumVisibleSongs > 0 && !_sso.Selection.PartyMode) - StartMedleySong(SongMenus[SongMenu].GetSelectedSong()); + if (keyEvent.Mod == EModifier.Ctrl && CSongs.NumVisibleSongs > 0 && !_Sso.Selection.PartyMode) + _StartMedleySong(SongMenus[_SongMenu].GetSelectedSong()); break; case Keys.D1: - SelectNextRandom(0); + _SelectNextRandom(0); break; case Keys.D2: - SelectNextRandom(1); + _SelectNextRandom(1); break; case Keys.D3: - SelectNextRandom(2); + _SelectNextRandom(2); break; case Keys.D4: - SelectNextRandom(3); + _SelectNextRandom(3); break; case Keys.D5: - SelectNextRandom(4); + _SelectNextRandom(4); break; case Keys.D6: - SelectNextRandom(5); + _SelectNextRandom(5); break; } } @@ -293,51 +293,51 @@ namespace Vocaluxe.Screens switch (keyEvent.Key) { case Keys.Enter: - if (Buttons[ButtonOptionsClose].Selected) - ToggleSongOptions(ESongOptionsView.None); - else if (Buttons[ButtonOptionsSing].Selected) + if (Buttons[_ButtonOptionsClose].Selected) + _ToggleSongOptions(ESongOptionsView.None); + else if (Buttons[_ButtonOptionsSing].Selected) { - ToggleSongOptions(ESongOptionsView.None); - StartSong(SongMenus[SongMenu].GetSelectedSong()); + _ToggleSongOptions(ESongOptionsView.None); + _StartSong(SongMenus[_SongMenu].GetSelectedSong()); } - else if (Buttons[ButtonOptionsPlaylist].Selected) + else if (Buttons[_ButtonOptionsPlaylist].Selected) { - ToggleSongOptions(ESongOptionsView.None); - OpenAndAddPlaylistAction(); + _ToggleSongOptions(ESongOptionsView.None); + _OpenAndAddPlaylistAction(); } - else if (Buttons[ButtonOptionsRandom].Selected) + else if (Buttons[_ButtonOptionsRandom].Selected) { if (CSongs.IsInCategory) - SongMenus[SongMenu].SetSelectedSong(CSongs.GetRandomSong()); + SongMenus[_SongMenu].SetSelectedSong(CSongs.GetRandomSong()); else - SongMenus[SongMenu].SetSelectedCategory(CSongs.GetRandomCategory()); + SongMenus[_SongMenu].SetSelectedCategory(CSongs.GetRandomCategory()); } - else if (Buttons[ButtonOptionsSingAll].Selected) - StartRandomAllSongs(); - else if (Buttons[ButtonOptionsSingAllVisible].Selected) - StartRandomVisibleSongs(); - else if (Buttons[ButtonOptionsOpenSelectedItem].Selected) + else if (Buttons[_ButtonOptionsSingAll].Selected) + _StartRandomAllSongs(); + else if (Buttons[_ButtonOptionsSingAllVisible].Selected) + _StartRandomVisibleSongs(); + else if (Buttons[_ButtonOptionsOpenSelectedItem].Selected) _HandleSelectButton(); - else if (SelectSlides[SelectSlideOptionsPlaylistOpen].Selected) - OpenPlaylistAction(); - else if (Buttons[ButtonOptionsRandomMedley].Selected) - ToggleSongOptions(ESongOptionsView.Medley); - else if (Buttons[ButtonOptionsStartMedley].Selected) + else if (SelectSlides[_SelectSlideOptionsPlaylistOpen].Selected) + _OpenPlaylistAction(); + else if (Buttons[_ButtonOptionsRandomMedley].Selected) + _ToggleSongOptions(ESongOptionsView.Medley); + else if (Buttons[_ButtonOptionsStartMedley].Selected) { - ToggleSongOptions(ESongOptionsView.None); - StartRandomMedley(SelectSlides[SelectSlideOptionsNumMedleySongs].Selection + 1, !CSongs.IsInCategory); + _ToggleSongOptions(ESongOptionsView.None); + _StartRandomMedley(SelectSlides[_SelectSlideOptionsNumMedleySongs].Selection + 1, !CSongs.IsInCategory); } break; case Keys.Escape: case Keys.Back: case Keys.Space: - ToggleSongOptions(ESongOptionsView.None); + _ToggleSongOptions(ESongOptionsView.None); break; } } - if (keyEvent.ModSHIFT && (keyEvent.Key == Keys.Add || keyEvent.Key == Keys.PageUp)) + if (keyEvent.ModShift && (keyEvent.Key == Keys.Add || keyEvent.Key == Keys.PageUp)) { CConfig.PreviewMusicVolume = CConfig.PreviewMusicVolume + 5; if (CConfig.PreviewMusicVolume > 100) @@ -345,7 +345,7 @@ namespace Vocaluxe.Screens CConfig.SaveConfig(); ApplyVolume(); } - else if (keyEvent.ModSHIFT && (keyEvent.Key == Keys.Subtract || keyEvent.Key == Keys.PageDown)) + else if (keyEvent.ModShift && (keyEvent.Key == Keys.Subtract || keyEvent.Key == Keys.PageDown)) { CConfig.PreviewMusicVolume = CConfig.PreviewMusicVolume - 5; if (CConfig.PreviewMusicVolume < 0) @@ -357,36 +357,36 @@ namespace Vocaluxe.Screens return true; } - public override bool HandleMouse(MouseEvent mouseEvent) + public override bool HandleMouse(SMouseEvent mouseEvent) { base.HandleMouse(mouseEvent); - if (DragAndDropActive) + if (_DragAndDropActive) { - DragAndDropCover.Rect.X += mouseEvent.X - OldMousePosX; - DragAndDropCover.Rect.Y += mouseEvent.Y - OldMousePosY; + _DragAndDropCover.Rect.X += mouseEvent.X - _OldMousePosX; + _DragAndDropCover.Rect.Y += mouseEvent.Y - _OldMousePosY; } - OldMousePosX = mouseEvent.X; - OldMousePosY = mouseEvent.Y; + _OldMousePosX = mouseEvent.X; + _OldMousePosY = mouseEvent.Y; - if (Playlists[Playlist].Visible && Playlists[Playlist].IsMouseOver(mouseEvent)) + if (Playlists[_Playlist].Visible && Playlists[_Playlist].IsMouseOver(mouseEvent)) { _PlaylistActive = true; - Playlists[Playlist].Selected = _PlaylistActive; - SongMenus[SongMenu].SetActive(!_PlaylistActive); - ToggleSongOptions(ESongOptionsView.None); + Playlists[_Playlist].Selected = _PlaylistActive; + SongMenus[_SongMenu].SetActive(!_PlaylistActive); + _ToggleSongOptions(ESongOptionsView.None); } - else if (CHelper.IsInBounds(SongMenus[SongMenu].Rect, mouseEvent.X, mouseEvent.Y)) + else if (CHelper.IsInBounds(SongMenus[_SongMenu].Rect, mouseEvent.X, mouseEvent.Y)) { _PlaylistActive = false; - Playlists[Playlist].Selected = _PlaylistActive; - SongMenus[SongMenu].SetActive(!_PlaylistActive); + Playlists[_Playlist].Selected = _PlaylistActive; + SongMenus[_SongMenu].SetActive(!_PlaylistActive); } - if (Playlists[Playlist].Visible && _PlaylistActive) + if (Playlists[_Playlist].Visible && _PlaylistActive) { - if (Playlists[Playlist].HandleMouse(mouseEvent)) + if (Playlists[_Playlist].HandleMouse(mouseEvent)) return true; } @@ -395,7 +395,7 @@ namespace Vocaluxe.Screens { if (_SongOptionsActive) { - ToggleSongOptions(ESongOptionsView.None); + _ToggleSongOptions(ESongOptionsView.None); return true; } @@ -403,34 +403,34 @@ namespace Vocaluxe.Screens { _SearchActive = false; _SearchText = String.Empty; - ApplyNewSearchFilter(_SearchText); + _ApplyNewSearchFilter(_SearchText); return true; } - if (CSongs.Category < 0 && !_sso.Selection.PartyMode && !_SearchActive) + if (CSongs.Category < 0 && !_Sso.Selection.PartyMode && !_SearchActive) { CGraphics.FadeTo(EScreens.ScreenMain); return true; } } - if (mouseEvent.MB && !_sso.Selection.PartyMode) - return SelectNextRandom(-1); + if (mouseEvent.MB && !_Sso.Selection.PartyMode) + return _SelectNextRandom(-1); - if (mouseEvent.LD && !_sso.Selection.PartyMode) + if (mouseEvent.LD && !_Sso.Selection.PartyMode) { //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.NumVisibleSongs > 0 && SongMenus[_SongMenu].GetActualSelection() != -1) { - ToggleSongOptions(ESongOptionsView.None); - StartVisibleSong(SongMenus[SongMenu].GetActualSelection()); + _ToggleSongOptions(ESongOptionsView.None); + _StartVisibleSong(SongMenus[_SongMenu].GetActualSelection()); return true; } } - SongMenus[SongMenu].HandleMouse(ref mouseEvent, _sso); - UpdatePartyModeOptions(); + SongMenus[_SongMenu].HandleMouse(ref mouseEvent, _Sso); + _UpdatePartyModeOptions(); if (mouseEvent.Handled) return true; @@ -439,92 +439,92 @@ namespace Vocaluxe.Screens { if (IsMouseOver(mouseEvent)) { - if (Buttons[ButtonOpenOptions].Selected) + if (Buttons[_ButtonOpenOptions].Selected) { - ToggleSongOptions(ESongOptionsView.General); + _ToggleSongOptions(ESongOptionsView.General); return true; } - else if (Buttons[ButtonOptionsClose].Selected) + else if (Buttons[_ButtonOptionsClose].Selected) { - ToggleSongOptions(ESongOptionsView.None); + _ToggleSongOptions(ESongOptionsView.None); return true; } - else if (Buttons[ButtonOptionsSing].Selected) + else if (Buttons[_ButtonOptionsSing].Selected) { - ToggleSongOptions(ESongOptionsView.None); - StartSong(SongMenus[SongMenu].GetSelectedSong()); + _ToggleSongOptions(ESongOptionsView.None); + _StartSong(SongMenus[_SongMenu].GetSelectedSong()); return true; } - else if (Buttons[ButtonOptionsPlaylist].Selected) + else if (Buttons[_ButtonOptionsPlaylist].Selected) { - ToggleSongOptions(ESongOptionsView.None); - OpenAndAddPlaylistAction(); + _ToggleSongOptions(ESongOptionsView.None); + _OpenAndAddPlaylistAction(); return true; } - else if (Buttons[ButtonOptionsRandom].Selected) + else if (Buttons[_ButtonOptionsRandom].Selected) { if (CSongs.IsInCategory) { - SongMenus[SongMenu].SetSelectedSong(CSongs.GetRandomSong()); + SongMenus[_SongMenu].SetSelectedSong(CSongs.GetRandomSong()); return true; } } - else if (Buttons[ButtonOptionsRandomCategory].Selected) + else if (Buttons[_ButtonOptionsRandomCategory].Selected) { if (!CSongs.IsInCategory) { - SongMenus[SongMenu].SetSelectedCategory(CSongs.GetRandomCategory()); + SongMenus[_SongMenu].SetSelectedCategory(CSongs.GetRandomCategory()); return true; } } - else if (Buttons[ButtonOptionsSingAll].Selected) + else if (Buttons[_ButtonOptionsSingAll].Selected) { - ToggleSongOptions(ESongOptionsView.None); - StartRandomAllSongs(); + _ToggleSongOptions(ESongOptionsView.None); + _StartRandomAllSongs(); return true; } - else if (Buttons[ButtonOptionsSingAllVisible].Selected) + else if (Buttons[_ButtonOptionsSingAllVisible].Selected) { - ToggleSongOptions(ESongOptionsView.None); - StartRandomVisibleSongs(); + _ToggleSongOptions(ESongOptionsView.None); + _StartRandomVisibleSongs(); return true; } - else if (Buttons[ButtonOptionsOpenSelectedItem].Selected) + else if (Buttons[_ButtonOptionsOpenSelectedItem].Selected) { _HandleSelectButton(); return true; } - else if (SelectSlides[SelectSlideOptionsPlaylistOpen].ValueSelected) + else if (SelectSlides[_SelectSlideOptionsPlaylistOpen].ValueSelected) { - OpenPlaylistAction(); + _OpenPlaylistAction(); return true; } - else if (Buttons[ButtonOptionsRandomMedley].Selected) + else if (Buttons[_ButtonOptionsRandomMedley].Selected) { - ToggleSongOptions(ESongOptionsView.Medley); + _ToggleSongOptions(ESongOptionsView.Medley); return true; } - else if (Buttons[ButtonOptionsStartMedley].Selected) + else if (Buttons[_ButtonOptionsStartMedley].Selected) { - ToggleSongOptions(ESongOptionsView.None); - StartRandomMedley(SelectSlides[SelectSlideOptionsNumMedleySongs].Selection + 1, !CSongs.IsInCategory); + _ToggleSongOptions(ESongOptionsView.None); + _StartRandomMedley(SelectSlides[_SelectSlideOptionsNumMedleySongs].Selection + 1, !CSongs.IsInCategory); return true; } - else if (_sso.Selection.RandomOnly && _sso.Selection.NumJokers != null) + else if (_Sso.Selection.RandomOnly && _Sso.Selection.NumJokers != null) { - if (Buttons[ButtonStart].Selected) + if (Buttons[_ButtonStart].Selected) { - HandlePartySongSelection(SongMenus[SongMenu].GetSelectedSong()); + _HandlePartySongSelection(SongMenus[_SongMenu].GetSelectedSong()); return true; } - for (int i = 0; i < ButtonsJoker.Count; i++) + for (int i = 0; i < _ButtonsJoker.Count; i++) { - if (i < _sso.Selection.NumJokers.Length) + if (i < _Sso.Selection.NumJokers.Length) { - if (Buttons[ButtonsJoker[i]].Selected) + if (Buttons[_ButtonsJoker[i]].Selected) { - SelectNextRandom(i); + _SelectNextRandom(i); return true; } } @@ -532,16 +532,16 @@ namespace Vocaluxe.Screens } } - if (CSongs.NumVisibleSongs > 0 && SongMenus[SongMenu].GetActualSelection() != -1 && !_sso.Selection.PartyMode) + if (CSongs.NumVisibleSongs > 0 && SongMenus[_SongMenu].GetActualSelection() != -1 && !_Sso.Selection.PartyMode) { - if (SongMenus[SongMenu].GetSelectedSong() != -1 && !_SongOptionsActive) + if (SongMenus[_SongMenu].GetSelectedSong() != -1 && !_SongOptionsActive) { - ToggleSongOptions(ESongOptionsView.Song); + _ToggleSongOptions(ESongOptionsView.Song); return true; } else { - ToggleSongOptions(ESongOptionsView.None); + _ToggleSongOptions(ESongOptionsView.None); return true; } } @@ -549,21 +549,21 @@ namespace Vocaluxe.Screens if (mouseEvent.LBH) { - if (!DragAndDropActive && Playlists[Playlist].Visible && CSongs.NumVisibleSongs > 0 && SongMenus[SongMenu].GetActualSelection() != -1) + if (!_DragAndDropActive && Playlists[_Playlist].Visible && CSongs.NumVisibleSongs > 0 && SongMenus[_SongMenu].GetActualSelection() != -1) { - DragAndDropCover = SongMenus[SongMenu].GetSelectedSongCover(); - DragAndDropCover.Rect.Z = CSettings.ZNear; - Playlists[Playlist].DragAndDropSongID = CSongs.VisibleSongs[SongMenus[SongMenu].GetActualSelection()].ID; - DragAndDropActive = true; + _DragAndDropCover = SongMenus[_SongMenu].GetSelectedSongCover(); + _DragAndDropCover.Rect.Z = CSettings.ZNear; + Playlists[_Playlist].DragAndDropSongID = CSongs.VisibleSongs[SongMenus[_SongMenu].GetActualSelection()].ID; + _DragAndDropActive = true; return true; } } - if (!mouseEvent.LBH && DragAndDropActive) + if (!mouseEvent.LBH && _DragAndDropActive) { - DragAndDropActive = false; - Playlists[Playlist].DragAndDropSongID = -1; + _DragAndDropActive = false; + Playlists[_Playlist].DragAndDropSongID = -1; return true; } @@ -574,13 +574,13 @@ namespace Vocaluxe.Screens { if (CSongs.IsInCategory) { - if (!_sso.Selection.PartyMode) - ToggleSongOptions(ESongOptionsView.Song); + if (!_Sso.Selection.PartyMode) + _ToggleSongOptions(ESongOptionsView.Song); } - else if (_sso.Selection.CategoryChangeAllowed) + else if (_Sso.Selection.CategoryChangeAllowed) { - ToggleSongOptions(ESongOptionsView.None); - SongMenus[SongMenu].EnterCurrentCategory(); + _ToggleSongOptions(ESongOptionsView.None); + SongMenus[_SongMenu].EnterCurrentCategory(); } } @@ -588,72 +588,72 @@ namespace Vocaluxe.Screens { base.OnShow(); - SelectedSongID = -1; - SelectedCategoryIndex = -2; + _SelectedSongID = -1; + _SelectedCategoryIndex = -2; - _sso = CParty.GetSongSelectionOptions(); - CSongs.Sort(_sso.Sorting.SongSorting, _sso.Sorting.Tabs, _sso.Sorting.IgnoreArticles, _sso.Sorting.SearchString, _sso.Sorting.DuetOptions); - _SearchActive = _sso.Sorting.SearchActive; - _SearchText = _sso.Sorting.SearchString; + _Sso = CParty.GetSongSelectionOptions(); + CSongs.Sort(_Sso.Sorting.SongSorting, _Sso.Sorting.Tabs, _Sso.Sorting.IgnoreArticles, _Sso.Sorting.SearchString, _Sso.Sorting.DuetOptions); + _SearchActive = _Sso.Sorting.SearchActive; + _SearchText = _Sso.Sorting.SearchString; CGame.EnterNormalGame(); - SongMenus[SongMenu].OnShow(); + SongMenus[_SongMenu].OnShow(); - if (_sso.Selection.PartyMode) + if (_Sso.Selection.PartyMode) _PlaylistActive = false; - if (_sso.Selection.PartyMode) - ToggleSongOptions(ESongOptionsView.None); + if (_Sso.Selection.PartyMode) + _ToggleSongOptions(ESongOptionsView.None); - SongMenus[SongMenu].SetActive(!_PlaylistActive); - SongMenus[SongMenu].SetSmallView(Playlists[Playlist].Visible); + SongMenus[_SongMenu].SetActive(!_PlaylistActive); + SongMenus[_SongMenu].SetSmallView(Playlists[_Playlist].Visible); - if (Playlists[Playlist].ActivePlaylistID != -1) - Playlists[Playlist].LoadPlaylist(Playlists[Playlist].ActivePlaylistID); + if (Playlists[_Playlist].ActivePlaylistID != -1) + Playlists[_Playlist].LoadPlaylist(Playlists[_Playlist].ActivePlaylistID); - DragAndDropActive = false; - Playlists[Playlist].DragAndDropSongID = -1; + _DragAndDropActive = false; + Playlists[_Playlist].DragAndDropSongID = -1; UpdateGame(); } public override bool UpdateGame() { - if (SongMenus[SongMenu].IsSmallView()) + if (SongMenus[_SongMenu].IsSmallView()) CheckPlaylist(); - Texts[TextCategory].Text = CSongs.GetCurrentCategoryName(); + Texts[_TextCategory].Text = CSongs.GetCurrentCategoryName(); if (CSongs.Category > -1 || CConfig.Tabs == EOffOn.TR_CONFIG_OFF) CBackgroundMusic.Disabled = true; else CBackgroundMusic.Disabled = false; - int song = SongMenus[SongMenu].GetActualSelection(); + int song = SongMenus[_SongMenu].GetActualSelection(); if ((CSongs.Category >= 0 || CConfig.Tabs == EOffOn.TR_CONFIG_OFF) && song >= 0 && song < CSongs.VisibleSongs.Length) - Texts[TextSelection].Text = CSongs.VisibleSongs[song].Artist + " - " + CSongs.VisibleSongs[song].Title; + Texts[_TextSelection].Text = CSongs.VisibleSongs[song].Artist + " - " + CSongs.VisibleSongs[song].Title; else if (!CSongs.IsInCategory && song >= 0 && song < CSongs.Categories.Length) - Texts[TextSelection].Text = CSongs.Categories[song].Name; + Texts[_TextSelection].Text = CSongs.Categories[song].Name; else - Texts[TextSelection].Text = String.Empty; + Texts[_TextSelection].Text = String.Empty; - Texts[TextSearchBar].Text = _SearchText; + Texts[_TextSearchBar].Text = _SearchText; if (_SearchActive) { - Texts[TextSearchBar].Text += '|'; + Texts[_TextSearchBar].Text += '|'; - Texts[TextSearchBar].Visible = true; - Texts[TextSearchBarTitle].Visible = true; - Statics[StaticSearchBar].Visible = true; + Texts[_TextSearchBar].Visible = true; + Texts[_TextSearchBarTitle].Visible = true; + Statics[_StaticSearchBar].Visible = true; } else { - Texts[TextSearchBar].Visible = false; - Texts[TextSearchBarTitle].Visible = false; - Statics[StaticSearchBar].Visible = false; + Texts[_TextSearchBar].Visible = false; + Texts[_TextSearchBarTitle].Visible = false; + Statics[_StaticSearchBar].Visible = false; } - UpdatePartyModeOptions(); + _UpdatePartyModeOptions(); return true; } @@ -662,8 +662,8 @@ namespace Vocaluxe.Screens { base.Draw(); - if (DragAndDropActive) - DragAndDropCover.Draw(); + if (_DragAndDropActive) + _DragAndDropCover.Draw(); return true; } @@ -672,122 +672,122 @@ namespace Vocaluxe.Screens { base.OnClose(); CBackgroundMusic.Disabled = false; - SongMenus[SongMenu].OnHide(); + SongMenus[_SongMenu].OnHide(); } public override void ApplyVolume() { - SongMenus[SongMenu].ApplyVolume(CConfig.PreviewMusicVolume); + SongMenus[_SongMenu].ApplyVolume(CConfig.PreviewMusicVolume); } - private void HandlePartySongSelection(int SongNr) + private void _HandlePartySongSelection(int songNr) { - if ((CSongs.Category >= 0) && (SongNr >= 0)) + if ((CSongs.Category >= 0) && (songNr >= 0)) { - CSong song = CSongs.VisibleSongs[SongNr]; + CSong song = CSongs.VisibleSongs[songNr]; if (song != null) CParty.SongSelected(song.ID); } } - private void UpdatePartyModeOptions() + private void _UpdatePartyModeOptions() { if (!CSongs.IsInCategory) - SelectedSongID = -1; + _SelectedSongID = -1; - if (SelectedCategoryIndex != CSongs.Category) + if (_SelectedCategoryIndex != CSongs.Category) { - SelectedCategoryIndex = CSongs.Category; - CParty.OnCategoryChange(SelectedCategoryIndex, ref _sso); + _SelectedCategoryIndex = CSongs.Category; + CParty.OnCategoryChange(_SelectedCategoryIndex, ref _Sso); - if (_sso.Selection.SelectNextRandomSong) - SelectNextRandomSong(); + if (_Sso.Selection.SelectNextRandomSong) + _SelectNextRandomSong(); - if (_sso.Selection.SongIndex != -1) - SongMenus[SongMenu].SetSelectedSong(_sso.Selection.SongIndex); + if (_Sso.Selection.SongIndex != -1) + SongMenus[_SongMenu].SetSelectedSong(_Sso.Selection.SongIndex); } - if (SelectedSongID != SongMenus[SongMenu].GetSelectedSong() && CSongs.Category > -1) + if (_SelectedSongID != SongMenus[_SongMenu].GetSelectedSong() && CSongs.Category > -1) { - SelectedSongID = SongMenus[SongMenu].GetSelectedSong(); - CParty.OnSongChange(SelectedSongID, ref _sso); + _SelectedSongID = SongMenus[_SongMenu].GetSelectedSong(); + CParty.OnSongChange(_SelectedSongID, ref _Sso); } - _sso = CParty.GetSongSelectionOptions(); + _Sso = CParty.GetSongSelectionOptions(); - if (_sso.Selection.PartyMode) + if (_Sso.Selection.PartyMode) { - CSongs.Sort(_sso.Sorting.SongSorting, _sso.Sorting.Tabs, _sso.Sorting.IgnoreArticles, _sso.Sorting.SearchString, _sso.Sorting.DuetOptions); - _SearchActive = _sso.Sorting.SearchActive; - _SearchText = _sso.Sorting.SearchString; + CSongs.Sort(_Sso.Sorting.SongSorting, _Sso.Sorting.Tabs, _Sso.Sorting.IgnoreArticles, _Sso.Sorting.SearchString, _Sso.Sorting.DuetOptions); + _SearchActive = _Sso.Sorting.SearchActive; + _SearchText = _Sso.Sorting.SearchString; - ClosePlaylist(); - ToggleSongOptions(ESongOptionsView.None); + _ClosePlaylist(); + _ToggleSongOptions(ESongOptionsView.None); } - SongMenus[SongMenu].Update(_sso); + SongMenus[_SongMenu].Update(_Sso); - if (_sso.Selection.RandomOnly && _sso.Selection.NumJokers != null) + if (_Sso.Selection.RandomOnly && _Sso.Selection.NumJokers != null) { - Buttons[ButtonStart].Visible = true; + Buttons[_ButtonStart].Visible = true; - if (!SongMenus[SongMenu].IsSmallView()) - SongMenus[SongMenu].SetSmallView(true); + if (!SongMenus[_SongMenu].IsSmallView()) + SongMenus[_SongMenu].SetSmallView(true); for (int i = 0; i < CMain.Settings.GetMaxNumPlayer(); i++) { - if (i < _sso.Selection.NumJokers.Length) + if (i < _Sso.Selection.NumJokers.Length) { - Buttons[ButtonsJoker[i]].Visible = true; - Buttons[ButtonsJoker[i]].Text.Text = _sso.Selection.NumJokers[i].ToString(); - Texts[TextsPlayer[i]].Visible = true; + Buttons[_ButtonsJoker[i]].Visible = true; + Buttons[_ButtonsJoker[i]].Text.Text = _Sso.Selection.NumJokers[i].ToString(); + Texts[_TextsPlayer[i]].Visible = true; - bool NameExists = false; - if (_sso.Selection.TeamNames != null) + bool nameExists = false; + if (_Sso.Selection.TeamNames != null) { - if (_sso.Selection.TeamNames.Length > i) + if (_Sso.Selection.TeamNames.Length > i) { - Texts[TextsPlayer[i]].Text = _sso.Selection.TeamNames[i]; - NameExists = true; + Texts[_TextsPlayer[i]].Text = _Sso.Selection.TeamNames[i]; + nameExists = true; } } - if (!NameExists) - Texts[TextsPlayer[i]].Text = i.ToString(); + if (!nameExists) + Texts[_TextsPlayer[i]].Text = i.ToString(); } else { - Buttons[ButtonsJoker[i]].Visible = false; - Texts[TextsPlayer[i]].Visible = false; + Buttons[_ButtonsJoker[i]].Visible = false; + Texts[_TextsPlayer[i]].Visible = false; } } } else { - if (_sso.Selection.PartyMode && SongMenus[SongMenu].IsSmallView()) - SongMenus[SongMenu].SetSmallView(false); + if (_Sso.Selection.PartyMode && SongMenus[_SongMenu].IsSmallView()) + SongMenus[_SongMenu].SetSmallView(false); for (int i = 0; i < CMain.Settings.GetMaxNumPlayer(); i++) { - Buttons[ButtonsJoker[i]].Visible = false; - Texts[TextsPlayer[i]].Visible = false; + Buttons[_ButtonsJoker[i]].Visible = false; + Texts[_TextsPlayer[i]].Visible = false; } - Buttons[ButtonStart].Visible = false; + Buttons[_ButtonStart].Visible = false; } } - private void StartSong(int SongNr) + private void _StartSong(int songNr) { - if ((CSongs.Category >= 0) && (SongNr >= 0)) + if ((CSongs.Category >= 0) && (songNr >= 0)) { EGameMode gm; - if (_AvailableGameModes.Count >= SelectSlides[SelectSlideOptionsMode].Selection) - gm = _AvailableGameModes[SelectSlides[SelectSlideOptionsMode].Selection]; + if (_AvailableGameModes.Count >= SelectSlides[_SelectSlideOptionsMode].Selection) + gm = _AvailableGameModes[SelectSlides[_SelectSlideOptionsMode].Selection]; else { - if (CSongs.VisibleSongs[SongNr].IsDuet) + if (CSongs.VisibleSongs[songNr].IsDuet) gm = EGameMode.TR_GAMEMODE_DUET; else gm = EGameMode.TR_GAMEMODE_NORMAL; @@ -796,18 +796,18 @@ namespace Vocaluxe.Screens CGame.Reset(); CGame.ClearSongs(); - CGame.AddVisibleSong(SongNr, gm); + CGame.AddVisibleSong(songNr, gm); CGraphics.FadeTo(EScreens.ScreenNames); } } - private void StartVisibleSong(int SongNr) + private void _StartVisibleSong(int songNr) { - if (CSongs.Category >= 0 && SongNr >= 0 && CSongs.NumVisibleSongs > SongNr) + if (CSongs.Category >= 0 && songNr >= 0 && CSongs.NumVisibleSongs > songNr) { EGameMode gm; - if (CSongs.VisibleSongs[SongNr].IsDuet) + if (CSongs.VisibleSongs[songNr].IsDuet) gm = EGameMode.TR_GAMEMODE_DUET; else gm = EGameMode.TR_GAMEMODE_NORMAL; @@ -815,267 +815,267 @@ namespace Vocaluxe.Screens CGame.Reset(); CGame.ClearSongs(); - CGame.AddVisibleSong(SongNr, gm); + CGame.AddVisibleSong(songNr, gm); CGraphics.FadeTo(EScreens.ScreenNames); } } - private void StartMedleySong(int SongNr) + private void _StartMedleySong(int songNr) { - if ((CSongs.Category >= 0) && (SongNr >= 0)) + if ((CSongs.Category >= 0) && (songNr >= 0)) { EGameMode gm; - if (CSongs.VisibleSongs[SongNr].Medley.Source != EMedleySource.None) + if (CSongs.VisibleSongs[songNr].Medley.Source != EMedleySource.None) gm = EGameMode.TR_GAMEMODE_MEDLEY; else return; CGame.Reset(); CGame.ClearSongs(); - CGame.AddVisibleSong(SongNr, gm); + CGame.AddVisibleSong(songNr, gm); CGraphics.FadeTo(EScreens.ScreenNames); } } - private void StartRandomAllSongs() + private void _StartRandomAllSongs() { CGame.Reset(); CGame.ClearSongs(); - List IDs = new List(); + List iDs = new List(); for (int i = 0; i < CSongs.AllSongs.Length; i++) - IDs.Add(i); + iDs.Add(i); - while (IDs.Count > 0) + while (iDs.Count > 0) { - int SongNr = IDs[CGame.Rand.Next(IDs.Count)]; + int songNr = iDs[CGame.Rand.Next(iDs.Count)]; EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL; - if (CSongs.AllSongs[SongNr].IsDuet) + if (CSongs.AllSongs[songNr].IsDuet) gm = EGameMode.TR_GAMEMODE_DUET; - CGame.AddSong(SongNr, gm); + CGame.AddSong(songNr, gm); - IDs.Remove(SongNr); + iDs.Remove(songNr); } if (CGame.GetNumSongs() > 0) CGraphics.FadeTo(EScreens.ScreenNames); } - private void StartRandomVisibleSongs() + private void _StartRandomVisibleSongs() { CGame.Reset(); CGame.ClearSongs(); - List IDs = new List(); + List iDs = new List(); for (int i = 0; i < CSongs.VisibleSongs.Length; i++) - IDs.Add(CSongs.VisibleSongs[i].ID); + iDs.Add(CSongs.VisibleSongs[i].ID); - while (IDs.Count > 0) + while (iDs.Count > 0) { - int SongNr = IDs[CGame.Rand.Next(IDs.Count)]; + int songNr = iDs[CGame.Rand.Next(iDs.Count)]; EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL; - if (CSongs.AllSongs[SongNr].IsDuet) + if (CSongs.AllSongs[songNr].IsDuet) gm = EGameMode.TR_GAMEMODE_DUET; - CGame.AddSong(SongNr, gm); + CGame.AddSong(songNr, gm); - IDs.Remove(SongNr); + iDs.Remove(songNr); } if (CGame.GetNumSongs() > 0) CGraphics.FadeTo(EScreens.ScreenNames); } - private void StartRandomMedley(int NumSongs, bool AllSongs) + private void _StartRandomMedley(int numSongs, bool allSongs) { CGame.Reset(); CGame.ClearSongs(); - List IDs = new List(); - if (AllSongs) + List iDs = new List(); + if (allSongs) { for (int i = 0; i < CSongs.AllSongs.Length; i++) - IDs.Add(i); + iDs.Add(i); } else { for (int i = 0; i < CSongs.VisibleSongs.Length; i++) - IDs.Add(CSongs.VisibleSongs[i].ID); + iDs.Add(CSongs.VisibleSongs[i].ID); } int s = 0; - while (s < NumSongs && IDs.Count > 0) + while (s < numSongs && iDs.Count > 0) { - int SongNr = IDs[CGame.Rand.Next(IDs.Count)]; + int songNr = iDs[CGame.Rand.Next(iDs.Count)]; - foreach (EGameMode gm in CSongs.AllSongs[SongNr].AvailableGameModes) + foreach (EGameMode gm in CSongs.AllSongs[songNr].AvailableGameModes) { if (gm == EGameMode.TR_GAMEMODE_MEDLEY) { - CGame.AddSong(SongNr, gm); + CGame.AddSong(songNr, gm); s++; break; } } - IDs.Remove(SongNr); + iDs.Remove(songNr); } if (CGame.GetNumSongs() > 0) CGraphics.FadeTo(EScreens.ScreenNames); } - private bool SelectNextRandom(int TeamNr) + private bool _SelectNextRandom(int teamNr) { - if (TeamNr != -1 && _sso.Selection.RandomOnly && _sso.Selection.NumJokers != null) + if (teamNr != -1 && _Sso.Selection.RandomOnly && _Sso.Selection.NumJokers != null) { bool result = false; - if (_sso.Selection.NumJokers.Length > TeamNr) + if (_Sso.Selection.NumJokers.Length > teamNr) { - if (_sso.Selection.NumJokers[TeamNr] > 0) + if (_Sso.Selection.NumJokers[teamNr] > 0) { - result = SelectNextRandomSong() || SelectNextRandomCategory(); - CParty.JokerUsed(TeamNr); - _sso = CParty.GetSongSelectionOptions(); + result = _SelectNextRandomSong() || _SelectNextRandomCategory(); + CParty.JokerUsed(teamNr); + _Sso = CParty.GetSongSelectionOptions(); } } return result; } - if (TeamNr == -1) - return SelectNextRandomSong() || SelectNextRandomCategory(); + if (teamNr == -1) + return _SelectNextRandomSong() || _SelectNextRandomCategory(); return false; } - private bool SelectNextRandomSong() + private bool _SelectNextRandomSong() { if (CSongs.IsInCategory) { - ToggleSongOptions(ESongOptionsView.None); - SongMenus[SongMenu].SetSelectedSong(CSongs.GetRandomSong()); + _ToggleSongOptions(ESongOptionsView.None); + SongMenus[_SongMenu].SetSelectedSong(CSongs.GetRandomSong()); return true; } return false; } - private bool SelectNextRandomCategory() + private bool _SelectNextRandomCategory() { if (!CSongs.IsInCategory) { - ToggleSongOptions(ESongOptionsView.None); - SongMenus[SongMenu].SetSelectedCategory(CSongs.GetRandomCategory()); + _ToggleSongOptions(ESongOptionsView.None); + SongMenus[_SongMenu].SetSelectedCategory(CSongs.GetRandomCategory()); return true; } return false; } - private void JumpTo(char Letter) + private void _JumpTo(char letter) { int start = 0; - int curSelected = SongMenus[SongMenu].GetActualSelection(); + int curSelected = SongMenus[_SongMenu].GetActualSelection(); if (CSongs.IsInCategory) { //TODO: Check and use sorting method - CSong[] Songs = CSongs.VisibleSongs; - int ct = Songs.Length; + 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)) + 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)); + 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)); + visibleID = Array.FindIndex(songs, 0, start - 1, element => element.Artist.StartsWith(letter.ToString(), StringComparison.OrdinalIgnoreCase)); if (visibleID > -1) - SongMenus[SongMenu].SetSelectedSong(visibleID); + SongMenus[_SongMenu].SetSelectedSong(visibleID); } else { - CCategory[] Categories = CSongs.Categories; - int ct = Categories.Length; - if (curSelected >= 0 && curSelected < ct - 1 && Categories[curSelected].Name.StartsWith(Letter.ToString(), StringComparison.OrdinalIgnoreCase)) + CCategory[] categories = CSongs.Categories; + int ct = categories.Length; + 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)); + 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)); + visibleID = Array.FindIndex(categories, 0, start - 1, element => element.Name.StartsWith(letter.ToString(), StringComparison.OrdinalIgnoreCase)); if (visibleID > -1) - SongMenus[SongMenu].SetSelectedCategory(visibleID); + SongMenus[_SongMenu].SetSelectedCategory(visibleID); } } - private void ApplyNewSearchFilter(string NewFilterString) + private void _ApplyNewSearchFilter(string newFilterString) { - CParty.SetSearchString(NewFilterString, _SearchActive); - _sso = CParty.GetSongSelectionOptions(); + CParty.SetSearchString(newFilterString, _SearchActive); + _Sso = CParty.GetSongSelectionOptions(); bool refresh = false; - _SearchText = NewFilterString; + _SearchText = newFilterString; - int SongIndex = SongMenus[SongMenu].GetSelectedSong(); - int SongID = -1; - if (SongIndex != -1 && CSongs.NumVisibleSongs > 0 && CSongs.NumVisibleSongs > SongIndex) - SongID = CSongs.VisibleSongs[SongIndex].ID; + int songIndex = SongMenus[_SongMenu].GetSelectedSong(); + int songID = -1; + if (songIndex != -1 && CSongs.NumVisibleSongs > 0 && CSongs.NumVisibleSongs > songIndex) + songID = CSongs.VisibleSongs[songIndex].ID; - if (NewFilterString.Length == 0 && _sso.Sorting.Tabs == EOffOn.TR_CONFIG_ON) + if (newFilterString.Length == 0 && _Sso.Sorting.Tabs == EOffOn.TR_CONFIG_ON) { CSongs.Category = -1; refresh = true; } - if (NewFilterString.Length > 0 && CSongs.Category != 0) + if (newFilterString.Length > 0 && CSongs.Category != 0) { CSongs.Category = 0; refresh = true; } - CSongs.Sort(_sso.Sorting.SongSorting, _sso.Sorting.Tabs, _sso.Sorting.IgnoreArticles, NewFilterString, _sso.Sorting.DuetOptions); + 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.NumVisibleSongs == 0 || CSongs.NumVisibleSongs <= songIndex || CSongs.GetVisibleSongByIndex(songIndex).ID != songID) refresh = true; if (refresh) - SongMenus[SongMenu].OnHide(); + SongMenus[_SongMenu].OnHide(); - SongMenus[SongMenu].OnShow(); + SongMenus[_SongMenu].OnShow(); } - private void ToggleSongOptions(ESongOptionsView view) + private void _ToggleSongOptions(ESongOptionsView view) { - SelectSlides[SelectSlideOptionsMode].Visible = false; - SelectSlides[SelectSlideOptionsPlaylistAdd].Visible = false; - SelectSlides[SelectSlideOptionsPlaylistOpen].Visible = false; - SelectSlides[SelectSlideOptionsNumMedleySongs].Visible = false; - Buttons[ButtonOptionsClose].Visible = false; - Buttons[ButtonOptionsSing].Visible = false; - Buttons[ButtonOptionsPlaylist].Visible = false; - Buttons[ButtonOptionsRandom].Visible = false; - Buttons[ButtonOptionsRandomCategory].Visible = false; - Buttons[ButtonOptionsSingAll].Visible = false; - Buttons[ButtonOptionsSingAllVisible].Visible = false; - Buttons[ButtonOptionsOpenSelectedItem].Visible = false; - Buttons[ButtonOptionsRandomMedley].Visible = false; - Buttons[ButtonOptionsStartMedley].Visible = false; - Texts[TextOptionsTitle].Visible = false; - Statics[StaticOptionsBG].Visible = false; - Buttons[ButtonOpenOptions].Visible = true; + SelectSlides[_SelectSlideOptionsMode].Visible = false; + SelectSlides[_SelectSlideOptionsPlaylistAdd].Visible = false; + SelectSlides[_SelectSlideOptionsPlaylistOpen].Visible = false; + SelectSlides[_SelectSlideOptionsNumMedleySongs].Visible = false; + Buttons[_ButtonOptionsClose].Visible = false; + Buttons[_ButtonOptionsSing].Visible = false; + Buttons[_ButtonOptionsPlaylist].Visible = false; + Buttons[_ButtonOptionsRandom].Visible = false; + Buttons[_ButtonOptionsRandomCategory].Visible = false; + Buttons[_ButtonOptionsSingAll].Visible = false; + Buttons[_ButtonOptionsSingAllVisible].Visible = false; + Buttons[_ButtonOptionsOpenSelectedItem].Visible = false; + Buttons[_ButtonOptionsRandomMedley].Visible = false; + Buttons[_ButtonOptionsStartMedley].Visible = false; + Texts[_TextOptionsTitle].Visible = false; + Statics[_StaticOptionsBG].Visible = false; + Buttons[_ButtonOpenOptions].Visible = true; _SongOptionsActive = view != ESongOptionsView.None; if (_SongOptionsActive) { //Has to be done here otherwhise changed playlist names will not appear until OnShow is called! - UpdatePlaylistNames(); + _UpdatePlaylistNames(); - Texts[TextOptionsTitle].Visible = true; - Buttons[ButtonOptionsClose].Visible = true; - Statics[StaticOptionsBG].Visible = true; - Buttons[ButtonOpenOptions].Visible = false; + Texts[_TextOptionsTitle].Visible = true; + Buttons[_ButtonOptionsClose].Visible = true; + Statics[_StaticOptionsBG].Visible = true; + Buttons[_ButtonOpenOptions].Visible = false; if (view == ESongOptionsView.Song) _ShowSongOptionsSong(); else if (view == ESongOptionsView.General) @@ -1087,217 +1087,217 @@ namespace Vocaluxe.Screens private void _ShowSongOptionsSong() { - EGameMode LastMode = EGameMode.TR_GAMEMODE_NORMAL; + EGameMode lastMode = EGameMode.TR_GAMEMODE_NORMAL; if (_AvailableGameModes.Count > 0) - LastMode = _AvailableGameModes[SelectSlides[SelectSlideOptionsMode].Selection]; - SetInteractionToButton(Buttons[ButtonOptionsSing]); + lastMode = _AvailableGameModes[SelectSlides[_SelectSlideOptionsMode].Selection]; + SetInteractionToButton(Buttons[_ButtonOptionsSing]); _AvailableGameModes.Clear(); - SelectSlides[SelectSlideOptionsMode].Clear(); - if (CSongs.VisibleSongs[SongMenus[SongMenu].GetSelectedSong()].IsDuet) + SelectSlides[_SelectSlideOptionsMode].Clear(); + if (CSongs.VisibleSongs[SongMenus[_SongMenu].GetSelectedSong()].IsDuet) { - SelectSlides[SelectSlideOptionsMode].AddValue(Enum.GetName(typeof(EGameMode), EGameMode.TR_GAMEMODE_DUET)); + SelectSlides[_SelectSlideOptionsMode].AddValue(Enum.GetName(typeof(EGameMode), EGameMode.TR_GAMEMODE_DUET)); _AvailableGameModes.Add(EGameMode.TR_GAMEMODE_DUET); } else { - SelectSlides[SelectSlideOptionsMode].AddValue(Enum.GetName(typeof(EGameMode), EGameMode.TR_GAMEMODE_NORMAL)); + SelectSlides[_SelectSlideOptionsMode].AddValue(Enum.GetName(typeof(EGameMode), EGameMode.TR_GAMEMODE_NORMAL)); _AvailableGameModes.Add(EGameMode.TR_GAMEMODE_NORMAL); - SelectSlides[SelectSlideOptionsMode].AddValue(Enum.GetName(typeof(EGameMode), EGameMode.TR_GAMEMODE_SHORTSONG)); + SelectSlides[_SelectSlideOptionsMode].AddValue(Enum.GetName(typeof(EGameMode), EGameMode.TR_GAMEMODE_SHORTSONG)); _AvailableGameModes.Add(EGameMode.TR_GAMEMODE_SHORTSONG); } - if (CSongs.VisibleSongs[SongMenus[SongMenu].GetSelectedSong()].Medley.Source != EMedleySource.None) + if (CSongs.VisibleSongs[SongMenus[_SongMenu].GetSelectedSong()].Medley.Source != EMedleySource.None) { - SelectSlides[SelectSlideOptionsMode].AddValue(Enum.GetName(typeof(EGameMode), EGameMode.TR_GAMEMODE_MEDLEY)); + SelectSlides[_SelectSlideOptionsMode].AddValue(Enum.GetName(typeof(EGameMode), EGameMode.TR_GAMEMODE_MEDLEY)); _AvailableGameModes.Add(EGameMode.TR_GAMEMODE_MEDLEY); } //Set SelectSlide-Selection to last selected game-mode if possible for (int i = 0; i < _AvailableGameModes.Count; i++) { - if (_AvailableGameModes[i] == LastMode) - SelectSlides[SelectSlideOptionsMode].SetSelectionByValueIndex(i); + if (_AvailableGameModes[i] == lastMode) + SelectSlides[_SelectSlideOptionsMode].SetSelectionByValueIndex(i); } - SelectSlides[SelectSlideOptionsMode].Visible = true; - SelectSlides[SelectSlideOptionsPlaylistAdd].Visible = true; - Buttons[ButtonOptionsSing].Visible = true; - Buttons[ButtonOptionsPlaylist].Visible = true; - SetInteractionToButton(Buttons[ButtonOptionsSing]); + SelectSlides[_SelectSlideOptionsMode].Visible = true; + SelectSlides[_SelectSlideOptionsPlaylistAdd].Visible = true; + Buttons[_ButtonOptionsSing].Visible = true; + Buttons[_ButtonOptionsPlaylist].Visible = true; + SetInteractionToButton(Buttons[_ButtonOptionsSing]); } private void _ShowSongOptionsGeneral() { if (CSongs.IsInCategory) { - Buttons[ButtonOptionsRandom].Visible = true; - Buttons[ButtonOptionsSingAllVisible].Visible = true; + Buttons[_ButtonOptionsRandom].Visible = true; + Buttons[_ButtonOptionsSingAllVisible].Visible = true; } else - Buttons[ButtonOptionsRandomCategory].Visible = true; - Buttons[ButtonOptionsSingAll].Visible = true; - Buttons[ButtonOptionsRandomMedley].Visible = true; - Buttons[ButtonOptionsOpenSelectedItem].Visible = true; + Buttons[_ButtonOptionsRandomCategory].Visible = true; + Buttons[_ButtonOptionsSingAll].Visible = true; + Buttons[_ButtonOptionsRandomMedley].Visible = true; + Buttons[_ButtonOptionsOpenSelectedItem].Visible = true; - if (SelectSlides[SelectSlideOptionsPlaylistOpen].NumValues > 0) - SelectSlides[SelectSlideOptionsPlaylistOpen].Visible = true; + if (SelectSlides[_SelectSlideOptionsPlaylistOpen].NumValues > 0) + SelectSlides[_SelectSlideOptionsPlaylistOpen].Visible = true; - if (Buttons[ButtonOptionsRandom].Visible) - SetInteractionToButton(Buttons[ButtonOptionsRandom]); + if (Buttons[_ButtonOptionsRandom].Visible) + SetInteractionToButton(Buttons[_ButtonOptionsRandom]); else - SetInteractionToButton(Buttons[ButtonOptionsRandomCategory]); + SetInteractionToButton(Buttons[_ButtonOptionsRandomCategory]); } private void _ShowSongOptionsMedley() { - Buttons[ButtonOptionsStartMedley].Visible = true; - SelectSlides[SelectSlideOptionsNumMedleySongs].Visible = true; - SelectSlides[SelectSlideOptionsNumMedleySongs].Clear(); + Buttons[_ButtonOptionsStartMedley].Visible = true; + SelectSlides[_SelectSlideOptionsNumMedleySongs].Visible = true; + SelectSlides[_SelectSlideOptionsNumMedleySongs].Clear(); if (CSongs.IsInCategory) { for (int i = 1; i <= CSongs.VisibleSongs.Length; i++) - SelectSlides[SelectSlideOptionsNumMedleySongs].AddValue(i.ToString()); + SelectSlides[_SelectSlideOptionsNumMedleySongs].AddValue(i.ToString()); } else { for (int i = 1; i <= CSongs.AllSongs.Length; i++) - SelectSlides[SelectSlideOptionsNumMedleySongs].AddValue(i.ToString()); + SelectSlides[_SelectSlideOptionsNumMedleySongs].AddValue(i.ToString()); } - if (SelectSlides[SelectSlideOptionsNumMedleySongs].NumValues >= 5) - SelectSlides[SelectSlideOptionsNumMedleySongs].SetSelectionByValueIndex(4); + if (SelectSlides[_SelectSlideOptionsNumMedleySongs].NumValues >= 5) + SelectSlides[_SelectSlideOptionsNumMedleySongs].SetSelectionByValueIndex(4); else - SelectSlides[SelectSlideOptionsNumMedleySongs].SetSelectionByValueIndex(SelectSlides[SelectSlideOptionsNumMedleySongs].NumValues - 1); - SetInteractionToButton(Buttons[ButtonOptionsStartMedley]); + SelectSlides[_SelectSlideOptionsNumMedleySongs].SetSelectionByValueIndex(SelectSlides[_SelectSlideOptionsNumMedleySongs].NumValues - 1); + SetInteractionToButton(Buttons[_ButtonOptionsStartMedley]); } #region Playlist Actions public void CheckPlaylist() { - if (Playlists[Playlist].ActivePlaylistID == -1 && _PlaylistActive) - ClosePlaylist(); + if (Playlists[_Playlist].ActivePlaylistID == -1 && _PlaylistActive) + _ClosePlaylist(); } - private void OpenPlaylist(int PlaylistID) + private void _OpenPlaylist(int playlistID) { - if (CPlaylists.Playlists.Length > PlaylistID && PlaylistID > -1) + if (CPlaylists.Playlists.Length > playlistID && playlistID > -1) { - Playlists[Playlist].LoadPlaylist(PlaylistID); - SongMenus[SongMenu].SetSmallView(true); - Playlists[Playlist].Visible = true; + Playlists[_Playlist].LoadPlaylist(playlistID); + SongMenus[_SongMenu].SetSmallView(true); + Playlists[_Playlist].Visible = true; } } - private void ClosePlaylist() + private void _ClosePlaylist() { - if (Playlists[Playlist].Visible || _PlaylistActive) + if (Playlists[_Playlist].Visible || _PlaylistActive) { - SongMenus[SongMenu].SetSmallView(false); + SongMenus[_SongMenu].SetSmallView(false); _PlaylistActive = false; - Playlists[Playlist].Selected = _PlaylistActive; - SongMenus[SongMenu].SetActive(!_PlaylistActive); - Playlists[Playlist].ClosePlaylist(); + Playlists[_Playlist].Selected = _PlaylistActive; + SongMenus[_SongMenu].SetActive(!_PlaylistActive); + Playlists[_Playlist].ClosePlaylist(); } } - private void UpdatePlaylistNames() + private void _UpdatePlaylistNames() { - SelectSlides[SelectSlideOptionsPlaylistAdd].Clear(); - SelectSlides[SelectSlideOptionsPlaylistAdd].AddValue("TR_SCREENSONG_NEWPLAYLIST"); - SelectSlides[SelectSlideOptionsPlaylistAdd].AddValues(CPlaylists.PlaylistNames); - SelectSlides[SelectSlideOptionsPlaylistOpen].Clear(); - SelectSlides[SelectSlideOptionsPlaylistOpen].AddValues(CPlaylists.PlaylistNames); + SelectSlides[_SelectSlideOptionsPlaylistAdd].Clear(); + SelectSlides[_SelectSlideOptionsPlaylistAdd].AddValue("TR_SCREENSONG_NEWPLAYLIST"); + SelectSlides[_SelectSlideOptionsPlaylistAdd].AddValues(CPlaylists.PlaylistNames); + SelectSlides[_SelectSlideOptionsPlaylistOpen].Clear(); + SelectSlides[_SelectSlideOptionsPlaylistOpen].AddValues(CPlaylists.PlaylistNames); } - private void OpenPlaylistAction() + private void _OpenPlaylistAction() { //Open a playlist - if (Playlists[Playlist].ActivePlaylistID != SelectSlides[SelectSlideOptionsPlaylistOpen].Selection) + if (Playlists[_Playlist].ActivePlaylistID != SelectSlides[_SelectSlideOptionsPlaylistOpen].Selection) { - Playlists[Playlist].ActivePlaylistID = SelectSlides[SelectSlideOptionsPlaylistOpen].Selection; - SetSelectSlidePlaylistToCurrentPlaylist(); + Playlists[_Playlist].ActivePlaylistID = SelectSlides[_SelectSlideOptionsPlaylistOpen].Selection; + _SetSelectSlidePlaylistToCurrentPlaylist(); //Open playlist - OpenPlaylist(Playlists[Playlist].ActivePlaylistID); + _OpenPlaylist(Playlists[_Playlist].ActivePlaylistID); } } - private void OpenAndAddPlaylistAction() + private void _OpenAndAddPlaylistAction() { //Open an existing playlist and add song - if (Playlists[Playlist].ActivePlaylistID != (SelectSlides[SelectSlideOptionsPlaylistAdd].Selection - 1) && - (SelectSlides[SelectSlideOptionsPlaylistAdd].Selection - 1) != -1) + if (Playlists[_Playlist].ActivePlaylistID != (SelectSlides[_SelectSlideOptionsPlaylistAdd].Selection - 1) && + (SelectSlides[_SelectSlideOptionsPlaylistAdd].Selection - 1) != -1) { //Check selected game-mode EGameMode gm; - if (_AvailableGameModes.Count >= SelectSlides[SelectSlideOptionsMode].Selection) - gm = _AvailableGameModes[SelectSlides[SelectSlideOptionsMode].Selection]; - else if (CSongs.VisibleSongs[SongMenus[SongMenu].GetSelectedSong()].IsDuet) + if (_AvailableGameModes.Count >= SelectSlides[_SelectSlideOptionsMode].Selection) + gm = _AvailableGameModes[SelectSlides[_SelectSlideOptionsMode].Selection]; + else if (CSongs.VisibleSongs[SongMenus[_SongMenu].GetSelectedSong()].IsDuet) gm = EGameMode.TR_GAMEMODE_DUET; else gm = EGameMode.TR_GAMEMODE_NORMAL; //Check if Playlist really exists - if (SelectSlides[SelectSlideOptionsPlaylistAdd].Selection - 1 >= 0) + if (SelectSlides[_SelectSlideOptionsPlaylistAdd].Selection - 1 >= 0) { - Playlists[Playlist].ActivePlaylistID = SelectSlides[SelectSlideOptionsPlaylistAdd].Selection - 1; + Playlists[_Playlist].ActivePlaylistID = SelectSlides[_SelectSlideOptionsPlaylistAdd].Selection - 1; //Add song to playlist - CPlaylists.Playlists[Playlists[Playlist].ActivePlaylistID].AddSong(CSongs.VisibleSongs[SongMenus[SongMenu].GetSelectedSong()].ID, gm); + CPlaylists.Playlists[Playlists[_Playlist].ActivePlaylistID].AddSong(CSongs.VisibleSongs[SongMenus[_SongMenu].GetSelectedSong()].ID, gm); //Open playlist - OpenPlaylist(Playlists[Playlist].ActivePlaylistID); + _OpenPlaylist(Playlists[_Playlist].ActivePlaylistID); - SetSelectSlidePlaylistToCurrentPlaylist(); - Playlists[Playlist].ScrollToBottom(); + _SetSelectSlidePlaylistToCurrentPlaylist(); + Playlists[_Playlist].ScrollToBottom(); } } //Create a new playlist and add song - else if ((SelectSlides[SelectSlideOptionsPlaylistAdd].Selection - 1) == -1) + else if ((SelectSlides[_SelectSlideOptionsPlaylistAdd].Selection - 1) == -1) { //Check selected game-mode EGameMode gm; - if (_AvailableGameModes.Count >= SelectSlides[SelectSlideOptionsMode].Selection) - gm = _AvailableGameModes[SelectSlides[SelectSlideOptionsMode].Selection]; - else if (CSongs.VisibleSongs[SongMenus[SongMenu].GetSelectedSong()].IsDuet) + if (_AvailableGameModes.Count >= SelectSlides[_SelectSlideOptionsMode].Selection) + gm = _AvailableGameModes[SelectSlides[_SelectSlideOptionsMode].Selection]; + else if (CSongs.VisibleSongs[SongMenus[_SongMenu].GetSelectedSong()].IsDuet) gm = EGameMode.TR_GAMEMODE_DUET; else gm = EGameMode.TR_GAMEMODE_NORMAL; //Create new playlist - Playlists[Playlist].ActivePlaylistID = CPlaylists.NewPlaylist(); + Playlists[_Playlist].ActivePlaylistID = CPlaylists.NewPlaylist(); //Add song to playlist - CPlaylists.Playlists[Playlists[Playlist].ActivePlaylistID].AddSong(CSongs.VisibleSongs[SongMenus[SongMenu].GetSelectedSong()].ID, gm); + CPlaylists.Playlists[Playlists[_Playlist].ActivePlaylistID].AddSong(CSongs.VisibleSongs[SongMenus[_SongMenu].GetSelectedSong()].ID, gm); //Open playlist - OpenPlaylist(Playlists[Playlist].ActivePlaylistID); + _OpenPlaylist(Playlists[_Playlist].ActivePlaylistID); //Add new playlist to select-slide - SelectSlides[SelectSlideOptionsPlaylistAdd].AddValue(CPlaylists.Playlists[Playlists[Playlist].ActivePlaylistID].PlaylistName); - SelectSlides[SelectSlideOptionsPlaylistOpen].AddValue(CPlaylists.Playlists[Playlists[Playlist].ActivePlaylistID].PlaylistName); + SelectSlides[_SelectSlideOptionsPlaylistAdd].AddValue(CPlaylists.Playlists[Playlists[_Playlist].ActivePlaylistID].PlaylistName); + SelectSlides[_SelectSlideOptionsPlaylistOpen].AddValue(CPlaylists.Playlists[Playlists[_Playlist].ActivePlaylistID].PlaylistName); - SetSelectSlidePlaylistToCurrentPlaylist(); + _SetSelectSlidePlaylistToCurrentPlaylist(); } //Add song to loaded playlist else { //Check selected game-mode EGameMode gm; - if (_AvailableGameModes.Count >= SelectSlides[SelectSlideOptionsMode].Selection) - gm = _AvailableGameModes[SelectSlides[SelectSlideOptionsMode].Selection]; - else if (CSongs.VisibleSongs[SongMenus[SongMenu].GetSelectedSong()].IsDuet) + if (_AvailableGameModes.Count >= SelectSlides[_SelectSlideOptionsMode].Selection) + gm = _AvailableGameModes[SelectSlides[_SelectSlideOptionsMode].Selection]; + else if (CSongs.VisibleSongs[SongMenus[_SongMenu].GetSelectedSong()].IsDuet) gm = EGameMode.TR_GAMEMODE_DUET; else gm = EGameMode.TR_GAMEMODE_NORMAL; - CPlaylists.Playlists[Playlists[Playlist].ActivePlaylistID].AddSong(CSongs.VisibleSongs[SongMenus[SongMenu].GetSelectedSong()].ID, gm); - Playlists[Playlist].UpdatePlaylist(); - Playlists[Playlist].ScrollToBottom(); + CPlaylists.Playlists[Playlists[_Playlist].ActivePlaylistID].AddSong(CSongs.VisibleSongs[SongMenus[_SongMenu].GetSelectedSong()].ID, gm); + Playlists[_Playlist].UpdatePlaylist(); + Playlists[_Playlist].ScrollToBottom(); } } - private void SetSelectSlidePlaylistToCurrentPlaylist() + private void _SetSelectSlidePlaylistToCurrentPlaylist() { - if (Playlists[Playlist].ActivePlaylistID > -1) - SelectSlides[SelectSlideOptionsPlaylistAdd].Selection = Playlists[Playlist].ActivePlaylistID + 1; + if (Playlists[_Playlist].ActivePlaylistID > -1) + SelectSlides[_SelectSlideOptionsPlaylistAdd].Selection = Playlists[_Playlist].ActivePlaylistID + 1; else - SelectSlides[SelectSlideOptionsPlaylistAdd].Selection = 0; + SelectSlides[_SelectSlideOptionsPlaylistAdd].Selection = 0; } #endregion Playlist Actions } diff --git a/Vocaluxe/Screens/CScreenTest.cs b/Vocaluxe/Screens/CScreenTest.cs index 0a9c62e8..febd8ccf 100644 --- a/Vocaluxe/Screens/CScreenTest.cs +++ b/Vocaluxe/Screens/CScreenTest.cs @@ -16,7 +16,7 @@ namespace Vocaluxe.Screens private int _TestMusic = -1; - public override bool HandleInput(KeyEvent keyEvent) + public override bool HandleInput(SKeyEvent keyEvent) { if (keyEvent.KeyPressed && !Char.IsControl(keyEvent.Unicode)) {} else @@ -49,7 +49,7 @@ namespace Vocaluxe.Screens return true; } - public override bool HandleMouse(MouseEvent mouseEvent) + public override bool HandleMouse(SMouseEvent mouseEvent) { if (mouseEvent.LB && IsMouseOver(mouseEvent)) {} @@ -66,7 +66,7 @@ namespace Vocaluxe.Screens return true; } - private void PlayFile() + private void _PlayFile() { if (_TestMusic == -1) _TestMusic = CSound.Load(Path.Combine(Environment.CurrentDirectory, "Test.mp3")); @@ -75,12 +75,12 @@ namespace Vocaluxe.Screens CSound.Fade(_TestMusic, 100f, 2f); } - private void PauseFile() + private void _PauseFile() { CSound.Pause(_TestMusic); } - private void FadeAndPause() + private void _FadeAndPause() { CSound.FadeAndPause(_TestMusic, 0f, 2f); } diff --git a/Vocaluxe/Vocaluxe.csproj b/Vocaluxe/Vocaluxe.csproj index 8c8bb74a..337515e2 100644 --- a/Vocaluxe/Vocaluxe.csproj +++ b/Vocaluxe/Vocaluxe.csproj @@ -13,7 +13,7 @@ v4.0 512 false - Vocaluxe.MainProgram + Vocaluxe.CMainProgram Vocaluxe.ico Client publish\ diff --git a/VocaluxeLib/Menu/CBackground.cs b/VocaluxeLib/Menu/CBackground.cs index a70e0e70..a936bbb5 100644 --- a/VocaluxeLib/Menu/CBackground.cs +++ b/VocaluxeLib/Menu/CBackground.cs @@ -38,9 +38,9 @@ namespace VocaluxeLib.Menu } #region Constructors - public CBackground(int PartyModeID) + public CBackground(int partyModeID) { - _PartyModeID = PartyModeID; + _PartyModeID = partyModeID; _ThemeLoaded = false; _Theme = new SThemeBackground(); @@ -49,9 +49,9 @@ namespace VocaluxeLib.Menu #endregion Constructors #region public - public bool LoadTheme(string XmlPath, string ElementName, CXMLReader xmlReader, int SkinIndex) + public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex) { - string item = XmlPath + "/" + ElementName; + string item = xmlPath + "/" + elementName; _ThemeLoaded = true; _ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/Type", ref _Theme.Type); @@ -61,7 +61,7 @@ namespace VocaluxeLib.Menu _ThemeLoaded &= vid || tex || _Theme.Type == EBackgroundTypes.None; if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty)) - _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, SkinIndex, out Color); + _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out Color); else { bool success = true; @@ -76,7 +76,7 @@ namespace VocaluxeLib.Menu if (_ThemeLoaded) { - _Theme.Name = ElementName; + _Theme.Name = elementName; LoadTextures(); } return _ThemeLoaded; @@ -138,22 +138,22 @@ namespace VocaluxeLib.Menu CBase.BackgroundMusic.VideoEnabled() && !CBase.BackgroundMusic.IsDisabled()) { Pause(); - ok = DrawBackgroundMusicVideo(); + ok = _DrawBackgroundMusicVideo(); } else if (_Theme.Type == EBackgroundTypes.Video && CBase.Config.GetVideoBackgrounds() == EOffOn.TR_CONFIG_ON) { Resume(); - ok = DrawVideo(); + ok = _DrawVideo(); } if (_Theme.TextureName.Length > 0 && (_Theme.Type == EBackgroundTypes.Texture || (_Theme.Type == EBackgroundTypes.Video && (CBase.Config.GetVideoBackgrounds() == EOffOn.TR_CONFIG_OFF || !ok)))) - ok = DrawTexture(); + ok = _DrawTexture(); if (_Theme.Type == EBackgroundTypes.Color || _Theme.Type == EBackgroundTypes.Texture && !ok || (_Theme.Type == EBackgroundTypes.Video && CBase.Config.GetVideoBackgrounds() == EOffOn.TR_CONFIG_OFF && !ok)) - DrawColor(); + _DrawColor(); return true; } @@ -174,53 +174,53 @@ namespace VocaluxeLib.Menu #endregion public #region internal - private void DrawColor() + private void _DrawColor() { SRectF bounds = new SRectF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH(), CBase.Settings.GetZFar() / 4); CBase.Drawing.DrawColor(Color, bounds); } - private bool DrawTexture() + private bool _DrawTexture() { - STexture Texture = CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID); - if (Texture.height > 0) + STexture texture = CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID); + if (texture.Height > 0) { RectangleF bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH()); - RectangleF rect = new RectangleF(0f, 0f, Texture.width, Texture.height); + RectangleF rect = new RectangleF(0f, 0f, texture.Width, texture.Height); CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, EAspect.Crop); - CBase.Drawing.DrawTexture(Texture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CBase.Settings.GetZFar() / 4)); + CBase.Drawing.DrawTexture(texture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CBase.Settings.GetZFar() / 4)); return true; } return false; } - private bool DrawVideo() + private bool _DrawVideo() { - STexture VideoTexture = CBase.Theme.GetSkinVideoTexture(_Theme.VideoName, _PartyModeID); - if (VideoTexture.height > 0) + STexture videoTexture = CBase.Theme.GetSkinVideoTexture(_Theme.VideoName, _PartyModeID); + if (videoTexture.Height > 0) { RectangleF bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH()); - RectangleF rect = new RectangleF(0f, 0f, VideoTexture.width, VideoTexture.height); + RectangleF rect = new RectangleF(0f, 0f, videoTexture.Width, videoTexture.Height); CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, EAspect.Crop); - CBase.Drawing.DrawTexture(VideoTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CBase.Settings.GetZFar() / 4)); + CBase.Drawing.DrawTexture(videoTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CBase.Settings.GetZFar() / 4)); return true; } return false; } - private bool DrawBackgroundMusicVideo() + private bool _DrawBackgroundMusicVideo() { - STexture VideoTexture = CBase.BackgroundMusic.GetVideoTexture(); - if (VideoTexture.height > 0) + STexture videoTexture = CBase.BackgroundMusic.GetVideoTexture(); + if (videoTexture.Height > 0) { RectangleF bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH()); - RectangleF rect = new RectangleF(0f, 0f, VideoTexture.width, VideoTexture.height); + RectangleF rect = new RectangleF(0f, 0f, videoTexture.Width, videoTexture.Height); CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, EAspect.Crop); - CBase.Drawing.DrawTexture(VideoTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CBase.Settings.GetZFar() / 4)); + CBase.Drawing.DrawTexture(videoTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CBase.Settings.GetZFar() / 4)); return true; } return false; diff --git a/VocaluxeLib/Menu/CButton.cs b/VocaluxeLib/Menu/CButton.cs index ab3175ee..27761750 100644 --- a/VocaluxeLib/Menu/CButton.cs +++ b/VocaluxeLib/Menu/CButton.cs @@ -68,9 +68,9 @@ namespace VocaluxeLib.Menu return _Theme.Name; } - public CButton(int PartyModeID) + public CButton(int partyModeID) { - _PartyModeID = PartyModeID; + _PartyModeID = partyModeID; _Theme = new SThemeButton(); Rect = new SRectF(); Color = new SColorF(); @@ -128,9 +128,9 @@ namespace VocaluxeLib.Menu SelReflectionSpace = button.SelReflectionSpace; } - public bool LoadTheme(string XmlPath, string ElementName, CXMLReader xmlReader, int SkinIndex) + public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex) { - string item = XmlPath + "/" + ElementName; + string item = xmlPath + "/" + elementName; _ThemeLoaded = true; _ThemeLoaded &= xmlReader.GetValue(item + "/Skin", ref _Theme.TextureName, String.Empty); @@ -143,7 +143,7 @@ namespace VocaluxeLib.Menu _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref Rect.H); if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty)) - _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, SkinIndex, out Color); + _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out Color); else { _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref Color.R); @@ -153,7 +153,7 @@ namespace VocaluxeLib.Menu } if (xmlReader.GetValue(item + "/SColor", ref _Theme.SelColorName, String.Empty)) - _ThemeLoaded &= CBase.Theme.GetColor(_Theme.SelColorName, SkinIndex, out SelColor); + _ThemeLoaded &= CBase.Theme.GetColor(_Theme.SelColorName, skinIndex, out SelColor); else { _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SR", ref SelColor.R); @@ -162,12 +162,12 @@ namespace VocaluxeLib.Menu _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SA", ref SelColor.A); } - _ThemeLoaded &= Text.LoadTheme(item, "Text", xmlReader, SkinIndex, true); + _ThemeLoaded &= Text.LoadTheme(item, "Text", xmlReader, skinIndex, true); Text.Z = Rect.Z; if (xmlReader.ItemExists(item + "/SText")) { IsSelText = true; - _ThemeLoaded &= SelText.LoadTheme(item, "SText", xmlReader, SkinIndex, true); + _ThemeLoaded &= SelText.LoadTheme(item, "SText", xmlReader, skinIndex, true); SelText.Z = Rect.Z; } @@ -193,7 +193,7 @@ namespace VocaluxeLib.Menu if (_ThemeLoaded) { - _Theme.Name = ElementName; + _Theme.Name = elementName; LoadTextures(); } return _ThemeLoaded; @@ -285,16 +285,16 @@ namespace VocaluxeLib.Menu Draw(true); } - public void Draw(bool ForceDraw) + public void Draw(bool forceDraw) { - if (!Visible && CBase.Settings.GetGameState() != EGameState.EditTheme && !ForceDraw) + if (!Visible && CBase.Settings.GetGameState() != EGameState.EditTheme && !forceDraw) return; STexture texture = new STexture(-1); if (!Selected && !Pressed || !Enabled) { - if (Texture.index != -1) + if (Texture.Index != -1) texture = Texture; else texture = CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID); @@ -311,7 +311,7 @@ namespace VocaluxeLib.Menu } else if (!IsSelText) { - if (Texture.index != -1) + if (Texture.Index != -1) texture = Texture; else texture = CBase.Theme.GetSkinTexture(_Theme.SelTextureName, _PartyModeID); @@ -328,7 +328,7 @@ namespace VocaluxeLib.Menu } else if (IsSelText) { - if (SelTexture.index != -1) + if (SelTexture.Index != -1) texture = SelTexture; else texture = CBase.Theme.GetSkinTexture(_Theme.SelTextureName, _PartyModeID); diff --git a/VocaluxeLib/Menu/CEqualizer.cs b/VocaluxeLib/Menu/CEqualizer.cs index 469881d1..a496deb9 100644 --- a/VocaluxeLib/Menu/CEqualizer.cs +++ b/VocaluxeLib/Menu/CEqualizer.cs @@ -48,9 +48,9 @@ namespace VocaluxeLib.Menu private float[] _Bars; - public CEqualizer(int PartyModeID) + public CEqualizer(int partyModeID) { - _PartyModeID = PartyModeID; + _PartyModeID = partyModeID; _Theme = new SThemeEqualizer(); _ThemeLoaded = false; @@ -67,9 +67,9 @@ namespace VocaluxeLib.Menu ReflectionHeight = 0f; } - public bool LoadTheme(string XmlPath, string ElementName, CXMLReader xmlReader, int SkinIndex) + public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex) { - string item = XmlPath + "/" + ElementName; + string item = xmlPath + "/" + elementName; _ThemeLoaded = true; _ThemeLoaded &= xmlReader.GetValue(item + "/Skin", ref _Theme.TextureName, String.Empty); @@ -89,7 +89,7 @@ namespace VocaluxeLib.Menu _ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/DrawNegative", ref _Theme.DrawNegative); if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty)) - _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, SkinIndex, out Color); + _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out Color); else { _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref Color.R); @@ -99,7 +99,7 @@ namespace VocaluxeLib.Menu } if (xmlReader.GetValue(item + "/MaxColor", ref _Theme.MaxColorName, String.Empty)) - _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, SkinIndex, out Color); + _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out Color); else { _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/MaxR", ref MaxColor.R); @@ -120,7 +120,7 @@ namespace VocaluxeLib.Menu if (_ThemeLoaded) { - _Theme.Name = ElementName; + _Theme.Name = elementName; _Bars = new float[_Theme.NumBars]; for (int i = 0; i < _Bars.Length; i++) _Bars[i] = 0f; diff --git a/VocaluxeLib/Menu/CHelper.cs b/VocaluxeLib/Menu/CHelper.cs index 3c2e64b3..29297b0f 100644 --- a/VocaluxeLib/Menu/CHelper.cs +++ b/VocaluxeLib/Menu/CHelper.cs @@ -35,16 +35,16 @@ namespace VocaluxeLib.Menu /// public static string ListStrings(string[] str) { - string _Result = string.Empty; + string result = string.Empty; for (int i = 0; i < str.Length; i++) { - _Result += str[i]; + result += str[i]; if (i < str.Length - 1) - _Result += ", "; + result += ", "; } - return _Result; + return result; } public static int TryReadInt(StreamReader sr) @@ -73,54 +73,54 @@ namespace VocaluxeLib.Menu return 0; } - public static void SetRect(RectangleF Bounds, ref RectangleF Rect, float RectAspect, EAspect Aspect) + public static void SetRect(RectangleF bounds, ref RectangleF rect, float rectAspect, EAspect aspect) { - float rW = Bounds.Right - Bounds.Left; - float rH = Bounds.Bottom - Bounds.Top; + float rW = bounds.Right - bounds.Left; + float rH = bounds.Bottom - bounds.Top; float rA = rW / rH; - float ScaledWidth = rW; - float ScaledHeight = rH; + float scaledWidth = rW; + float scaledHeight = rH; - switch (Aspect) + switch (aspect) { case EAspect.Crop: - if (rA >= RectAspect) + if (rA >= rectAspect) { - ScaledWidth = rW; - ScaledHeight = rH * rA / RectAspect; + scaledWidth = rW; + scaledHeight = rH * rA / rectAspect; } else { - ScaledHeight = rH; - ScaledWidth = rW * RectAspect / rA; + scaledHeight = rH; + scaledWidth = rW * rectAspect / rA; } break; case EAspect.LetterBox: - if (RectAspect >= 1) + if (rectAspect >= 1) { - ScaledWidth = rW; - ScaledHeight = rH * rA / RectAspect; + scaledWidth = rW; + scaledHeight = rH * rA / rectAspect; } else { - ScaledHeight = rH; - ScaledWidth = rW * RectAspect / rA; + scaledHeight = rH; + scaledWidth = rW * rectAspect / rA; } break; default: - ScaledWidth = rW; - ScaledHeight = rH; + scaledWidth = rW; + scaledHeight = rH; break; } - float Left = (rW - ScaledWidth) / 2 + Bounds.Left; - float Rigth = Left + ScaledWidth; + float left = (rW - scaledWidth) / 2 + bounds.Left; + float rigth = left + scaledWidth; - float Upper = (rH - ScaledHeight) / 2 + Bounds.Top; - float Lower = Upper + ScaledHeight; + float upper = (rH - scaledHeight) / 2 + bounds.Top; + float lower = upper + scaledHeight; - Rect = new RectangleF(Left, Upper, Rigth - Left, Lower - Upper); + rect = new RectangleF(left, upper, rigth - left, lower - upper); } public static List ListFiles(string path, string cast) @@ -185,9 +185,9 @@ namespace VocaluxeLib.Menu return float.TryParse(value, NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign, NumberFormatInfo.InvariantInfo, out result); } - public static bool IsInBounds(SRectF bounds, MouseEvent MouseEvent) + public static bool IsInBounds(SRectF bounds, SMouseEvent mouseEvent) { - return IsInBounds(bounds, MouseEvent.X, MouseEvent.Y); + return IsInBounds(bounds, mouseEvent.X, mouseEvent.Y); } public static bool IsInBounds(SRectF bounds, int x, int y) @@ -198,9 +198,9 @@ namespace VocaluxeLib.Menu static class CEncoding { - public static Encoding GetEncoding(string EncodingName) + public static Encoding GetEncoding(string encodingName) { - switch (EncodingName) + switch (encodingName) { case "AUTO": return Encoding.Default; @@ -217,17 +217,17 @@ namespace VocaluxeLib.Menu } } - public static string GetEncodingName(Encoding Enc) + public static string GetEncodingName(Encoding enc) { - string Result = "UTF8"; + string result = "UTF8"; - if (Enc.CodePage == 1250) - Result = "CP1250"; + if (enc.CodePage == 1250) + result = "CP1250"; - if (Enc.CodePage == 1252) - Result = "CP1252"; + if (enc.CodePage == 1252) + result = "CP1252"; - return Result; + return result; } } } \ No newline at end of file diff --git a/VocaluxeLib/Menu/CLyric.cs b/VocaluxeLib/Menu/CLyric.cs index 627f02ea..e858284d 100644 --- a/VocaluxeLib/Menu/CLyric.cs +++ b/VocaluxeLib/Menu/CLyric.cs @@ -38,7 +38,7 @@ namespace VocaluxeLib.Menu private float _Z; private float _H; - private float _width; + private float _Width; private ELyricStyle _Style; private float _Alpha = 1f; @@ -83,9 +83,9 @@ namespace VocaluxeLib.Menu set { _Style = value; } } - public CLyric(int PartyModeID) + public CLyric(int partyModeID) { - _PartyModeID = PartyModeID; + _PartyModeID = partyModeID; _Theme = new SThemeLyrics(); _ThemeLoaded = false; Color = new SColorF(); @@ -96,16 +96,16 @@ namespace VocaluxeLib.Menu _Z = 0f; _MaxW = 1f; _H = 1f; - _width = 1f; + _Width = 1f; _Notes = new List(); _Text = new CText(_PartyModeID); _Style = ELyricStyle.Fill; } - public bool LoadTheme(string XmlPath, string ElementName, CXMLReader xmlReader, int SkinIndex) + public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex) { - string item = XmlPath + "/" + ElementName; + string item = xmlPath + "/" + elementName; _ThemeLoaded = true; _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/X", ref _X); @@ -115,7 +115,7 @@ namespace VocaluxeLib.Menu _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref _H); if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty)) - _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, SkinIndex, out Color); + _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out Color); else { _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref Color.R); @@ -125,7 +125,7 @@ namespace VocaluxeLib.Menu } if (xmlReader.GetValue(item + "/SColor", ref _Theme.SelColorName, String.Empty)) - _ThemeLoaded &= CBase.Theme.GetColor(_Theme.SelColorName, SkinIndex, out ColorProcessed); + _ThemeLoaded &= CBase.Theme.GetColor(_Theme.SelColorName, skinIndex, out ColorProcessed); else { _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SR", ref ColorProcessed.R); @@ -136,7 +136,7 @@ namespace VocaluxeLib.Menu if (_ThemeLoaded) { - _Theme.Name = ElementName; + _Theme.Name = elementName; LoadTextures(); _Text = new CText(_X, _Y, _Z, _H, _MaxW, EAlignment.Left, EStyle.Bold, "Normal", Color, String.Empty); } @@ -187,12 +187,12 @@ namespace VocaluxeLib.Menu return false; } - public void SetLine(CLine Line) + public void SetLine(CLine line) { _Notes.Clear(); - _width = 0f; - foreach (CNote note in Line.Notes) + _Width = 0f; + foreach (CNote note in line.Notes) { SNote n = new SNote(); @@ -209,7 +209,7 @@ namespace VocaluxeLib.Menu _Text.Style = EStyle.BoldItalic; RectangleF rect = CBase.Drawing.GetTextBounds(_Text); - _width += rect.Width; + _Width += rect.Width; _Notes.Add(n); } } @@ -221,38 +221,38 @@ namespace VocaluxeLib.Menu public float GetCurrentLyricPosX() { - return _X - _width / 2; + return _X - _Width / 2; } #region draw - public void Draw(float ActualBeat) + public void Draw(float actualBeat) { if (Visible || CBase.Settings.GetGameState() == EGameState.EditTheme) { switch (_Style) { case ELyricStyle.Fill: - DrawFill(ActualBeat); + _DrawFill(actualBeat); break; case ELyricStyle.Jump: - DrawJump(ActualBeat); + _DrawJump(actualBeat); break; case ELyricStyle.Slide: - DrawSlide(ActualBeat); + _DrawSlide(actualBeat); break; case ELyricStyle.Zoom: - DrawZoom(ActualBeat); + _DrawZoom(actualBeat); break; default: - DrawSlide(ActualBeat); + _DrawSlide(actualBeat); break; } } } - private void DrawSlide(float CurrentBeat) + private void _DrawSlide(float currentBeat) { - float x = _X - _width / 2; + float x = _X - _Width / 2; foreach (SNote note in _Notes) { @@ -264,9 +264,9 @@ namespace VocaluxeLib.Menu if (note.Type == ENoteType.Freestyle) _Text.Style = EStyle.BoldItalic; - if (CurrentBeat >= note.StartBeat) + if (currentBeat >= note.StartBeat) { - if (CurrentBeat <= note.EndBeat) + if (currentBeat <= note.EndBeat) { _Text.Color = ColorProcessed; @@ -276,9 +276,9 @@ namespace VocaluxeLib.Menu _Text.Draw(0f, 1f); else { - _Text.Draw(0f, (CurrentBeat - note.StartBeat) / diff); + _Text.Draw(0f, (currentBeat - note.StartBeat) / diff); _Text.Color = Color; - _Text.Draw((CurrentBeat - note.StartBeat) / diff, 1f); + _Text.Draw((currentBeat - note.StartBeat) / diff, 1f); } } else @@ -297,20 +297,20 @@ namespace VocaluxeLib.Menu } } - private void DrawZoom(float CurrentBeat) + private void _DrawZoom(float currentBeat) { - float x = _X - _width / 2; // most left position + float x = _X - _Width / 2; // most left position //find last active note - int last_note = -1; + int lastNote = -1; for (int i = 0; i < _Notes.Count; i++) { - if (CurrentBeat >= _Notes[i].StartBeat) - last_note = i; + if (currentBeat >= _Notes[i].StartBeat) + lastNote = i; } - int zoom_note = -1; - int end_beat = -1; + int zoomNote = -1; + int endBeat = -1; float zoomx = 0f; for (int note = 0; note < _Notes.Count; note++) @@ -323,23 +323,23 @@ namespace VocaluxeLib.Menu if (_Notes[note].Type == ENoteType.Freestyle) _Text.Style = EStyle.BoldItalic; - if (CurrentBeat >= _Notes[note].StartBeat) + if (currentBeat >= _Notes[note].StartBeat) { bool last = note == _Notes.Count - 1; int endbeat = _Notes[note].EndBeat; if (note < _Notes.Count - 1) endbeat = _Notes[note + 1].StartBeat - 1; - if (CurrentBeat <= endbeat) + if (currentBeat <= endbeat) { - zoom_note = note; - end_beat = endbeat; + zoomNote = note; + endBeat = endbeat; zoomx = _Text.X; } else { // already passed - if (note == last_note) + if (note == lastNote) _Text.Color = ColorProcessed; else _Text.Color = Color; @@ -357,26 +357,26 @@ namespace VocaluxeLib.Menu x += rect.Width; } - if (zoom_note > -1) + if (zoomNote > -1) { - if (_Notes[zoom_note].Duration == 0) + if (_Notes[zoomNote].Duration == 0) return; _Text.X = zoomx; - _Text.Text = _Notes[zoom_note].Text; + _Text.Text = _Notes[zoomNote].Text; _Text.Color = ColorProcessed; _Text.Style = EStyle.Bold; - if (_Notes[zoom_note].Type == ENoteType.Freestyle) + if (_Notes[zoomNote].Type == ENoteType.Freestyle) _Text.Style = EStyle.BoldItalic; RectangleF rect = CBase.Drawing.GetTextBounds(_Text); - float diff = end_beat - _Notes[zoom_note].StartBeat; + float diff = endBeat - _Notes[zoomNote].StartBeat; if (diff <= 0f) diff = 1f; - float p = (CurrentBeat - _Notes[zoom_note].StartBeat) / diff; + float p = (currentBeat - _Notes[zoomNote].StartBeat) / diff; if (p > 1f) p = 1f; @@ -402,9 +402,9 @@ namespace VocaluxeLib.Menu } } - private void DrawFill(float CurrentBeat) + private void _DrawFill(float currentBeat) { - float x = _X - _width / 2; // most left position + float x = _X - _Width / 2; // most left position foreach (SNote note in _Notes) { @@ -416,7 +416,7 @@ namespace VocaluxeLib.Menu if (note.Type == ENoteType.Freestyle) _Text.Style = EStyle.BoldItalic; - if (CurrentBeat >= note.StartBeat) + if (currentBeat >= note.StartBeat) { _Text.Color = ColorProcessed; _Text.Draw(); @@ -432,20 +432,20 @@ namespace VocaluxeLib.Menu } } - private void DrawJump(float CurrentBeat) + private void _DrawJump(float currentBeat) { - float x = _X - _width / 2; // most left position + float x = _X - _Width / 2; // most left position //find last active note - int last_note = -1; + int lastNote = -1; for (int i = 0; i < _Notes.Count; i++) { - if (CurrentBeat >= _Notes[i].StartBeat) - last_note = i; + if (currentBeat >= _Notes[i].StartBeat) + lastNote = i; } - int jump_note = -1; - int end_beat = -1; + int jumpNote = -1; + int endBeat = -1; float jumpx = 0f; for (int note = 0; note < _Notes.Count; note++) @@ -458,23 +458,23 @@ namespace VocaluxeLib.Menu if (_Notes[note].Type == ENoteType.Freestyle) _Text.Style = EStyle.BoldItalic; - if (CurrentBeat >= _Notes[note].StartBeat) + if (currentBeat >= _Notes[note].StartBeat) { bool last = note == _Notes.Count - 1; int endbeat = _Notes[note].EndBeat; if (note < _Notes.Count - 1) endbeat = _Notes[note + 1].StartBeat - 1; - if (CurrentBeat <= _Notes[note].EndBeat) + if (currentBeat <= _Notes[note].EndBeat) { - jump_note = note; - end_beat = endbeat; + jumpNote = note; + endBeat = endbeat; jumpx = _Text.X; } else { // already passed - if (note == last_note) + if (note == lastNote) _Text.Color = ColorProcessed; else _Text.Color = Color; @@ -492,24 +492,24 @@ namespace VocaluxeLib.Menu x += rect.Width; } - if (jump_note > -1) + if (jumpNote > -1) { - if (_Notes[jump_note].Duration == 0) + if (_Notes[jumpNote].Duration == 0) return; _Text.X = jumpx; - _Text.Text = _Notes[jump_note].Text; + _Text.Text = _Notes[jumpNote].Text; _Text.Color = ColorProcessed; _Text.Style = EStyle.Bold; - if (_Notes[jump_note].Type == ENoteType.Freestyle) + if (_Notes[jumpNote].Type == ENoteType.Freestyle) _Text.Style = EStyle.BoldItalic; - float diff = _Notes[jump_note].EndBeat - _Notes[jump_note].StartBeat; + float diff = _Notes[jumpNote].EndBeat - _Notes[jumpNote].StartBeat; if (diff <= 0f) diff = 1f; - float p = (CurrentBeat - _Notes[jump_note].StartBeat) / diff; + float p = (currentBeat - _Notes[jumpNote].StartBeat) / diff; if (p > 1f) p = 1f; diff --git a/VocaluxeLib/Menu/CMenu.cs b/VocaluxeLib/Menu/CMenu.cs index 516663c7..8f00d04a 100644 --- a/VocaluxeLib/Menu/CMenu.cs +++ b/VocaluxeLib/Menu/CMenu.cs @@ -10,10 +10,10 @@ using VocaluxeLib.Menu.SongMenu; namespace VocaluxeLib.Menu { - struct ZSort + struct SZSort { public int ID; - public float z; + public float Z; } public abstract class CMenu : IMenu @@ -124,60 +124,60 @@ namespace VocaluxeLib.Menu _ThemeScreenSettings = null; } - protected void FadeTo(EScreens NextScreen) + protected void _FadeTo(EScreens nextScreen) { - CBase.Graphics.FadeTo(NextScreen); + CBase.Graphics.FadeTo(nextScreen); } #region ThemeHandler - protected delegate void AddElementHandler(T Element, String key); + protected delegate void AddElementHandler(T element, String key); - private void LoadThemeElement(string[] Elements, AddElementHandler AddElementHandler, CXMLReader xmlReader, int SkinIndex) where T : IMenuElement + private void _LoadThemeElement(string[] elements, AddElementHandler addElementHandler, CXMLReader xmlReader, int skinIndex) where T : IMenuElement { - if (Elements != null) + if (elements != null) { - foreach (string elName in Elements) + foreach (string elName in elements) { - T Element = (T)Activator.CreateInstance(typeof(T), _PartyModeID); - if (Element.LoadTheme("//root/" + ThemeName, elName, xmlReader, SkinIndex)) - AddElementHandler(Element, elName); + T element = (T)Activator.CreateInstance(typeof(T), _PartyModeID); + if (element.LoadTheme("//root/" + ThemeName, elName, xmlReader, skinIndex)) + addElementHandler(element, elName); else CBase.Log.LogError("Can't load " + typeof(T).Name.Substring(1) + " \"" + elName + "\" in screen " + ThemeName); } } } - public virtual void LoadTheme(string XmlPath) + public virtual void LoadTheme(string xmlPath) { - string file = Path.Combine(XmlPath, ThemeName + ".xml"); + string file = Path.Combine(xmlPath, ThemeName + ".xml"); CXMLReader xmlReader = CXMLReader.OpenFile(file); if (xmlReader == null) return; - bool VersionCheck = false; - VersionCheck = CheckVersion(_ScreenVersion, xmlReader); + bool versionCheck = false; + versionCheck = _CheckVersion(_ScreenVersion, xmlReader); - int SkinIndex = CBase.Theme.GetSkinIndex(_PartyModeID); + int skinIndex = CBase.Theme.GetSkinIndex(_PartyModeID); - if (VersionCheck && SkinIndex != -1) + if (versionCheck && skinIndex != -1) { - _ThemePath = XmlPath; - LoadThemeBasics(xmlReader, SkinIndex); + _ThemePath = xmlPath; + _LoadThemeBasics(xmlReader, skinIndex); - LoadThemeElement(_ThemeBackgrounds, AddBackground, xmlReader, SkinIndex); - LoadThemeElement(_ThemeStatics, AddStatic, xmlReader, SkinIndex); - LoadThemeElement(_ThemeTexts, AddText, xmlReader, SkinIndex); - LoadThemeElement(_ThemeButtons, AddButton, xmlReader, SkinIndex); - LoadThemeElement(_ThemeSelectSlides, AddSelectSlide, xmlReader, SkinIndex); - LoadThemeElement(_ThemeSongMenus, AddSongMenu, xmlReader, SkinIndex); - LoadThemeElement(_ThemeLyrics, AddLyric, xmlReader, SkinIndex); - LoadThemeElement(_ThemeSingNotes, AddSingNote, xmlReader, SkinIndex); - LoadThemeElement(_ThemeNameSelections, AddNameSelection, xmlReader, SkinIndex); - LoadThemeElement(_ThemeEqualizers, AddEqualizer, xmlReader, SkinIndex); - LoadThemeElement(_ThemePlaylists, AddPlaylist, xmlReader, SkinIndex); - LoadThemeElement(_ThemeParticleEffects, AddParticleEffect, xmlReader, SkinIndex); - LoadThemeElement(_ThemeScreenSettings, AddScreenSetting, xmlReader, SkinIndex); + _LoadThemeElement(_ThemeBackgrounds, AddBackground, xmlReader, skinIndex); + _LoadThemeElement(_ThemeStatics, AddStatic, xmlReader, skinIndex); + _LoadThemeElement(_ThemeTexts, AddText, xmlReader, skinIndex); + _LoadThemeElement(_ThemeButtons, AddButton, xmlReader, skinIndex); + _LoadThemeElement(_ThemeSelectSlides, AddSelectSlide, xmlReader, skinIndex); + _LoadThemeElement(_ThemeSongMenus, AddSongMenu, xmlReader, skinIndex); + _LoadThemeElement(_ThemeLyrics, AddLyric, xmlReader, skinIndex); + _LoadThemeElement(_ThemeSingNotes, AddSingNote, xmlReader, skinIndex); + _LoadThemeElement(_ThemeNameSelections, AddNameSelection, xmlReader, skinIndex); + _LoadThemeElement(_ThemeEqualizers, AddEqualizer, xmlReader, skinIndex); + _LoadThemeElement(_ThemePlaylists, AddPlaylist, xmlReader, skinIndex); + _LoadThemeElement(_ThemeParticleEffects, AddParticleEffect, xmlReader, skinIndex); + _LoadThemeElement(_ThemeScreenSettings, AddScreenSetting, xmlReader, skinIndex); } } @@ -347,14 +347,14 @@ namespace VocaluxeLib.Menu se.UnloadTextures(); } - public virtual void ReloadTheme(string XmlPath) + public virtual void ReloadTheme(string xmlPath) { if (_ThemePath.Length == 0) return; UnloadTextures(); Init(); - LoadTheme(XmlPath); + LoadTheme(xmlPath); } #endregion ThemeHandler @@ -468,9 +468,9 @@ namespace VocaluxeLib.Menu return new CStatic(oldStatic); } - public CStatic GetNewStatic(STexture Texture, SColorF Color, SRectF Rect) + public CStatic GetNewStatic(STexture texture, SColorF color, SRectF rect) { - return new CStatic(_PartyModeID, Texture, Color, Rect); + return new CStatic(_PartyModeID, texture, color, rect); } public CSelectSlide GetNewSelectSlide() @@ -513,9 +513,9 @@ namespace VocaluxeLib.Menu return new CPlaylist(_PartyModeID); } - public CParticleEffect GetNewParticleEffect(int MaxNumber, SColorF Color, SRectF Area, STexture Texture, float Size, EParticleType Type) + public CParticleEffect GetNewParticleEffect(int maxNumber, SColorF color, SRectF area, STexture texture, float size, EParticleType type) { - return new CParticleEffect(_PartyModeID, MaxNumber, Color, Area, Texture, Size, Type); + return new CParticleEffect(_PartyModeID, maxNumber, color, area, texture, size, type); } #endregion Create Elements @@ -589,7 +589,7 @@ namespace VocaluxeLib.Menu #endregion ElementHandler #region MenuHandler - public virtual bool HandleInput(KeyEvent keyEvent) + public virtual bool HandleInput(SKeyEvent keyEvent) { if (!CBase.Settings.IsTabNavigation()) { @@ -632,7 +632,7 @@ namespace VocaluxeLib.Menu return true; } - public virtual bool HandleMouse(MouseEvent mouseEvent) + public virtual bool HandleMouse(SMouseEvent mouseEvent) { int selection = _Selection; ProcessMouseMove(mouseEvent.X, mouseEvent.Y); @@ -651,56 +651,56 @@ namespace VocaluxeLib.Menu return true; } - public virtual bool HandleInputThemeEditor(KeyEvent KeyEvent) + public virtual bool HandleInputThemeEditor(SKeyEvent keyEvent) { _UnsetHighlighted(_Selection); - if (!KeyEvent.KeyPressed) + if (!keyEvent.KeyPressed) { - switch (KeyEvent.Key) + switch (keyEvent.Key) { case Keys.S: CBase.Graphics.SaveTheme(); break; case Keys.R: - ReloadThemeEditMode(); + _ReloadThemeEditMode(); break; case Keys.Up: - if (KeyEvent.Mod == EModifier.Ctrl) - MoveElement(0, -1); + if (keyEvent.Mod == EModifier.Ctrl) + _MoveElement(0, -1); - if (KeyEvent.Mod == EModifier.Shift) - ResizeElement(0, 1); + if (keyEvent.Mod == EModifier.Shift) + _ResizeElement(0, 1); break; case Keys.Down: - if (KeyEvent.Mod == EModifier.Ctrl) - MoveElement(0, 1); + if (keyEvent.Mod == EModifier.Ctrl) + _MoveElement(0, 1); - if (KeyEvent.Mod == EModifier.Shift) - ResizeElement(0, -1); + if (keyEvent.Mod == EModifier.Shift) + _ResizeElement(0, -1); break; case Keys.Right: - if (KeyEvent.Mod == EModifier.Ctrl) - MoveElement(1, 0); + if (keyEvent.Mod == EModifier.Ctrl) + _MoveElement(1, 0); - if (KeyEvent.Mod == EModifier.Shift) - ResizeElement(1, 0); + if (keyEvent.Mod == EModifier.Shift) + _ResizeElement(1, 0); - if (KeyEvent.Mod == EModifier.None) + if (keyEvent.Mod == EModifier.None) NextInteraction(); break; case Keys.Left: - if (KeyEvent.Mod == EModifier.Ctrl) - MoveElement(-1, 0); + if (keyEvent.Mod == EModifier.Ctrl) + _MoveElement(-1, 0); - if (KeyEvent.Mod == EModifier.Shift) - ResizeElement(-1, 0); + if (keyEvent.Mod == EModifier.Shift) + _ResizeElement(-1, 0); - if (KeyEvent.Mod == EModifier.None) + if (keyEvent.Mod == EModifier.None) PrevInteraction(); break; } @@ -708,64 +708,64 @@ namespace VocaluxeLib.Menu return true; } - public virtual bool HandleMouseThemeEditor(MouseEvent MouseEvent) + public virtual bool HandleMouseThemeEditor(SMouseEvent mouseEvent) { _UnsetHighlighted(_Selection); - _MouseDX = MouseEvent.X - _PrevMouseX; - _MouseDY = MouseEvent.Y - _PrevMouseY; + _MouseDX = mouseEvent.X - _PrevMouseX; + _MouseDY = mouseEvent.Y - _PrevMouseY; int stepX = 0; int stepY = 0; - if ((MouseEvent.Mod & EModifier.Ctrl) == EModifier.Ctrl) + if ((mouseEvent.Mod & EModifier.Ctrl) == EModifier.Ctrl) { - _PrevMouseX = MouseEvent.X; - _PrevMouseY = MouseEvent.Y; + _PrevMouseX = mouseEvent.X; + _PrevMouseY = mouseEvent.Y; } else { - while (Math.Abs(MouseEvent.X - _PrevMouseX) >= 5) + while (Math.Abs(mouseEvent.X - _PrevMouseX) >= 5) { - if (MouseEvent.X - _PrevMouseX >= 5) + if (mouseEvent.X - _PrevMouseX >= 5) stepX += 5; - if (MouseEvent.X - _PrevMouseX <= -5) + if (mouseEvent.X - _PrevMouseX <= -5) stepX -= 5; - _PrevMouseX = MouseEvent.X - (_MouseDX - stepX); + _PrevMouseX = mouseEvent.X - (_MouseDX - stepX); } - while (Math.Abs(MouseEvent.Y - _PrevMouseY) >= 5) + while (Math.Abs(mouseEvent.Y - _PrevMouseY) >= 5) { - if (MouseEvent.Y - _PrevMouseY >= 5) + if (mouseEvent.Y - _PrevMouseY >= 5) stepY += 5; - if (MouseEvent.Y - _PrevMouseY <= -5) + if (mouseEvent.Y - _PrevMouseY <= -5) stepY -= 5; - _PrevMouseY = MouseEvent.Y - (_MouseDY - stepY); + _PrevMouseY = mouseEvent.Y - (_MouseDY - stepY); } } - if (MouseEvent.LBH) + if (mouseEvent.LBH) { //if (IsMouseOver(MouseEvent.X, _PrevMouseY)) //{ - if (MouseEvent.Mod == EModifier.None) - MoveElement(stepX, stepY); + if (mouseEvent.Mod == EModifier.None) + _MoveElement(stepX, stepY); - if (MouseEvent.Mod == EModifier.Ctrl) - MoveElement(_MouseDX, _MouseDY); + if (mouseEvent.Mod == EModifier.Ctrl) + _MoveElement(_MouseDX, _MouseDY); - if (MouseEvent.Mod == EModifier.Shift) - ResizeElement(stepX, stepY); + if (mouseEvent.Mod == EModifier.Shift) + _ResizeElement(stepX, stepY); - if (MouseEvent.Mod == (EModifier.Shift | EModifier.Ctrl)) - ResizeElement(_MouseDX, _MouseDY); + if (mouseEvent.Mod == (EModifier.Shift | EModifier.Ctrl)) + _ResizeElement(_MouseDX, _MouseDY); //} } else - ProcessMouseMove(MouseEvent.X, MouseEvent.Y); + ProcessMouseMove(mouseEvent.X, mouseEvent.Y); return true; } @@ -776,29 +776,29 @@ namespace VocaluxeLib.Menu public virtual void OnShow() { - ResumeBG(); + _ResumeBG(); } public virtual void OnShowFinish() { - ResumeBG(); + _ResumeBG(); _Active = true; } public virtual void OnClose() { - PauseBG(); + _PauseBG(); _Active = false; } #endregion MenuHandler - protected void ResumeBG() + protected void _ResumeBG() { foreach (CBackground bg in _Backgrounds) bg.Resume(); } - protected void PauseBG() + protected void _PauseBG() { foreach (CBackground bg in _Backgrounds) bg.Pause(); @@ -823,7 +823,7 @@ namespace VocaluxeLib.Menu if (_Interactions.Count <= 0) return; - List items = new List(); + List items = new List(); for (int i = 0; i < _Interactions.Count; i++) { @@ -838,9 +838,9 @@ namespace VocaluxeLib.Menu _Interactions[i].Type == EType.Playlist || _Interactions[i].Type == EType.ParticleEffect)) { - ZSort zs = new ZSort(); + SZSort zs = new SZSort(); zs.ID = i; - zs.z = _GetZValue(i); + zs.Z = _GetZValue(i); items.Add(zs); } } @@ -849,7 +849,7 @@ namespace VocaluxeLib.Menu return; - items.Sort(delegate(ZSort s1, ZSort s2) { return s2.z.CompareTo(s1.z); }); + items.Sort(delegate(SZSort s1, SZSort s2) { return s2.Z.CompareTo(s1.Z); }); for (int i = 0; i < items.Count; i++) _DrawInteraction(items[i].ID); @@ -1116,9 +1116,9 @@ namespace VocaluxeLib.Menu } } - public bool IsMouseOver(MouseEvent MouseEvent) + public bool IsMouseOver(SMouseEvent mouseEvent) { - return IsMouseOver(MouseEvent.X, MouseEvent.Y); + return IsMouseOver(mouseEvent.X, mouseEvent.Y); } public bool IsMouseOver(int x, int y) @@ -1273,25 +1273,25 @@ namespace VocaluxeLib.Menu /// /// Selects the next best interaction in a menu. /// - /// + /// /// - private bool _NextInteraction(KeyEvent Key) + private bool _NextInteraction(SKeyEvent key) { - KeyEvent[] Directions = new KeyEvent[4]; - float[] Distances = new float[4]; + SKeyEvent[] directions = new SKeyEvent[4]; + float[] distances = new float[4]; int[] stages = new int[4]; int[] elements = new int[4]; for (int i = 0; i < 4; i++) - Directions[i] = new KeyEvent(); + directions[i] = new SKeyEvent(); - Directions[0].Key = Keys.Up; - Directions[1].Key = Keys.Right; - Directions[2].Key = Keys.Down; - Directions[3].Key = Keys.Left; + directions[0].Key = Keys.Up; + directions[1].Key = Keys.Right; + directions[2].Key = Keys.Down; + directions[3].Key = Keys.Left; for (int i = 0; i < 4; i++) - elements[i] = _GetNextElement(Directions[i], out Distances[i], out stages[i]); + elements[i] = _GetNextElement(directions[i], out distances[i], out stages[i]); int element = _Selection; int stage = int.MaxValue; @@ -1299,7 +1299,7 @@ namespace VocaluxeLib.Menu int direction = -1; int mute = -1; - switch (Key.Key) + switch (key.Key) { case Keys.Up: mute = 2; @@ -1317,11 +1317,11 @@ namespace VocaluxeLib.Menu for (int i = 0; i < 4; i++) { - if (i != mute && elements[i] != _Selection && (stages[i] <= stage && Directions[i].Key == Key.Key)) + if (i != mute && elements[i] != _Selection && (stages[i] <= stage && directions[i].Key == key.Key)) { stage = stages[i]; element = elements[i]; - distance = Distances[i]; + distance = distances[i]; direction = i; } } @@ -1329,7 +1329,7 @@ namespace VocaluxeLib.Menu if (direction != -1) { // select the new element - if (Directions[direction].Key == Key.Key) + if (directions[direction].Key == key.Key) { _UnsetHighlighted(_Selection); _UnsetSelected(); @@ -1344,24 +1344,24 @@ namespace VocaluxeLib.Menu return false; } - private int _GetNextElement(KeyEvent Key, out float Distance, out int Stage) + private int _GetNextElement(SKeyEvent key, out float distance, out int stage) { - Distance = float.MaxValue; + distance = float.MaxValue; int min = _Selection; SRectF actualRect = _GetRect(_Selection); - Stage = int.MaxValue; + stage = int.MaxValue; for (int i = 0; i < _Interactions.Count; i++) { if (i != _Selection && !_Interactions[i].ThemeEditorOnly && _IsVisible(i) && _IsEnabled(i)) { SRectF targetRect = _GetRect(i); - float dist = _GetDistanceDirect(Key, actualRect, targetRect); - if (dist >= 0f && dist < Distance) + float dist = _GetDistanceDirect(key, actualRect, targetRect); + if (dist >= 0f && dist < distance) { - Distance = dist; + distance = dist; min = i; - Stage = 10; + stage = 10; } } } @@ -1373,12 +1373,12 @@ namespace VocaluxeLib.Menu if (i != _Selection && !_Interactions[i].ThemeEditorOnly && _IsVisible(i) && _IsEnabled(i)) { SRectF targetRect = _GetRect(i); - float dist = _GetDistance180(Key, actualRect, targetRect); - if (dist >= 0f && dist < Distance) + float dist = _GetDistance180(key, actualRect, targetRect); + if (dist >= 0f && dist < distance) { - Distance = dist; + distance = dist; min = i; - Stage = 20; + stage = 20; } } } @@ -1386,7 +1386,7 @@ namespace VocaluxeLib.Menu if (min == _Selection) { - switch (Key.Key) + switch (key.Key) { case Keys.Up: actualRect = new SRectF(actualRect.X, CBase.Settings.GetRenderH(), 1, 1, actualRect.Z); @@ -1407,12 +1407,12 @@ namespace VocaluxeLib.Menu if (i != _Selection && !_Interactions[i].ThemeEditorOnly && _IsVisible(i) && _IsEnabled(i)) { SRectF targetRect = _GetRect(i); - float dist = _GetDistance180(Key, actualRect, targetRect); - if (dist >= 0f && dist < Distance) + float dist = _GetDistance180(key, actualRect, targetRect); + if (dist >= 0f && dist < distance) { - Distance = dist; + distance = dist; min = i; - Stage = 30; + stage = 30; } } } @@ -1420,7 +1420,7 @@ namespace VocaluxeLib.Menu return min; } - private float _GetDistanceDirect(KeyEvent Key, SRectF actualRect, SRectF targetRect) + private float _GetDistanceDirect(SKeyEvent key, SRectF actualRect, SRectF targetRect) { PointF source = new PointF(actualRect.X + actualRect.W / 2f, actualRect.Y + actualRect.H / 2f); PointF dest = new PointF(targetRect.X + targetRect.W / 2f, targetRect.Y + targetRect.H / 2f); @@ -1428,7 +1428,7 @@ namespace VocaluxeLib.Menu PointF vector = new PointF(dest.X - source.X, dest.Y - source.Y); float distance = (float)Math.Sqrt(vector.X * vector.X + vector.Y * vector.Y); bool inDirection = false; - switch (Key.Key) + switch (key.Key) { case Keys.Up: if (vector.Y < 0f && (targetRect.X + targetRect.W > actualRect.X && actualRect.X + actualRect.W > targetRect.X)) @@ -1456,7 +1456,7 @@ namespace VocaluxeLib.Menu return distance; } - private float _GetDistance180(KeyEvent Key, SRectF actualRect, SRectF targetRect) + private float _GetDistance180(SKeyEvent key, SRectF actualRect, SRectF targetRect) { PointF source = new PointF(actualRect.X + actualRect.W / 2f, actualRect.Y + actualRect.H / 2f); PointF dest = new PointF(targetRect.X + targetRect.W / 2f, targetRect.Y + targetRect.H / 2f); @@ -1464,7 +1464,7 @@ namespace VocaluxeLib.Menu PointF vector = new PointF(dest.X - source.X, dest.Y - source.Y); float distance = (float)Math.Sqrt(vector.X * vector.X + vector.Y * vector.Y); bool inDirection = false; - switch (Key.Key) + switch (key.Key) { case Keys.Up: if (vector.Y < 0f) @@ -1764,7 +1764,7 @@ namespace VocaluxeLib.Menu private SRectF _GetRect(int interaction) { - SRectF Result = new SRectF(); + SRectF result = new SRectF(); switch (_Interactions[interaction].Type) { case EType.Button: @@ -1798,7 +1798,7 @@ namespace VocaluxeLib.Menu return _ParticleEffects[_Interactions[interaction].Num].Rect; } - return Result; + return result; } private void _AddInteraction(int num, EType type) @@ -1864,7 +1864,7 @@ namespace VocaluxeLib.Menu #endregion InteractionHandling #region Theme Handling - private void MoveElement(int stepX, int stepY) + private void _MoveElement(int stepX, int stepY) { if (_Interactions.Count > 0) { @@ -1913,7 +1913,7 @@ namespace VocaluxeLib.Menu } } - private void ResizeElement(int stepW, int stepH) + private void _ResizeElement(int stepW, int stepH) { if (_Interactions.Count > 0) { @@ -1962,7 +1962,7 @@ namespace VocaluxeLib.Menu } } - private bool CheckVersion(int reqVersion, CXMLReader xmlReader) + private bool _CheckVersion(int reqVersion, CXMLReader xmlReader) { int actualVersion = 0; xmlReader.TryGetIntValue("//root/" + ThemeName + "/ScreenVersion", ref actualVersion); @@ -1983,14 +1983,14 @@ namespace VocaluxeLib.Menu return false; } - private void LoadThemeBasics(CXMLReader xmlReader, int SkinIndex) + private void _LoadThemeBasics(CXMLReader xmlReader, int skinIndex) { string value = String.Empty; // Backgrounds CBackground background = new CBackground(_PartyModeID); int i = 1; - while (background.LoadTheme("//root/" + ThemeName, "Background" + i.ToString(), xmlReader, SkinIndex)) + while (background.LoadTheme("//root/" + ThemeName, "Background" + i.ToString(), xmlReader, skinIndex)) { AddBackground(background); background = new CBackground(_PartyModeID); @@ -2000,7 +2000,7 @@ namespace VocaluxeLib.Menu // Statics CStatic stat = new CStatic(_PartyModeID); i = 1; - while (stat.LoadTheme("//root/" + ThemeName, "Static" + i.ToString(), xmlReader, SkinIndex)) + while (stat.LoadTheme("//root/" + ThemeName, "Static" + i.ToString(), xmlReader, skinIndex)) { AddStatic(stat); stat = new CStatic(_PartyModeID); @@ -2010,7 +2010,7 @@ namespace VocaluxeLib.Menu // Texts CText text = new CText(_PartyModeID); i = 1; - while (text.LoadTheme("//root/" + ThemeName, "Text" + i.ToString(), xmlReader, SkinIndex)) + while (text.LoadTheme("//root/" + ThemeName, "Text" + i.ToString(), xmlReader, skinIndex)) { AddText(text); text = new CText(_PartyModeID); @@ -2020,7 +2020,7 @@ namespace VocaluxeLib.Menu // ParticleEffects CParticleEffect partef = new CParticleEffect(_PartyModeID); i = 1; - while (partef.LoadTheme("//root/" + ThemeName, "ParticleEffect" + i.ToString(), xmlReader, SkinIndex)) + while (partef.LoadTheme("//root/" + ThemeName, "ParticleEffect" + i.ToString(), xmlReader, skinIndex)) { AddParticleEffect(partef); partef = new CParticleEffect(_PartyModeID); @@ -2028,7 +2028,7 @@ namespace VocaluxeLib.Menu } } - private void ReloadThemeEditMode() + private void _ReloadThemeEditMode() { CBase.Theme.UnloadSkins(); CBase.Theme.ListSkins(); diff --git a/VocaluxeLib/Menu/CMenuParty.cs b/VocaluxeLib/Menu/CMenuParty.cs index 3c29ada5..5a2e491f 100644 --- a/VocaluxeLib/Menu/CMenuParty.cs +++ b/VocaluxeLib/Menu/CMenuParty.cs @@ -12,9 +12,9 @@ namespace VocaluxeLib.Menu _PartyMode = new CPartyModeNone(); } - public void SetPartyModeID(int PartyModeID) + public void SetPartyModeID(int partyModeID) { - _PartyModeID = PartyModeID; + _PartyModeID = partyModeID; } public int GetPartyModeID() @@ -22,12 +22,12 @@ namespace VocaluxeLib.Menu return _PartyModeID; } - public void AssingPartyMode(IPartyMode PartyMode) + public void AssingPartyMode(IPartyMode partyMode) { - _PartyMode = PartyMode; + _PartyMode = partyMode; } - public virtual void DataToScreen(Object Data) {} + public virtual void DataToScreen(Object data) {} /* public sealed override void LoadTheme() diff --git a/VocaluxeLib/Menu/CNameSelection.cs b/VocaluxeLib/Menu/CNameSelection.cs index e8c6eaba..a55d8994 100644 --- a/VocaluxeLib/Menu/CNameSelection.cs +++ b/VocaluxeLib/Menu/CNameSelection.cs @@ -66,42 +66,42 @@ namespace VocaluxeLib.Menu private int _TileW; private int _TileH; - public int _Offset = 0; - private int _actualSelection = -1; + public int Offset = 0; + private int _ActualSelection = -1; public int Selection = -1; - private int _player = -1; + private int _Player = -1; - private readonly List VisibleProfiles; + private readonly List _VisibleProfiles; - private CStatic PlayerSelector; + private CStatic _PlayerSelector; - public CNameSelection(int PartyModeID) + public CNameSelection(int partyModeID) { - _PartyModeID = PartyModeID; + _PartyModeID = partyModeID; _Theme = new SThemeNameSelection(); _Tiles = new List(); - VisibleProfiles = new List(); + _VisibleProfiles = new List(); } public void Init() { - PrepareTiles(); + _PrepareTiles(); - PlayerSelector = new CStatic(_PartyModeID); - PlayerSelector.Texture = _TextureTileSelected; - PlayerSelector.Rect = new SRectF(0, 0, _TileW + 6, _TileH + 6, Rect.Z - 0.5f); - PlayerSelector.Visible = false; + _PlayerSelector = new CStatic(_PartyModeID); + _PlayerSelector.Texture = _TextureTileSelected; + _PlayerSelector.Rect = new SRectF(0, 0, _TileW + 6, _TileH + 6, Rect.Z - 0.5f); + _PlayerSelector.Visible = false; - UpdateVisibleProfiles(); + _UpdateVisibleProfiles(); UpdateList(0); } - public bool LoadTheme(string XmlPath, string ElementName, CXMLReader xmlReader, int SkinIndex) + public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex) { - string item = XmlPath + "/" + ElementName; + string item = xmlPath + "/" + elementName; _ThemeLoaded = true; _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/X", ref Rect.X); @@ -113,7 +113,7 @@ namespace VocaluxeLib.Menu _ThemeLoaded &= xmlReader.GetValue(item + "/SkinEmptyTile", ref _Theme.TextureEmptyTileName, String.Empty); if (xmlReader.GetValue(item + "/ColorEmptyTile", ref _Theme.ColorEmptyTileName, String.Empty)) - _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorEmptyTileName, SkinIndex, out ColorEmptyTile); + _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorEmptyTileName, skinIndex, out ColorEmptyTile); else { _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref ColorEmptyTile.R); @@ -135,7 +135,7 @@ namespace VocaluxeLib.Menu _ThemeLoaded &= xmlReader.GetValue(item + "/Tiles/Name/Font", ref _Theme.NameFont, "Normal"); _ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/Tiles/Name/Style", ref _Theme.NameStyle); if (xmlReader.GetValue(item + "/Tiles/Name/Color", ref _Theme.NameColorName, String.Empty)) - _ThemeLoaded &= CBase.Theme.GetColor(_Theme.NameColorName, SkinIndex, out _Theme.NameColor); + _ThemeLoaded &= CBase.Theme.GetColor(_Theme.NameColorName, skinIndex, out _Theme.NameColor); else { if (xmlReader.TryGetFloatValue(item + "/Tiles/Name/R", ref _Theme.NameColor.R)) @@ -149,7 +149,7 @@ namespace VocaluxeLib.Menu if (_ThemeLoaded) { - _Theme.Name = ElementName; + _Theme.Name = elementName; LoadTextures(); } return _ThemeLoaded; @@ -236,7 +236,7 @@ namespace VocaluxeLib.Menu Draw(true); } - public void Draw(bool ForceDraw) + public void Draw(bool forceDraw) { int i = 0; foreach (CTile tile in _Tiles) @@ -244,84 +244,84 @@ namespace VocaluxeLib.Menu tile.Avatar.Draw(); tile.Name.Draw(); - if (PlayerSelector.Visible) + if (_PlayerSelector.Visible) { //Update PlayerSelector-Coords - if (_player > -1 && _actualSelection == i) + if (_Player > -1 && _ActualSelection == i) { - PlayerSelector.Rect.X = tile.Avatar.Rect.X - 3; - PlayerSelector.Rect.Y = tile.Avatar.Rect.Y - 3; + _PlayerSelector.Rect.X = tile.Avatar.Rect.X - 3; + _PlayerSelector.Rect.Y = tile.Avatar.Rect.Y - 3; } } i++; } - if (PlayerSelector.Visible) + if (_PlayerSelector.Visible) { //Draw PlayerSelector - PlayerSelector.Draw(); + _PlayerSelector.Draw(); } } - public void HandleInput(KeyEvent kevent) + public void HandleInput(SKeyEvent kevent) { switch (kevent.Key) { case Keys.Right: - if (_actualSelection + 1 < _Tiles.Count) + if (_ActualSelection + 1 < _Tiles.Count) { - if (_Tiles[_actualSelection + 1].PlayerNr != -1) - _actualSelection++; + if (_Tiles[_ActualSelection + 1].PlayerNr != -1) + _ActualSelection++; } else { - int offset = _Offset; - UpdateList(_Offset + 1); - if (offset != _Offset) - _actualSelection = 0; + int offset = Offset; + UpdateList(Offset + 1); + if (offset != Offset) + _ActualSelection = 0; } break; case Keys.Left: - if (_actualSelection - 1 > -1) - _actualSelection--; - else if (_Offset > 0) + if (_ActualSelection - 1 > -1) + _ActualSelection--; + else if (Offset > 0) { - UpdateList(_Offset - 1); - _actualSelection = _Tiles.Count - 1; + UpdateList(Offset - 1); + _ActualSelection = _Tiles.Count - 1; } break; case Keys.Up: - if (_actualSelection - _NumW > -1) - _actualSelection -= _NumW; - else if (_Offset > 0) + if (_ActualSelection - _NumW > -1) + _ActualSelection -= _NumW; + else if (Offset > 0) { - UpdateList(_Offset - 1); - _actualSelection += _Tiles.Count - _NumW; + UpdateList(Offset - 1); + _ActualSelection += _Tiles.Count - _NumW; } break; case Keys.Down: - if (_actualSelection + _NumW < _Tiles.Count) + if (_ActualSelection + _NumW < _Tiles.Count) { - if (_Tiles[_actualSelection + _NumW].PlayerNr != -1) - _actualSelection += _NumW; + if (_Tiles[_ActualSelection + _NumW].PlayerNr != -1) + _ActualSelection += _NumW; } else { - int offset = _Offset; - UpdateList(_Offset + 1); - if (offset != _Offset) + int offset = Offset; + UpdateList(Offset + 1); + if (offset != Offset) { - _actualSelection = _actualSelection - _Tiles.Count + _NumW; - if (_Tiles[_actualSelection].PlayerNr == -1) + _ActualSelection = _ActualSelection - _Tiles.Count + _NumW; + if (_Tiles[_ActualSelection].PlayerNr == -1) { for (int i = _Tiles.Count - 1; i >= 0; i--) { if (_Tiles[i].PlayerNr != -1) { - _actualSelection = i; + _ActualSelection = i; break; } } @@ -331,8 +331,8 @@ namespace VocaluxeLib.Menu break; } - if (_Offset * _Tiles.Count + _actualSelection < VisibleProfiles.Count) - Selection = VisibleProfiles[_Offset * _Tiles.Count + _actualSelection]; + if (Offset * _Tiles.Count + _ActualSelection < _VisibleProfiles.Count) + Selection = _VisibleProfiles[Offset * _Tiles.Count + _ActualSelection]; else Selection = -1; } @@ -342,35 +342,35 @@ namespace VocaluxeLib.Menu //Overwrite player-selection; Same profile, but other player if (active && Selection != -1) { - _player = player; - PlayerSelector.Color = CBase.Theme.GetPlayerColor(player); + _Player = player; + _PlayerSelector.Color = CBase.Theme.GetPlayerColor(player); } //Normal activation else if (active) { Selection = 0; - _actualSelection = 0; - _player = player; - PlayerSelector.Color = CBase.Theme.GetPlayerColor(player); - PlayerSelector.Visible = true; + _ActualSelection = 0; + _Player = player; + _PlayerSelector.Color = CBase.Theme.GetPlayerColor(player); + _PlayerSelector.Visible = true; } //Deactivate else { Selection = -1; - _actualSelection = -1; - _player = -1; - PlayerSelector.Visible = false; + _ActualSelection = -1; + _Player = -1; + _PlayerSelector.Visible = false; } } public void UpdateList() { - UpdateVisibleProfiles(); - if (_Tiles.Count * (_Offset + 1) - VisibleProfiles.Count >= _Tiles.Count * _Offset) - UpdateList(_Offset - 1); + _UpdateVisibleProfiles(); + if (_Tiles.Count * (Offset + 1) - _VisibleProfiles.Count >= _Tiles.Count * Offset) + UpdateList(Offset - 1); else - UpdateList(_Offset); + UpdateList(Offset); } public void UpdateList(int offset) @@ -380,12 +380,12 @@ namespace VocaluxeLib.Menu for (int i = 0; i < _Tiles.Count; i++) { - if ((i + offset * _Tiles.Count) < VisibleProfiles.Count) + if ((i + offset * _Tiles.Count) < _VisibleProfiles.Count) { - _Tiles[i].Avatar.Texture = CBase.Profiles.GetProfiles()[VisibleProfiles[i + offset * _Tiles.Count]].Avatar.Texture; + _Tiles[i].Avatar.Texture = CBase.Profiles.GetProfiles()[_VisibleProfiles[i + offset * _Tiles.Count]].Avatar.Texture; _Tiles[i].Avatar.Color = new SColorF(1, 1, 1, 1); - _Tiles[i].Name.Text = CBase.Profiles.GetProfiles()[VisibleProfiles[i + offset * _Tiles.Count]].PlayerName; - _Tiles[i].PlayerNr = VisibleProfiles[i + offset * _Tiles.Count]; + _Tiles[i].Name.Text = CBase.Profiles.GetProfiles()[_VisibleProfiles[i + offset * _Tiles.Count]].PlayerName; + _Tiles[i].PlayerNr = _VisibleProfiles[i + offset * _Tiles.Count]; } else { @@ -395,10 +395,10 @@ namespace VocaluxeLib.Menu _Tiles[i].PlayerNr = -1; } } - _Offset = offset; + Offset = offset; } - public bool isOverTile(MouseEvent mevent) + public bool IsOverTile(SMouseEvent mevent) { bool isOver = false; foreach (CTile tile in _Tiles) @@ -409,7 +409,7 @@ namespace VocaluxeLib.Menu return isOver; } - public int TilePlayerNr(MouseEvent mevent) + public int TilePlayerNr(SMouseEvent mevent) { foreach (CTile tile in _Tiles) { @@ -420,7 +420,7 @@ namespace VocaluxeLib.Menu return -1; } - public CStatic TilePlayerAvatar(MouseEvent mevent) + public CStatic TilePlayerAvatar(SMouseEvent mevent) { foreach (CTile tile in _Tiles) { @@ -450,10 +450,10 @@ namespace VocaluxeLib.Menu UnloadTextures(); LoadTextures(); - PrepareTiles(); + _PrepareTiles(); } - private void PrepareTiles() + private void _PrepareTiles() { _Tiles.Clear(); for (int i = 0; i < _NumH; i++) @@ -469,9 +469,9 @@ namespace VocaluxeLib.Menu } } - private void UpdateVisibleProfiles() + private void _UpdateVisibleProfiles() { - VisibleProfiles.Clear(); + _VisibleProfiles.Clear(); for (int i = 0; i < CBase.Profiles.GetProfiles().Length; i++) { bool visible = false; @@ -485,7 +485,7 @@ namespace VocaluxeLib.Menu visible = false; } if (visible) - VisibleProfiles.Add(i); + _VisibleProfiles.Add(i); } } diff --git a/VocaluxeLib/Menu/CObjectInteractions.cs b/VocaluxeLib/Menu/CObjectInteractions.cs index 2f67810b..a5d9e722 100644 --- a/VocaluxeLib/Menu/CObjectInteractions.cs +++ b/VocaluxeLib/Menu/CObjectInteractions.cs @@ -32,10 +32,10 @@ namespace VocaluxeLib.Menu public CObjectInteractions() { - Init(); + _Init(); } - protected void Init() + protected void _Init() { _Interactions = new List(); _Selection = 0; @@ -103,115 +103,115 @@ namespace VocaluxeLib.Menu #endregion ElementHandler #region MenuHandler - public bool HandleInput(KeyEvent KeyEvent) + public bool HandleInput(SKeyEvent keyEvent) { if (!CBase.Settings.IsTabNavigation()) { - if (KeyEvent.Key == Keys.Left) + if (keyEvent.Key == Keys.Left) { - if (_Interactions.Count > 0 && _Interactions[_Selection].Type == EType.SelectSlide && KeyEvent.Mod != EModifier.Shift) - KeyEvent.Handled = PrevElement(); + if (_Interactions.Count > 0 && _Interactions[_Selection].Type == EType.SelectSlide && keyEvent.Mod != EModifier.Shift) + keyEvent.Handled = PrevElement(); else - KeyEvent.Handled = _NextInteraction(KeyEvent); + keyEvent.Handled = _NextInteraction(keyEvent); } - if (KeyEvent.Key == Keys.Right) + if (keyEvent.Key == Keys.Right) { - if (_Interactions.Count > 0 && _Interactions[_Selection].Type == EType.SelectSlide && KeyEvent.Mod != EModifier.Shift) - KeyEvent.Handled = NextElement(); + if (_Interactions.Count > 0 && _Interactions[_Selection].Type == EType.SelectSlide && keyEvent.Mod != EModifier.Shift) + keyEvent.Handled = NextElement(); else - KeyEvent.Handled = _NextInteraction(KeyEvent); + keyEvent.Handled = _NextInteraction(keyEvent); } - if (KeyEvent.Key == Keys.Up || KeyEvent.Key == Keys.Down) - KeyEvent.Handled = _NextInteraction(KeyEvent); + if (keyEvent.Key == Keys.Up || keyEvent.Key == Keys.Down) + keyEvent.Handled = _NextInteraction(keyEvent); } else { - if (KeyEvent.Key == Keys.Tab) + if (keyEvent.Key == Keys.Tab) { - if (KeyEvent.Mod == EModifier.Shift) + if (keyEvent.Mod == EModifier.Shift) PrevInteraction(); else NextInteraction(); } - if (KeyEvent.Key == Keys.Left) + if (keyEvent.Key == Keys.Left) PrevElement(); - if (KeyEvent.Key == Keys.Right) + if (keyEvent.Key == Keys.Right) NextElement(); } return true; } - public bool HandleMouse(MouseEvent MouseEvent) + public bool HandleMouse(SMouseEvent mouseEvent) { int selection = _Selection; - ProcessMouseMove(MouseEvent.X, MouseEvent.Y); + ProcessMouseMove(mouseEvent.X, mouseEvent.Y); if (selection != _Selection) { _UnsetHighlighted(selection); _SetHighlighted(_Selection); } - if (MouseEvent.LB) - ProcessMouseClick(MouseEvent.X, MouseEvent.Y); + if (mouseEvent.LB) + ProcessMouseClick(mouseEvent.X, mouseEvent.Y); - _PrevMouseX = MouseEvent.X; - _PrevMouseY = MouseEvent.Y; + _PrevMouseX = mouseEvent.X; + _PrevMouseY = mouseEvent.Y; return true; } - public bool HandleInputThemeEditor(KeyEvent KeyEvent) + public bool HandleInputThemeEditor(SKeyEvent keyEvent) { _UnsetHighlighted(_Selection); - if (KeyEvent.KeyPressed) {} + if (keyEvent.KeyPressed) {} else { - switch (KeyEvent.Key) + switch (keyEvent.Key) { case Keys.S: CBase.Graphics.SaveTheme(); break; case Keys.Up: - if (KeyEvent.Mod == EModifier.Ctrl) - MoveElement(0, -1); + if (keyEvent.Mod == EModifier.Ctrl) + _MoveElement(0, -1); - if (KeyEvent.Mod == EModifier.Shift) - ResizeElement(0, 1); + if (keyEvent.Mod == EModifier.Shift) + _ResizeElement(0, 1); break; case Keys.Down: - if (KeyEvent.Mod == EModifier.Ctrl) - MoveElement(0, 1); + if (keyEvent.Mod == EModifier.Ctrl) + _MoveElement(0, 1); - if (KeyEvent.Mod == EModifier.Shift) - ResizeElement(0, -1); + if (keyEvent.Mod == EModifier.Shift) + _ResizeElement(0, -1); break; case Keys.Right: - if (KeyEvent.Mod == EModifier.Ctrl) - MoveElement(1, 0); + if (keyEvent.Mod == EModifier.Ctrl) + _MoveElement(1, 0); - if (KeyEvent.Mod == EModifier.Shift) - ResizeElement(1, 0); + if (keyEvent.Mod == EModifier.Shift) + _ResizeElement(1, 0); - if (KeyEvent.Mod == EModifier.None) + if (keyEvent.Mod == EModifier.None) NextInteraction(); break; case Keys.Left: - if (KeyEvent.Mod == EModifier.Ctrl) - MoveElement(-1, 0); + if (keyEvent.Mod == EModifier.Ctrl) + _MoveElement(-1, 0); - if (KeyEvent.Mod == EModifier.Shift) - ResizeElement(-1, 0); + if (keyEvent.Mod == EModifier.Shift) + _ResizeElement(-1, 0); - if (KeyEvent.Mod == EModifier.None) + if (keyEvent.Mod == EModifier.None) PrevInteraction(); break; } @@ -219,64 +219,64 @@ namespace VocaluxeLib.Menu return true; } - public bool HandleMouseThemeEditor(MouseEvent MouseEvent) + public bool HandleMouseThemeEditor(SMouseEvent mouseEvent) { _UnsetHighlighted(_Selection); - _MouseDX = MouseEvent.X - _PrevMouseX; - _MouseDY = MouseEvent.Y - _PrevMouseY; + _MouseDX = mouseEvent.X - _PrevMouseX; + _MouseDY = mouseEvent.Y - _PrevMouseY; int stepX = 0; int stepY = 0; - if ((MouseEvent.Mod & EModifier.Ctrl) == EModifier.Ctrl) + if ((mouseEvent.Mod & EModifier.Ctrl) == EModifier.Ctrl) { - _PrevMouseX = MouseEvent.X; - _PrevMouseY = MouseEvent.Y; + _PrevMouseX = mouseEvent.X; + _PrevMouseY = mouseEvent.Y; } else { - while (Math.Abs(MouseEvent.X - _PrevMouseX) >= 5) + while (Math.Abs(mouseEvent.X - _PrevMouseX) >= 5) { - if (MouseEvent.X - _PrevMouseX >= 5) + if (mouseEvent.X - _PrevMouseX >= 5) stepX += 5; - if (MouseEvent.X - _PrevMouseX <= -5) + if (mouseEvent.X - _PrevMouseX <= -5) stepX -= 5; - _PrevMouseX = MouseEvent.X - (_MouseDX - stepX); + _PrevMouseX = mouseEvent.X - (_MouseDX - stepX); } - while (Math.Abs(MouseEvent.Y - _PrevMouseY) >= 5) + while (Math.Abs(mouseEvent.Y - _PrevMouseY) >= 5) { - if (MouseEvent.Y - _PrevMouseY >= 5) + if (mouseEvent.Y - _PrevMouseY >= 5) stepY += 5; - if (MouseEvent.Y - _PrevMouseY <= -5) + if (mouseEvent.Y - _PrevMouseY <= -5) stepY -= 5; - _PrevMouseY = MouseEvent.Y - (_MouseDY - stepY); + _PrevMouseY = mouseEvent.Y - (_MouseDY - stepY); } } - if (MouseEvent.LBH) + if (mouseEvent.LBH) { //if (IsMouseOver(MouseEvent.X, _PrevMouseY)) //{ - if (MouseEvent.Mod == EModifier.None) - MoveElement(stepX, stepY); + if (mouseEvent.Mod == EModifier.None) + _MoveElement(stepX, stepY); - if (MouseEvent.Mod == EModifier.Ctrl) - MoveElement(_MouseDX, _MouseDY); + if (mouseEvent.Mod == EModifier.Ctrl) + _MoveElement(_MouseDX, _MouseDY); - if (MouseEvent.Mod == EModifier.Shift) - ResizeElement(stepX, stepY); + if (mouseEvent.Mod == EModifier.Shift) + _ResizeElement(stepX, stepY); - if (MouseEvent.Mod == (EModifier.Shift | EModifier.Ctrl)) - ResizeElement(_MouseDX, _MouseDY); + if (mouseEvent.Mod == (EModifier.Shift | EModifier.Ctrl)) + _ResizeElement(_MouseDX, _MouseDY); //} } else - ProcessMouseMove(MouseEvent.X, MouseEvent.Y); + ProcessMouseMove(mouseEvent.X, mouseEvent.Y); return true; } @@ -288,7 +288,7 @@ namespace VocaluxeLib.Menu if (_Interactions.Count <= 0) return; - List items = new List(); + List items = new List(); for (int i = 0; i < _Interactions.Count; i++) { @@ -301,9 +301,9 @@ namespace VocaluxeLib.Menu _Interactions[i].Type == EType.SongMenu || _Interactions[i].Type == EType.Equalizer)) { - ZSort zs = new ZSort(); + SZSort zs = new SZSort(); zs.ID = i; - zs.z = _GetZValue(i); + zs.Z = _GetZValue(i); items.Add(zs); } } @@ -312,7 +312,7 @@ namespace VocaluxeLib.Menu return; - items.Sort(delegate(ZSort s1, ZSort s2) { return s2.z.CompareTo(s1.z); }); + items.Sort(delegate(SZSort s1, SZSort s2) { return s2.Z.CompareTo(s1.Z); }); for (int i = 0; i < items.Count; i++) _DrawInteraction(items[i].ID); @@ -471,9 +471,9 @@ namespace VocaluxeLib.Menu } } - public bool IsMouseOver(MouseEvent MouseEvent) + public bool IsMouseOver(SMouseEvent mouseEvent) { - return IsMouseOver(MouseEvent.X, MouseEvent.Y); + return IsMouseOver(mouseEvent.X, mouseEvent.Y); } public bool IsMouseOver(int x, int y) @@ -595,25 +595,25 @@ namespace VocaluxeLib.Menu /// /// Selects the next best interaction in a menu. /// - /// + /// /// - private bool _NextInteraction(KeyEvent Key) + private bool _NextInteraction(SKeyEvent key) { - KeyEvent[] Directions = new KeyEvent[4]; - float[] Distances = new float[4]; + SKeyEvent[] directions = new SKeyEvent[4]; + float[] distances = new float[4]; int[] stages = new int[4]; int[] elements = new int[4]; for (int i = 0; i < 4; i++) - Directions[i] = new KeyEvent(); + directions[i] = new SKeyEvent(); - Directions[0].Key = Keys.Up; - Directions[1].Key = Keys.Right; - Directions[2].Key = Keys.Down; - Directions[3].Key = Keys.Left; + directions[0].Key = Keys.Up; + directions[1].Key = Keys.Right; + directions[2].Key = Keys.Down; + directions[3].Key = Keys.Left; for (int i = 0; i < 4; i++) - elements[i] = _GetNextElement(Directions[i], out Distances[i], out stages[i]); + elements[i] = _GetNextElement(directions[i], out distances[i], out stages[i]); int element = _Selection; int stage = int.MaxValue; @@ -621,7 +621,7 @@ namespace VocaluxeLib.Menu int direction = -1; int mute = -1; - switch (Key.Key) + switch (key.Key) { case Keys.Up: mute = 2; @@ -639,11 +639,11 @@ namespace VocaluxeLib.Menu for (int i = 0; i < 4; i++) { - if (i != mute && elements[i] != _Selection && (stages[i] <= stage && Directions[i].Key == Key.Key)) + if (i != mute && elements[i] != _Selection && (stages[i] <= stage && directions[i].Key == key.Key)) { stage = stages[i]; element = elements[i]; - distance = Distances[i]; + distance = distances[i]; direction = i; } } @@ -651,7 +651,7 @@ namespace VocaluxeLib.Menu if (direction != -1) { // select the new element - if (Directions[direction].Key == Key.Key) + if (directions[direction].Key == key.Key) { _UnsetHighlighted(_Selection); _UnsetSelected(); @@ -666,24 +666,24 @@ namespace VocaluxeLib.Menu return false; } - private int _GetNextElement(KeyEvent Key, out float Distance, out int Stage) + private int _GetNextElement(SKeyEvent key, out float distance, out int stage) { - Distance = float.MaxValue; + distance = float.MaxValue; int min = _Selection; SRectF actualRect = _GetRect(_Selection); - Stage = int.MaxValue; + stage = int.MaxValue; for (int i = 0; i < _Interactions.Count; i++) { if (i != _Selection && !_Interactions[i].ThemeEditorOnly && _IsVisible(i) && _IsEnabled(i)) { SRectF targetRect = _GetRect(i); - float dist = _GetDistanceDirect(Key, actualRect, targetRect); - if (dist >= 0f && dist < Distance) + float dist = _GetDistanceDirect(key, actualRect, targetRect); + if (dist >= 0f && dist < distance) { - Distance = dist; + distance = dist; min = i; - Stage = 10; + stage = 10; } } } @@ -695,12 +695,12 @@ namespace VocaluxeLib.Menu if (i != _Selection && !_Interactions[i].ThemeEditorOnly && _IsVisible(i) && _IsEnabled(i)) { SRectF targetRect = _GetRect(i); - float dist = _GetDistance180(Key, actualRect, targetRect); - if (dist >= 0f && dist < Distance) + float dist = _GetDistance180(key, actualRect, targetRect); + if (dist >= 0f && dist < distance) { - Distance = dist; + distance = dist; min = i; - Stage = 20; + stage = 20; } } } @@ -708,7 +708,7 @@ namespace VocaluxeLib.Menu if (min == _Selection) { - switch (Key.Key) + switch (key.Key) { case Keys.Up: actualRect = new SRectF(actualRect.X, CBase.Settings.GetRenderH(), 1, 1, actualRect.Z); @@ -729,12 +729,12 @@ namespace VocaluxeLib.Menu if (i != _Selection && !_Interactions[i].ThemeEditorOnly && _IsVisible(i) && _IsEnabled(i)) { SRectF targetRect = _GetRect(i); - float dist = _GetDistance180(Key, actualRect, targetRect); - if (dist >= 0f && dist < Distance) + float dist = _GetDistance180(key, actualRect, targetRect); + if (dist >= 0f && dist < distance) { - Distance = dist; + distance = dist; min = i; - Stage = 30; + stage = 30; } } } @@ -742,7 +742,7 @@ namespace VocaluxeLib.Menu return min; } - private float _GetDistanceDirect(KeyEvent Key, SRectF actualRect, SRectF targetRect) + private float _GetDistanceDirect(SKeyEvent key, SRectF actualRect, SRectF targetRect) { PointF source = new PointF(actualRect.X + actualRect.W / 2f, actualRect.Y + actualRect.H / 2f); PointF dest = new PointF(targetRect.X + targetRect.W / 2f, targetRect.Y + targetRect.H / 2f); @@ -750,7 +750,7 @@ namespace VocaluxeLib.Menu PointF vector = new PointF(dest.X - source.X, dest.Y - source.Y); float distance = (float)Math.Sqrt(vector.X * vector.X + vector.Y * vector.Y); bool inDirection = false; - switch (Key.Key) + switch (key.Key) { case Keys.Up: if (vector.Y < 0f && (targetRect.X + targetRect.W > actualRect.X && actualRect.X + actualRect.W > targetRect.X)) @@ -778,7 +778,7 @@ namespace VocaluxeLib.Menu return distance; } - private float _GetDistance180(KeyEvent Key, SRectF actualRect, SRectF targetRect) + private float _GetDistance180(SKeyEvent key, SRectF actualRect, SRectF targetRect) { PointF source = new PointF(actualRect.X + actualRect.W / 2f, actualRect.Y + actualRect.H / 2f); PointF dest = new PointF(targetRect.X + targetRect.W / 2f, targetRect.Y + targetRect.H / 2f); @@ -786,7 +786,7 @@ namespace VocaluxeLib.Menu PointF vector = new PointF(dest.X - source.X, dest.Y - source.Y); float distance = (float)Math.Sqrt(vector.X * vector.X + vector.Y * vector.Y); bool inDirection = false; - switch (Key.Key) + switch (key.Key) { case Keys.Up: if (vector.Y < 0f) @@ -996,7 +996,7 @@ namespace VocaluxeLib.Menu private SRectF _GetRect(int interaction) { - SRectF Result = new SRectF(); + SRectF result = new SRectF(); switch (_Interactions[interaction].Type) { case EType.Button: @@ -1006,7 +1006,7 @@ namespace VocaluxeLib.Menu return _SelectSlides[_Interactions[interaction].Num].Rect; } - return Result; + return result; } private void _AddInteraction(int num, EType type) @@ -1051,7 +1051,7 @@ namespace VocaluxeLib.Menu #endregion InteractionHandling #region Theme Handling - private void MoveElement(int stepX, int stepY) + private void _MoveElement(int stepX, int stepY) { if (_Interactions.Count > 0) { @@ -1068,7 +1068,7 @@ namespace VocaluxeLib.Menu } } - private void ResizeElement(int stepW, int stepH) + private void _ResizeElement(int stepW, int stepH) { if (_Interactions.Count > 0) { diff --git a/VocaluxeLib/Menu/COrderedDictionaryLite.cs b/VocaluxeLib/Menu/COrderedDictionaryLite.cs index cf3a72db..025b76c9 100644 --- a/VocaluxeLib/Menu/COrderedDictionaryLite.cs +++ b/VocaluxeLib/Menu/COrderedDictionaryLite.cs @@ -7,21 +7,21 @@ namespace VocaluxeLib.Menu public class COrderedDictionaryLite : IEnumerable { private readonly List _Items; - private readonly Dictionary _htIndex; + private readonly Dictionary _HtIndex; private readonly CMenu _Parent; - public COrderedDictionaryLite(CMenu Parent) + public COrderedDictionaryLite(CMenu parent) { _Items = new List(); - _htIndex = new Dictionary(); - _Parent = Parent; + _HtIndex = new Dictionary(); + _Parent = parent; } - public COrderedDictionaryLite(COrderedDictionaryLite Dict) + public COrderedDictionaryLite(COrderedDictionaryLite dict) { - _Items = new List(Dict._Items); - _htIndex = new Dictionary(Dict._htIndex); - _Parent = Dict._Parent; + _Items = new List(dict._Items); + _HtIndex = new Dictionary(dict._HtIndex); + _Parent = dict._Parent; } public T this[int index] @@ -36,7 +36,7 @@ namespace VocaluxeLib.Menu { try { - return _Items[_htIndex[key]]; + return _Items[_HtIndex[key]]; } catch (Exception) { @@ -46,20 +46,20 @@ namespace VocaluxeLib.Menu } set { - if (!_htIndex.ContainsKey(key)) + if (!_HtIndex.ContainsKey(key)) { - _htIndex.Add(key, _Items.Count); + _HtIndex.Add(key, _Items.Count); _Items.Add(value); } else - _Items[_htIndex[key]] = value; + _Items[_HtIndex[key]] = value; } } public int Add(T item, String key = null) { if (key != null) - _htIndex.Add(key, _Items.Count); + _HtIndex.Add(key, _Items.Count); _Items.Add(item); return _Items.Count - 1; } diff --git a/VocaluxeLib/Menu/CParticle.cs b/VocaluxeLib/Menu/CParticle.cs index 7ffaced0..31ba6d42 100644 --- a/VocaluxeLib/Menu/CParticle.cs +++ b/VocaluxeLib/Menu/CParticle.cs @@ -91,10 +91,10 @@ namespace VocaluxeLib.Menu #endregion public vars #region Constructors - public CParticle(int PartyModeID, string textureName, SColorF color, float x, float y, float size, float maxage, float z, float vx, float vy, float vr, float vsize, + public CParticle(int partyModeID, string textureName, SColorF color, float x, float y, float size, float maxage, float z, float vx, float vy, float vr, float vsize, EParticleType type) { - _PartyModeID = PartyModeID; + _PartyModeID = partyModeID; _TextureName = textureName; _Texture = new STexture(-1); _Color = color; @@ -115,10 +115,10 @@ namespace VocaluxeLib.Menu _Rotation = (float)(CBase.Game.GetRandomDouble() * 360.0); } - public CParticle(int PartyModeID, STexture texture, SColorF color, float x, float y, float size, float maxage, float z, float vx, float vy, float vr, float vsize, + public CParticle(int partyModeID, STexture texture, SColorF color, float x, float y, float size, float maxage, float z, float vx, float vy, float vr, float vsize, EParticleType type) { - _PartyModeID = PartyModeID; + _PartyModeID = partyModeID; _TextureName = String.Empty; _Texture = texture; _Color = color; @@ -148,10 +148,10 @@ namespace VocaluxeLib.Menu if (!_Timer.IsRunning) _Timer.Start(); - float CurrentTime = _Timer.ElapsedMilliseconds / 1000f; - float timediff = CurrentTime - _LastTime; + float currentTime = _Timer.ElapsedMilliseconds / 1000f; + float timediff = currentTime - _LastTime; - _Age = CurrentTime; + _Age = currentTime; // update alpha if (_MaxAge > 0f) @@ -200,7 +200,7 @@ namespace VocaluxeLib.Menu { float vdx = 0f; if (_Vx != 0) - vdx = (float)Math.Sin(CurrentTime / _Vx * Math.PI); + vdx = (float)Math.Sin(currentTime / _Vx * Math.PI); X += _Vx * timediff * (0.5f + vdx); @@ -229,23 +229,23 @@ namespace VocaluxeLib.Menu switch (_Type) { case EParticleType.Twinkle: - size = _Size * (1f - CurrentTime / _Vsize); + size = _Size * (1f - currentTime / _Vsize); break; case EParticleType.Star: - size = _Size * (1f - CurrentTime / _Vsize); + size = _Size * (1f - currentTime / _Vsize); break; case EParticleType.Snow: - size = _Size * (float)Math.Sqrt((Math.Sin(CurrentTime / _Vsize * Math.PI * 2 - 0.5 * Math.PI) + 1) / 2); + size = _Size * (float)Math.Sqrt((Math.Sin(currentTime / _Vsize * Math.PI * 2 - 0.5 * Math.PI) + 1) / 2); break; case EParticleType.Flare: - size = _Size * (1f - CurrentTime / _Vsize); + size = _Size * (1f - currentTime / _Vsize); break; case EParticleType.PerfNoteStar: - size = _Size * (1f - CurrentTime / _Vsize); + size = _Size * (1f - currentTime / _Vsize); break; } @@ -258,12 +258,12 @@ namespace VocaluxeLib.Menu // update rotation if (_Vr != 0f) { - float r = CurrentTime * _Vr / 60f; + float r = currentTime * _Vr / 60f; _Angle = _Rotation + 360f * (r - (float)Math.Floor(r)); _Rect.Rotation = _Angle; } - _LastTime = CurrentTime; + _LastTime = currentTime; } public void Pause() @@ -317,9 +317,9 @@ namespace VocaluxeLib.Menu get { return _Stars.Count > 0 || !_SpawnTimer.IsRunning; } } - public CParticleEffect(int PartyModeID) + public CParticleEffect(int partyModeID) { - _PartyModeID = PartyModeID; + _PartyModeID = partyModeID; _Theme = new SThemeParticleEffect(); _Stars = new List(); _SpawnTimer = new Stopwatch(); @@ -327,43 +327,43 @@ namespace VocaluxeLib.Menu Visible = true; } - public CParticleEffect(int PartyModeID, int MaxNumber, SColorF Color, SRectF Rect, string TextureName, float Size, EParticleType Type) + public CParticleEffect(int partyModeID, int maxNumber, SColorF color, SRectF rect, string textureName, float size, EParticleType type) { - _PartyModeID = PartyModeID; + _PartyModeID = partyModeID; _Theme = new SThemeParticleEffect(); _Stars = new List(); - this.Rect = Rect; - this.Color = Color; - _Theme.TextureName = TextureName; + this.Rect = rect; + this.Color = color; + _Theme.TextureName = textureName; Texture = new STexture(-1); - _MaxNumber = MaxNumber; - _Size = Size; - _Type = Type; + _MaxNumber = maxNumber; + _Size = size; + _Type = type; _SpawnTimer = new Stopwatch(); _NextSpawnTime = 0f; Visible = true; } - public CParticleEffect(int PartyModeID, int MaxNumber, SColorF Color, SRectF Rect, STexture Texture, float Size, EParticleType Type) + public CParticleEffect(int partyModeID, int maxNumber, SColorF color, SRectF rect, STexture texture, float size, EParticleType type) { - _PartyModeID = PartyModeID; + _PartyModeID = partyModeID; _Theme = new SThemeParticleEffect(); _Stars = new List(); - this.Rect = Rect; - this.Color = Color; + this.Rect = rect; + this.Color = color; _Theme.TextureName = String.Empty; - this.Texture = Texture; - _MaxNumber = MaxNumber; - _Size = Size; - _Type = Type; + this.Texture = texture; + _MaxNumber = maxNumber; + _Size = size; + _Type = type; _SpawnTimer = new Stopwatch(); _NextSpawnTime = 0f; Visible = true; } - public bool LoadTheme(string XmlPath, string ElementName, CXMLReader xmlReader, int SkinIndex) + public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex) { - string item = XmlPath + "/" + ElementName; + string item = xmlPath + "/" + elementName; _ThemeLoaded = true; _ThemeLoaded &= xmlReader.GetValue(item + "/Skin", ref _Theme.TextureName, String.Empty); @@ -375,7 +375,7 @@ namespace VocaluxeLib.Menu _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref Rect.H); if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty)) - _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, SkinIndex, out Color); + _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out Color); else { _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref Color.R); @@ -390,7 +390,7 @@ namespace VocaluxeLib.Menu if (_ThemeLoaded) { - _Theme.Name = ElementName; + _Theme.Name = elementName; LoadTextures(); } return _ThemeLoaded; @@ -439,22 +439,22 @@ namespace VocaluxeLib.Menu public void Update() { - bool DoSpawn = false; + bool doSpawn = false; if (!_SpawnTimer.IsRunning) { _SpawnTimer.Start(); _NextSpawnTime = 0f; - DoSpawn = true; + doSpawn = true; } if (_SpawnTimer.ElapsedMilliseconds / 1000f > _NextSpawnTime && _NextSpawnTime >= 0f) { - DoSpawn = true; + doSpawn = true; _SpawnTimer.Reset(); _SpawnTimer.Start(); } - while (_Stars.Count < _MaxNumber && DoSpawn) + while (_Stars.Count < _MaxNumber && doSpawn) { float size = CBase.Game.GetRandom((int)_Size / 2) + _Size / 2; float lifetime = 0f; @@ -493,7 +493,7 @@ namespace VocaluxeLib.Menu vsize = lifetime * 2f; _NextSpawnTime = lifetime / _MaxNumber; - DoSpawn = false; + doSpawn = false; break; case EParticleType.Flare: diff --git a/VocaluxeLib/Menu/CPlaylist.cs b/VocaluxeLib/Menu/CPlaylist.cs index 0500887d..cf9f32e7 100644 --- a/VocaluxeLib/Menu/CPlaylist.cs +++ b/VocaluxeLib/Menu/CPlaylist.cs @@ -18,9 +18,9 @@ namespace VocaluxeLib.Menu public int SongID; public EGameMode GameMode; - public CPlaylistSong(int SongID, EGameMode gm) + public CPlaylistSong(int songID, EGameMode gm) { - this.SongID = SongID; + this.SongID = songID; GameMode = gm; } @@ -65,14 +65,14 @@ namespace VocaluxeLib.Menu public class CPlaylist : IMenuElement { - private class PlaylistElementContent + private class CPlaylistElementContent { public EGameMode[] Modes; public int SongID; public EGameMode Mode; } - private class PlaylistElement + private class CPlaylistElement { public CStatic Cover; public CStatic Background; @@ -80,9 +80,9 @@ namespace VocaluxeLib.Menu public CSelectSlide SelectSlide; public int Content; - public PlaylistElement() {} + public CPlaylistElement() {} - public PlaylistElement(PlaylistElement pe) + public CPlaylistElement(CPlaylistElement pe) { Cover = new CStatic(pe.Cover); Background = new CStatic(pe.Background); @@ -99,10 +99,10 @@ namespace VocaluxeLib.Menu Text1.Draw(); } - public void MouseMove(int PosX, int PosY, int OldPosX, int OldPosY) + public void MouseMove(int posX, int posY, int oldPosX, int oldPosY) { - int diffX = PosX - OldPosX; - int diffY = PosY - OldPosY; + int diffX = posX - oldPosX; + int diffY = posY - oldPosY; Cover.Rect.X += diffX; Cover.Rect.Y += diffY; @@ -135,8 +135,8 @@ namespace VocaluxeLib.Menu private readonly CObjectInteractions _Interactions; - private readonly List PlaylistElements; - private readonly List PlaylistElementContents; + private readonly List _PlaylistElements; + private readonly List _PlaylistElementContents; public SRectF CompleteRect; public SRectF Rect; @@ -153,37 +153,37 @@ namespace VocaluxeLib.Menu { _Selected = value; _Interactions.Active = value; - CurrentPlaylistElement = GetSelectedSelectionNr(); + CurrentPlaylistElement = _GetSelectedSelectionNr(); if (!value) { - if (_EditMode == EEditMode.ChangeOrder && ChangeOrderSource != -1 && PlaylistElements.Count > ChangeOrderSource) + if (EditMode == EEditMode.ChangeOrder && _ChangeOrderSource != -1 && _PlaylistElements.Count > _ChangeOrderSource) { - CBase.Playlist.DeletePlaylistSong(ActivePlaylistID, PlaylistElements[ChangeOrderSource].Content); + CBase.Playlist.DeletePlaylistSong(ActivePlaylistID, _PlaylistElements[_ChangeOrderSource].Content); UpdatePlaylist(); } - ChangeOrderSource = -1; - _EditMode = EEditMode.None; + _ChangeOrderSource = -1; + EditMode = EEditMode.None; } } } - public EEditMode _EditMode; + public EEditMode EditMode; public int ActivePlaylistID = -1; public int Offset = 0; public int CurrentPlaylistElement = -1; - private PlaylistElement ChangeOrderElement; - private int ChangeOrderSource = -1; - private int OldMousePosX; - private int OldMousePosY; + private CPlaylistElement _ChangeOrderElement; + private int _ChangeOrderSource = -1; + private int _OldMousePosX; + private int _OldMousePosY; public int DragAndDropSongID = -1; //private static - public CPlaylist(int PartyModeID) + public CPlaylist(int partyModeID) { - _PartyModeID = PartyModeID; + _PartyModeID = partyModeID; _Theme = new SThemePlaylist(); _Theme.Text1 = new CText(_PartyModeID); _Theme.StaticCover = new CStatic(_PartyModeID); @@ -201,11 +201,11 @@ namespace VocaluxeLib.Menu BackgroundColor = new SColorF(); BackgroundSelColor = new SColorF(); - PlaylistElements = new List(); - PlaylistElementContents = new List(); + _PlaylistElements = new List(); + _PlaylistElementContents = new List(); _Interactions = new CObjectInteractions(); - ChangeOrderElement = new PlaylistElement(); + _ChangeOrderElement = new CPlaylistElement(); Visible = false; Selected = false; @@ -214,7 +214,7 @@ namespace VocaluxeLib.Menu public void Init() { _Interactions.Clear(); - PrepareList(); + _PrepareList(); _Interactions.AddStatic(_Theme.StaticCover); _Interactions.AddStatic(_Theme.StaticPlaylistFooter); _Interactions.AddStatic(_Theme.StaticPlaylistHeader); @@ -225,9 +225,9 @@ namespace VocaluxeLib.Menu _Interactions.AddButton(_Theme.ButtonPlaylistSing); } - public bool LoadTheme(string XmlPath, string ElementName, CXMLReader xmlReader, int SkinIndex) + public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex) { - string item = XmlPath + "/" + ElementName; + string item = xmlPath + "/" + elementName; _ThemeLoaded = true; _ThemeLoaded &= xmlReader.GetValue(item + "/SkinBackground", ref _Theme.TextureBackgroundName, String.Empty); @@ -239,7 +239,7 @@ namespace VocaluxeLib.Menu _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/W", ref Rect.W); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref Rect.H); if (xmlReader.GetValue(item + "/ColorBackground", ref _Theme.ColorBackgroundName, String.Empty)) - _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorBackgroundName, SkinIndex, out BackgroundColor); + _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorBackgroundName, skinIndex, out BackgroundColor); else { _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/BackgroundR", ref BackgroundColor.R); @@ -248,7 +248,7 @@ namespace VocaluxeLib.Menu _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/BackgroundA", ref BackgroundColor.A); } if (xmlReader.GetValue(item + "/SColorBackground", ref _Theme.SelColorBackgroundName, String.Empty)) - _ThemeLoaded &= CBase.Theme.GetColor(_Theme.SelColorBackgroundName, SkinIndex, out BackgroundSelColor); + _ThemeLoaded &= CBase.Theme.GetColor(_Theme.SelColorBackgroundName, skinIndex, out BackgroundSelColor); else { _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SBackgroundR", ref BackgroundSelColor.R); @@ -257,24 +257,24 @@ namespace VocaluxeLib.Menu _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SBackgroundA", ref BackgroundSelColor.A); } - _ThemeLoaded &= _Theme.Text1.LoadTheme(item, "TextPart1", xmlReader, SkinIndex); + _ThemeLoaded &= _Theme.Text1.LoadTheme(item, "TextPart1", xmlReader, skinIndex); - _ThemeLoaded &= _Theme.StaticCover.LoadTheme(item, "StaticCover", xmlReader, SkinIndex); - _ThemeLoaded &= _Theme.StaticPlaylistHeader.LoadTheme(item, "StaticPlaylistHeader", xmlReader, SkinIndex); - _ThemeLoaded &= _Theme.StaticPlaylistFooter.LoadTheme(item, "StaticPlaylistFooter", xmlReader, SkinIndex); + _ThemeLoaded &= _Theme.StaticCover.LoadTheme(item, "StaticCover", xmlReader, skinIndex); + _ThemeLoaded &= _Theme.StaticPlaylistHeader.LoadTheme(item, "StaticPlaylistHeader", xmlReader, skinIndex); + _ThemeLoaded &= _Theme.StaticPlaylistFooter.LoadTheme(item, "StaticPlaylistFooter", xmlReader, skinIndex); - _ThemeLoaded &= _Theme.ButtonPlaylistName.LoadTheme(item, "ButtonPlaylistName", xmlReader, SkinIndex); - _ThemeLoaded &= _Theme.ButtonPlaylistSing.LoadTheme(item, "ButtonPlaylistSing", xmlReader, SkinIndex); - _ThemeLoaded &= _Theme.ButtonPlaylistClose.LoadTheme(item, "ButtonPlaylistClose", xmlReader, SkinIndex); - _ThemeLoaded &= _Theme.ButtonPlaylistSave.LoadTheme(item, "ButtonPlaylistSave", xmlReader, SkinIndex); - _ThemeLoaded &= _Theme.ButtonPlaylistDelete.LoadTheme(item, "ButtonPlaylistDelete", xmlReader, SkinIndex); + _ThemeLoaded &= _Theme.ButtonPlaylistName.LoadTheme(item, "ButtonPlaylistName", xmlReader, skinIndex); + _ThemeLoaded &= _Theme.ButtonPlaylistSing.LoadTheme(item, "ButtonPlaylistSing", xmlReader, skinIndex); + _ThemeLoaded &= _Theme.ButtonPlaylistClose.LoadTheme(item, "ButtonPlaylistClose", xmlReader, skinIndex); + _ThemeLoaded &= _Theme.ButtonPlaylistSave.LoadTheme(item, "ButtonPlaylistSave", xmlReader, skinIndex); + _ThemeLoaded &= _Theme.ButtonPlaylistDelete.LoadTheme(item, "ButtonPlaylistDelete", xmlReader, skinIndex); - _ThemeLoaded &= _Theme.SelectSlideGameMode.LoadTheme(item, "SelectSlideGameMode", xmlReader, SkinIndex); + _ThemeLoaded &= _Theme.SelectSlideGameMode.LoadTheme(item, "SelectSlideGameMode", xmlReader, skinIndex); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/EntryHeight", ref _Theme.EntryHeight); if (_ThemeLoaded) { - _Theme.Name = ElementName; + _Theme.Name = elementName; //Check for highest x/y-coords CompleteRect = Rect; @@ -403,35 +403,35 @@ namespace VocaluxeLib.Menu Draw(true); } - public void Draw(bool ForceDraw) + public void Draw(bool forceDraw) { - if (PlaylistElements.Count <= 0) + if (_PlaylistElements.Count <= 0) LoadPlaylist(0); - if (!Visible && CBase.Settings.GetGameState() != EGameState.EditTheme && !ForceDraw) + if (!Visible && CBase.Settings.GetGameState() != EGameState.EditTheme && !forceDraw) return; - for (int i = 0; i < PlaylistElements.Count; i++) + for (int i = 0; i < _PlaylistElements.Count; i++) { if (i == CurrentPlaylistElement && _Selected) { - PlaylistElements[i].Background.Texture = CBase.Theme.GetSkinTexture(_Theme.SelTextureBackgroundName, _PartyModeID); - PlaylistElements[i].Background.Color = BackgroundSelColor; + _PlaylistElements[i].Background.Texture = CBase.Theme.GetSkinTexture(_Theme.SelTextureBackgroundName, _PartyModeID); + _PlaylistElements[i].Background.Color = BackgroundSelColor; } else { - PlaylistElements[i].Background.Texture = CBase.Theme.GetSkinTexture(_Theme.TextureBackgroundName, _PartyModeID); - PlaylistElements[i].Background.Color = BackgroundColor; + _PlaylistElements[i].Background.Texture = CBase.Theme.GetSkinTexture(_Theme.TextureBackgroundName, _PartyModeID); + _PlaylistElements[i].Background.Color = BackgroundColor; } } _Interactions.Draw(); - if (_EditMode == EEditMode.ChangeOrder) - ChangeOrderElement.Draw(); + if (EditMode == EEditMode.ChangeOrder) + _ChangeOrderElement.Draw(); } - public bool IsMouseOver(MouseEvent MouseEvent) + public bool IsMouseOver(SMouseEvent mouseEvent) { - return CHelper.IsInBounds(CompleteRect, MouseEvent.X, MouseEvent.Y) || _Interactions.IsMouseOver(MouseEvent); + return CHelper.IsInBounds(CompleteRect, mouseEvent.X, mouseEvent.Y) || _Interactions.IsMouseOver(mouseEvent); } public void UnloadTextures() @@ -480,29 +480,29 @@ namespace VocaluxeLib.Menu LoadTextures(); } - public bool HandleInput(KeyEvent KeyEvent) + public bool HandleInput(SKeyEvent keyEvent) { if (Selected) { //Active EditMode ignores other input! - if (_EditMode == EEditMode.PlaylistName) + if (EditMode == EEditMode.PlaylistName) { - if (KeyEvent.KeyPressed && !Char.IsControl(KeyEvent.Unicode)) - _Theme.ButtonPlaylistName.Text.Text = _Theme.ButtonPlaylistName.Text.Text + KeyEvent.Unicode; - else if (KeyEvent.Key == Keys.Enter) + if (keyEvent.KeyPressed && !Char.IsControl(keyEvent.Unicode)) + _Theme.ButtonPlaylistName.Text.Text = _Theme.ButtonPlaylistName.Text.Text + keyEvent.Unicode; + else if (keyEvent.Key == Keys.Enter) { CBase.Playlist.SetPlaylistName(ActivePlaylistID, _Theme.ButtonPlaylistName.Text.Text); CBase.Playlist.SavePlaylist(ActivePlaylistID); - _EditMode = EEditMode.None; + EditMode = EEditMode.None; _Theme.ButtonPlaylistName.EditMode = false; } - else if (KeyEvent.Key == Keys.Escape) + else if (keyEvent.Key == Keys.Escape) { _Theme.ButtonPlaylistName.Text.Text = CBase.Playlist.GetPlaylistName(ActivePlaylistID); - _EditMode = EEditMode.None; + EditMode = EEditMode.None; _Theme.ButtonPlaylistName.EditMode = false; } - else if (KeyEvent.Key == Keys.Back || KeyEvent.Key == Keys.Delete) + else if (keyEvent.Key == Keys.Back || keyEvent.Key == Keys.Delete) { if (_Theme.ButtonPlaylistName.Text.Text.Length > 0) _Theme.ButtonPlaylistName.Text.Text = _Theme.ButtonPlaylistName.Text.Text.Remove(_Theme.ButtonPlaylistName.Text.Text.Length - 1); @@ -510,11 +510,11 @@ namespace VocaluxeLib.Menu } else { - if (CurrentPlaylistElement == -1 || PlaylistElementContents.Count == 0) + if (CurrentPlaylistElement == -1 || _PlaylistElementContents.Count == 0) { //no song is selected - _Interactions.HandleInput(KeyEvent); - CurrentPlaylistElement = GetSelectedSelectionNr(); + _Interactions.HandleInput(keyEvent); + CurrentPlaylistElement = _GetSelectedSelectionNr(); if (CurrentPlaylistElement != -1) return true; @@ -522,24 +522,24 @@ namespace VocaluxeLib.Menu else if (CurrentPlaylistElement != -1) { //a song is selected - int ScrollLimit = PlaylistElements.Count / 2; + int scrollLimit = _PlaylistElements.Count / 2; //special actions if a song is selected - switch (KeyEvent.Key) + switch (keyEvent.Key) { case Keys.Up: - if (KeyEvent.ModSHIFT) + if (keyEvent.ModShift) { - _Interactions.SetInteractionToSelectSlide(PlaylistElements[0].SelectSlide); - _Interactions.HandleInput(KeyEvent); - CurrentPlaylistElement = GetSelectedSelectionNr(); + _Interactions.SetInteractionToSelectSlide(_PlaylistElements[0].SelectSlide); + _Interactions.HandleInput(keyEvent); + CurrentPlaylistElement = _GetSelectedSelectionNr(); } - else if (CurrentPlaylistElement > ScrollLimit || PlaylistElementContents.Count == 0) + else if (CurrentPlaylistElement > scrollLimit || _PlaylistElementContents.Count == 0) { - _Interactions.HandleInput(KeyEvent); - CurrentPlaylistElement = GetSelectedSelectionNr(); + _Interactions.HandleInput(keyEvent); + CurrentPlaylistElement = _GetSelectedSelectionNr(); } - else if (CurrentPlaylistElement <= ScrollLimit) + else if (CurrentPlaylistElement <= scrollLimit) { if (Offset > 0) { @@ -548,47 +548,47 @@ namespace VocaluxeLib.Menu } else { - _Interactions.HandleInput(KeyEvent); - CurrentPlaylistElement = GetSelectedSelectionNr(); + _Interactions.HandleInput(keyEvent); + CurrentPlaylistElement = _GetSelectedSelectionNr(); } } break; case Keys.Down: - if (KeyEvent.ModSHIFT) + if (keyEvent.ModShift) { - for (int i = PlaylistElements.Count - 1; i >= 0; i--) + for (int i = _PlaylistElements.Count - 1; i >= 0; i--) { - if (PlaylistElements[i].SelectSlide.Visible) + if (_PlaylistElements[i].SelectSlide.Visible) { - _Interactions.SetInteractionToSelectSlide(PlaylistElements[0].SelectSlide); - _Interactions.HandleInput(KeyEvent); - CurrentPlaylistElement = GetSelectedSelectionNr(); + _Interactions.SetInteractionToSelectSlide(_PlaylistElements[0].SelectSlide); + _Interactions.HandleInput(keyEvent); + CurrentPlaylistElement = _GetSelectedSelectionNr(); } } } - else if (CurrentPlaylistElement >= ScrollLimit) + else if (CurrentPlaylistElement >= scrollLimit) { - if (Offset < PlaylistElementContents.Count - PlaylistElements.Count) + if (Offset < _PlaylistElementContents.Count - _PlaylistElements.Count) { Offset++; Update(); } else { - _Interactions.HandleInput(KeyEvent); - CurrentPlaylistElement = GetSelectedSelectionNr(); + _Interactions.HandleInput(keyEvent); + CurrentPlaylistElement = _GetSelectedSelectionNr(); } } - else if (CurrentPlaylistElement < ScrollLimit) + else if (CurrentPlaylistElement < scrollLimit) { - _Interactions.HandleInput(KeyEvent); - CurrentPlaylistElement = GetSelectedSelectionNr(); + _Interactions.HandleInput(keyEvent); + CurrentPlaylistElement = _GetSelectedSelectionNr(); } break; case Keys.Delete: - CBase.Playlist.DeletePlaylistSong(ActivePlaylistID, PlaylistElements[CurrentPlaylistElement].Content); + CBase.Playlist.DeletePlaylistSong(ActivePlaylistID, _PlaylistElements[CurrentPlaylistElement].Content); UpdatePlaylist(); if (Offset > 0) @@ -596,11 +596,11 @@ namespace VocaluxeLib.Menu Update(); - if (PlaylistElementContents.Count - 1 < CurrentPlaylistElement) - CurrentPlaylistElement = PlaylistElementContents.Count - 1; + if (_PlaylistElementContents.Count - 1 < CurrentPlaylistElement) + CurrentPlaylistElement = _PlaylistElementContents.Count - 1; if (CurrentPlaylistElement != -1) - _Interactions.SetInteractionToSelectSlide(PlaylistElements[CurrentPlaylistElement].SelectSlide); + _Interactions.SetInteractionToSelectSlide(_PlaylistElements[CurrentPlaylistElement].SelectSlide); break; case Keys.Back: @@ -608,24 +608,24 @@ namespace VocaluxeLib.Menu break; case Keys.Enter: - StartPlaylistSong(CurrentPlaylistElement); + _StartPlaylistSong(CurrentPlaylistElement); break; case Keys.Add: //move the selected song up - if (PlaylistElementContents.Count > 1 && (CurrentPlaylistElement > 0 || Offset > 0)) + if (_PlaylistElementContents.Count > 1 && (CurrentPlaylistElement > 0 || Offset > 0)) { CBase.Playlist.MovePlaylistSongUp(ActivePlaylistID, CurrentPlaylistElement + Offset); UpdatePlaylist(); - KeyEvent key = new KeyEvent(); + SKeyEvent key = new SKeyEvent(); key.Key = Keys.Up; - if (CurrentPlaylistElement > ScrollLimit) + if (CurrentPlaylistElement > scrollLimit) { _Interactions.HandleInput(key); - CurrentPlaylistElement = GetSelectedSelectionNr(); + CurrentPlaylistElement = _GetSelectedSelectionNr(); } - else if (CurrentPlaylistElement <= ScrollLimit) + else if (CurrentPlaylistElement <= scrollLimit) { if (Offset > 0) { @@ -635,24 +635,24 @@ namespace VocaluxeLib.Menu else { _Interactions.HandleInput(key); - CurrentPlaylistElement = GetSelectedSelectionNr(); + CurrentPlaylistElement = _GetSelectedSelectionNr(); } } } break; case Keys.Subtract: //move the selected song down - if (PlaylistElementContents.Count > 1 && CurrentPlaylistElement + Offset < PlaylistElementContents.Count - 1) + if (_PlaylistElementContents.Count > 1 && CurrentPlaylistElement + Offset < _PlaylistElementContents.Count - 1) { CBase.Playlist.MovePlaylistSongDown(ActivePlaylistID, CurrentPlaylistElement + Offset); UpdatePlaylist(); - KeyEvent key = new KeyEvent(); + SKeyEvent key = new SKeyEvent(); key.Key = Keys.Down; - if (CurrentPlaylistElement >= ScrollLimit) + if (CurrentPlaylistElement >= scrollLimit) { - if (Offset < PlaylistElementContents.Count - PlaylistElements.Count) + if (Offset < _PlaylistElementContents.Count - _PlaylistElements.Count) { Offset++; Update(); @@ -660,21 +660,21 @@ namespace VocaluxeLib.Menu else { _Interactions.HandleInput(key); - CurrentPlaylistElement = GetSelectedSelectionNr(); + CurrentPlaylistElement = _GetSelectedSelectionNr(); } } - else if (CurrentPlaylistElement < ScrollLimit) + else if (CurrentPlaylistElement < scrollLimit) { _Interactions.HandleInput(key); - CurrentPlaylistElement = GetSelectedSelectionNr(); + CurrentPlaylistElement = _GetSelectedSelectionNr(); } } break; case Keys.PageUp: //scroll up - if (PlaylistElementContents.Count > 0) + if (_PlaylistElementContents.Count > 0) { - Offset -= PlaylistElements.Count; + Offset -= _PlaylistElements.Count; if (Offset < 0) Offset = 0; @@ -685,21 +685,21 @@ namespace VocaluxeLib.Menu break; case Keys.PageDown: //scroll down - if (PlaylistElementContents.Count > 0) + if (_PlaylistElementContents.Count > 0) { - Offset += PlaylistElements.Count; + Offset += _PlaylistElements.Count; - if (Offset > PlaylistElementContents.Count - PlaylistElements.Count) - Offset = PlaylistElementContents.Count - PlaylistElements.Count; + if (Offset > _PlaylistElementContents.Count - _PlaylistElements.Count) + Offset = _PlaylistElementContents.Count - _PlaylistElements.Count; if (Offset < 0) Offset = 0; Update(); - for (int i = PlaylistElements.Count - 1; i >= 0; i--) + for (int i = _PlaylistElements.Count - 1; i >= 0; i--) { - if (PlaylistElements[i].SelectSlide.Visible) + if (_PlaylistElements[i].SelectSlide.Visible) { CurrentPlaylistElement = i; break; @@ -709,25 +709,25 @@ namespace VocaluxeLib.Menu break; case Keys.Left: - _Interactions.HandleInput(KeyEvent); - CurrentPlaylistElement = GetSelectedSelectionNr(); + _Interactions.HandleInput(keyEvent); + CurrentPlaylistElement = _GetSelectedSelectionNr(); if (CurrentPlaylistElement != -1) { CBase.Playlist.GetPlaylistSong(ActivePlaylistID, CurrentPlaylistElement + Offset).GameMode = - PlaylistElementContents[CurrentPlaylistElement + Offset].Modes[PlaylistElements[CurrentPlaylistElement].SelectSlide.Selection]; + _PlaylistElementContents[CurrentPlaylistElement + Offset].Modes[_PlaylistElements[CurrentPlaylistElement].SelectSlide.Selection]; UpdatePlaylist(); } break; case Keys.Right: - _Interactions.HandleInput(KeyEvent); - CurrentPlaylistElement = GetSelectedSelectionNr(); + _Interactions.HandleInput(keyEvent); + CurrentPlaylistElement = _GetSelectedSelectionNr(); if (CurrentPlaylistElement != -1) { CBase.Playlist.GetPlaylistSong(ActivePlaylistID, CurrentPlaylistElement + Offset).GameMode = - PlaylistElementContents[CurrentPlaylistElement + Offset].Modes[PlaylistElements[CurrentPlaylistElement].SelectSlide.Selection]; + _PlaylistElementContents[CurrentPlaylistElement + Offset].Modes[_PlaylistElements[CurrentPlaylistElement].SelectSlide.Selection]; UpdatePlaylist(); } break; @@ -736,12 +736,12 @@ namespace VocaluxeLib.Menu } //default actions - switch (KeyEvent.Key) + switch (keyEvent.Key) { case Keys.Back: if (_Theme.ButtonPlaylistName.Selected) { - _EditMode = EEditMode.PlaylistName; + EditMode = EEditMode.PlaylistName; _Theme.ButtonPlaylistName.EditMode = true; } else @@ -752,7 +752,7 @@ namespace VocaluxeLib.Menu if (_Theme.ButtonPlaylistClose.Selected) ClosePlaylist(); else if (_Theme.ButtonPlaylistSing.Selected) - StartPlaylistSongs(); + _StartPlaylistSongs(); else if (_Theme.ButtonPlaylistSave.Selected) CBase.Playlist.SavePlaylist(ActivePlaylistID); else if (_Theme.ButtonPlaylistDelete.Selected) @@ -762,14 +762,14 @@ namespace VocaluxeLib.Menu } else if (_Theme.ButtonPlaylistName.Selected) { - if (_EditMode != EEditMode.PlaylistName) + if (EditMode != EEditMode.PlaylistName) { - _EditMode = EEditMode.PlaylistName; + EditMode = EEditMode.PlaylistName; _Theme.ButtonPlaylistName.EditMode = true; } else { - _EditMode = EEditMode.None; + EditMode = EEditMode.None; _Theme.ButtonPlaylistName.EditMode = false; } } @@ -780,12 +780,12 @@ namespace VocaluxeLib.Menu return true; } - private void SetSelectionToLastEntry() + private void _SetSelectionToLastEntry() { - if (PlaylistElementContents.Count == 0) + if (_PlaylistElementContents.Count == 0) return; - int off = PlaylistElementContents.Count - PlaylistElements.Count; + int off = _PlaylistElementContents.Count - _PlaylistElements.Count; if (off >= 0) Offset = off; else @@ -793,9 +793,9 @@ namespace VocaluxeLib.Menu Update(); - for (int i = PlaylistElements.Count - 1; i >= 0; i--) + for (int i = _PlaylistElements.Count - 1; i >= 0; i--) { - if (PlaylistElements[i].SelectSlide.Visible) + if (_PlaylistElements[i].SelectSlide.Visible) { CurrentPlaylistElement = i; return; @@ -803,9 +803,9 @@ namespace VocaluxeLib.Menu } } - private void SetSelectionToFirstEntry() + private void _SetSelectionToFirstEntry() { - if (PlaylistElementContents.Count == 0) + if (_PlaylistElementContents.Count == 0) return; Offset = 0; @@ -814,11 +814,11 @@ namespace VocaluxeLib.Menu CurrentPlaylistElement = 0; } - private int GetSelectedSelectionNr() + private int _GetSelectedSelectionNr() { - for (int i = 0; i < PlaylistElements.Count; i++) + for (int i = 0; i < _PlaylistElements.Count; i++) { - if (PlaylistElements[i].SelectSlide.Selected) + if (_PlaylistElements[i].SelectSlide.Selected) return i; } return -1; @@ -826,10 +826,10 @@ namespace VocaluxeLib.Menu public void ScrollToBottom() { - if (PlaylistElementContents.Count == 0) + if (_PlaylistElementContents.Count == 0) return; - int off = PlaylistElementContents.Count - PlaylistElements.Count; + int off = _PlaylistElementContents.Count - _PlaylistElements.Count; if (off >= 0) Offset = off; else @@ -838,67 +838,67 @@ namespace VocaluxeLib.Menu Update(); } - public bool HandleMouse(MouseEvent MouseEvent) + public bool HandleMouse(SMouseEvent mouseEvent) { - _Interactions.HandleMouse(MouseEvent); + _Interactions.HandleMouse(mouseEvent); - if (CHelper.IsInBounds(CompleteRect, MouseEvent) && Visible) + if (CHelper.IsInBounds(CompleteRect, mouseEvent) && Visible) { //Scroll - if (MouseEvent.Wheel > 0) + if (mouseEvent.Wheel > 0) { - if (PlaylistElements.Count + Offset + MouseEvent.Wheel <= PlaylistElementContents.Count) + if (_PlaylistElements.Count + Offset + mouseEvent.Wheel <= _PlaylistElementContents.Count) { - Offset += MouseEvent.Wheel; + Offset += mouseEvent.Wheel; Update(); } return true; } - else if (MouseEvent.Wheel < 0) + else if (mouseEvent.Wheel < 0) { - if (Offset + MouseEvent.Wheel >= 0) + if (Offset + mouseEvent.Wheel >= 0) { - Offset += MouseEvent.Wheel; + Offset += mouseEvent.Wheel; Update(); } return true; } - bool hover_set = false; - for (int i = 0; i < PlaylistElements.Count; i++) + bool hoverSet = false; + for (int i = 0; i < _PlaylistElements.Count; i++) { //Hover for playlist-element - if (PlaylistElementContents.Count - 1 >= i && CHelper.IsInBounds(PlaylistElements[i].Background.Rect, MouseEvent)) + if (_PlaylistElementContents.Count - 1 >= i && CHelper.IsInBounds(_PlaylistElements[i].Background.Rect, mouseEvent)) { - hover_set = true; + hoverSet = true; CurrentPlaylistElement = i; - _Interactions.SetInteractionToSelectSlide(PlaylistElements[CurrentPlaylistElement].SelectSlide); - _Interactions.ProcessMouseMove(MouseEvent.X, MouseEvent.Y); + _Interactions.SetInteractionToSelectSlide(_PlaylistElements[CurrentPlaylistElement].SelectSlide); + _Interactions.ProcessMouseMove(mouseEvent.X, mouseEvent.Y); } //Delete Entry with RB - if (CHelper.IsInBounds(PlaylistElements[i].Background.Rect, MouseEvent) && MouseEvent.RB && PlaylistElements[i].Content != -1) + if (CHelper.IsInBounds(_PlaylistElements[i].Background.Rect, mouseEvent) && mouseEvent.RB && _PlaylistElements[i].Content != -1) { - CBase.Playlist.DeletePlaylistSong(ActivePlaylistID, PlaylistElements[i].Content); + CBase.Playlist.DeletePlaylistSong(ActivePlaylistID, _PlaylistElements[i].Content); UpdatePlaylist(); return true; } } - if (!hover_set) + if (!hoverSet) CurrentPlaylistElement = -1; - switch (_EditMode) + switch (EditMode) { //Normal mode case EEditMode.None: //LB actions - if (MouseEvent.LB) + if (mouseEvent.LB) { if (CurrentPlaylistElement != -1) { CBase.Playlist.GetPlaylistSong(ActivePlaylistID, CurrentPlaylistElement + Offset).GameMode = - PlaylistElementContents[CurrentPlaylistElement + Offset].Modes[PlaylistElements[CurrentPlaylistElement].SelectSlide.Selection]; + _PlaylistElementContents[CurrentPlaylistElement + Offset].Modes[_PlaylistElements[CurrentPlaylistElement].SelectSlide.Selection]; UpdatePlaylist(); } if (_Theme.ButtonPlaylistClose.Selected) @@ -908,7 +908,7 @@ namespace VocaluxeLib.Menu } else if (_Theme.ButtonPlaylistSing.Selected) { - StartPlaylistSongs(); + _StartPlaylistSongs(); return true; } else if (_Theme.ButtonPlaylistSave.Selected) @@ -924,43 +924,43 @@ namespace VocaluxeLib.Menu } else if (_Theme.ButtonPlaylistName.Selected) { - _EditMode = EEditMode.PlaylistName; + EditMode = EEditMode.PlaylistName; _Theme.ButtonPlaylistName.EditMode = true; return true; } } //Start selected song with double click - if (MouseEvent.LD && CurrentPlaylistElement != -1) - StartPlaylistSong(CurrentPlaylistElement); + if (mouseEvent.LD && CurrentPlaylistElement != -1) + _StartPlaylistSong(CurrentPlaylistElement); //Change order with holding LB - if (MouseEvent.LBH && CurrentPlaylistElement != -1 && PlaylistElementContents.Count > 0 && DragAndDropSongID == -1) + if (mouseEvent.LBH && CurrentPlaylistElement != -1 && _PlaylistElementContents.Count > 0 && DragAndDropSongID == -1) { - ChangeOrderSource = CurrentPlaylistElement + Offset; + _ChangeOrderSource = CurrentPlaylistElement + Offset; //Update of Drag/Drop-Texture - if (ChangeOrderSource >= PlaylistElementContents.Count) + if (_ChangeOrderSource >= _PlaylistElementContents.Count) return true; - ChangeOrderElement = new PlaylistElement(PlaylistElements[CurrentPlaylistElement]); - ChangeOrderElement.Background.Rect.Z = CBase.Settings.GetZNear(); - ChangeOrderElement.Cover.Rect.Z = CBase.Settings.GetZNear(); - ChangeOrderElement.SelectSlide.Rect.Z = CBase.Settings.GetZNear(); - ChangeOrderElement.SelectSlide.RectArrowLeft.Z = CBase.Settings.GetZNear(); - ChangeOrderElement.SelectSlide.RectArrowRight.Z = CBase.Settings.GetZNear(); - ChangeOrderElement.Text1.Z = CBase.Settings.GetZNear(); + _ChangeOrderElement = new CPlaylistElement(_PlaylistElements[CurrentPlaylistElement]); + _ChangeOrderElement.Background.Rect.Z = CBase.Settings.GetZNear(); + _ChangeOrderElement.Cover.Rect.Z = CBase.Settings.GetZNear(); + _ChangeOrderElement.SelectSlide.Rect.Z = CBase.Settings.GetZNear(); + _ChangeOrderElement.SelectSlide.RectArrowLeft.Z = CBase.Settings.GetZNear(); + _ChangeOrderElement.SelectSlide.RectArrowRight.Z = CBase.Settings.GetZNear(); + _ChangeOrderElement.Text1.Z = CBase.Settings.GetZNear(); - ChangeOrderElement.Background.Texture = CBase.Theme.GetSkinTexture(_Theme.TextureBackgroundName, _PartyModeID); - ChangeOrderElement.Background.Color = BackgroundColor; + _ChangeOrderElement.Background.Texture = CBase.Theme.GetSkinTexture(_Theme.TextureBackgroundName, _PartyModeID); + _ChangeOrderElement.Background.Color = BackgroundColor; - OldMousePosX = MouseEvent.X; - OldMousePosY = MouseEvent.Y; + _OldMousePosX = mouseEvent.X; + _OldMousePosY = mouseEvent.Y; - _EditMode = EEditMode.ChangeOrder; + EditMode = EEditMode.ChangeOrder; } - if (!MouseEvent.LBH && DragAndDropSongID != -1) + if (!mouseEvent.LBH && DragAndDropSongID != -1) { EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL; CSong song = CBase.Songs.GetSongByID(DragAndDropSongID); @@ -977,26 +977,26 @@ namespace VocaluxeLib.Menu } else { - if (MouseEvent.Y < PlaylistElements[0].Background.Rect.Y && Offset == 0) + if (mouseEvent.Y < _PlaylistElements[0].Background.Rect.Y && Offset == 0) { CBase.Playlist.InsertPlaylistSong(ActivePlaylistID, 0, DragAndDropSongID, gm); UpdatePlaylist(); } else { - if (PlaylistElements.Count + Offset >= PlaylistElementContents.Count) + if (_PlaylistElements.Count + Offset >= _PlaylistElementContents.Count) { float min = 0f; - for (int i = PlaylistElements.Count - 1; i >= 0; i--) + for (int i = _PlaylistElements.Count - 1; i >= 0; i--) { - if (PlaylistElements[i].SelectSlide.Visible) + if (_PlaylistElements[i].SelectSlide.Visible) { - min = PlaylistElements[i].SelectSlide.Rect.Y + PlaylistElements[i].SelectSlide.Rect.H; + min = _PlaylistElements[i].SelectSlide.Rect.Y + _PlaylistElements[i].SelectSlide.Rect.H; break; } } - if (MouseEvent.Y > min) + if (mouseEvent.Y > min) { CBase.Playlist.AddPlaylistSong(ActivePlaylistID, DragAndDropSongID, gm); UpdatePlaylist(); @@ -1015,22 +1015,22 @@ namespace VocaluxeLib.Menu case EEditMode.PlaylistName: _Interactions.SetInteractionToButton(_Theme.ButtonPlaylistName); CurrentPlaylistElement = -1; - if (MouseEvent.LB) + if (mouseEvent.LB) { if (_Theme.ButtonPlaylistName.Selected) { CBase.Playlist.SetPlaylistName(ActivePlaylistID, _Theme.ButtonPlaylistName.Text.Text); CBase.Playlist.SavePlaylist(ActivePlaylistID); - _EditMode = EEditMode.None; + EditMode = EEditMode.None; return true; } } - else if (MouseEvent.RB) + else if (mouseEvent.RB) { if (_Theme.ButtonPlaylistName.Selected) { _Theme.ButtonPlaylistName.Text.Text = CBase.Playlist.GetPlaylistName(ActivePlaylistID); - _EditMode = EEditMode.None; + EditMode = EEditMode.None; _Theme.ButtonPlaylistName.EditMode = false; return true; } @@ -1041,43 +1041,43 @@ namespace VocaluxeLib.Menu //Actions according to playlist-element //Update coords for Drag/Drop-Texture - ChangeOrderElement.MouseMove(MouseEvent.X, MouseEvent.Y, OldMousePosX, OldMousePosY); - OldMousePosX = MouseEvent.X; - OldMousePosY = MouseEvent.Y; + _ChangeOrderElement.MouseMove(mouseEvent.X, mouseEvent.Y, _OldMousePosX, _OldMousePosY); + _OldMousePosX = mouseEvent.X; + _OldMousePosY = mouseEvent.Y; - if (!MouseEvent.LBH) + if (!mouseEvent.LBH) { - if (CurrentPlaylistElement != -1 && CurrentPlaylistElement + Offset != ChangeOrderSource) + if (CurrentPlaylistElement != -1 && CurrentPlaylistElement + Offset != _ChangeOrderSource) { - CBase.Playlist.MovePlaylistSong(ActivePlaylistID, ChangeOrderSource, CurrentPlaylistElement + Offset); + CBase.Playlist.MovePlaylistSong(ActivePlaylistID, _ChangeOrderSource, CurrentPlaylistElement + Offset); UpdatePlaylist(); } else if (CurrentPlaylistElement == -1) { - if (MouseEvent.Y < PlaylistElements[0].Background.Rect.Y && Offset == 0) - CBase.Playlist.MovePlaylistSong(ActivePlaylistID, ChangeOrderSource, 0); + if (mouseEvent.Y < _PlaylistElements[0].Background.Rect.Y && Offset == 0) + CBase.Playlist.MovePlaylistSong(ActivePlaylistID, _ChangeOrderSource, 0); else { - if (PlaylistElements.Count + Offset >= PlaylistElementContents.Count) + if (_PlaylistElements.Count + Offset >= _PlaylistElementContents.Count) { float min = 0f; - for (int i = PlaylistElements.Count - 1; i >= 0; i--) + for (int i = _PlaylistElements.Count - 1; i >= 0; i--) { - if (PlaylistElements[i].SelectSlide.Visible) + if (_PlaylistElements[i].SelectSlide.Visible) { - min = PlaylistElements[i].SelectSlide.Rect.Y + PlaylistElements[i].SelectSlide.Rect.H; + min = _PlaylistElements[i].SelectSlide.Rect.Y + _PlaylistElements[i].SelectSlide.Rect.H; break; } } - if (MouseEvent.Y > min) - CBase.Playlist.MovePlaylistSong(ActivePlaylistID, ChangeOrderSource, PlaylistElementContents.Count - 1); + if (mouseEvent.Y > min) + CBase.Playlist.MovePlaylistSong(ActivePlaylistID, _ChangeOrderSource, _PlaylistElementContents.Count - 1); } } UpdatePlaylist(); } - _EditMode = EEditMode.None; + EditMode = EEditMode.None; } break; } @@ -1085,13 +1085,13 @@ namespace VocaluxeLib.Menu return false; } - private void PrepareList() + private void _PrepareList() { - PlaylistElements.Clear(); + _PlaylistElements.Clear(); for (int i = 0; i < Math.Floor(Rect.H / _Theme.EntryHeight); i++) { - PlaylistElement en = new PlaylistElement(); + CPlaylistElement en = new CPlaylistElement(); en.Background = new CStatic(_PartyModeID, _Theme.TextureBackgroundName, BackgroundColor, new SRectF(Rect.X, Rect.Y + (i * _Theme.EntryHeight), Rect.W, _Theme.EntryHeight, Rect.Z)); @@ -1114,7 +1114,7 @@ namespace VocaluxeLib.Menu en.Content = -1; - PlaylistElements.Add(en); + _PlaylistElements.Add(en); _Interactions.AddSelectSlide(en.SelectSlide); _Interactions.AddText(en.Text1); _Interactions.AddStatic(en.Background); @@ -1122,20 +1122,20 @@ namespace VocaluxeLib.Menu } } - public bool LoadPlaylist(int PlaylistID) + public bool LoadPlaylist(int playlistID) { - if (PlaylistID > -1 && PlaylistID < CBase.Playlist.GetNumPlaylists()) + if (playlistID > -1 && playlistID < CBase.Playlist.GetNumPlaylists()) { _Theme.ButtonPlaylistName.Text.Text = CBase.Playlist.GetPlaylistName(ActivePlaylistID); - ActivePlaylistID = PlaylistID; - PlaylistElementContents.Clear(); + ActivePlaylistID = playlistID; + _PlaylistElementContents.Clear(); for (int i = 0; i < CBase.Playlist.GetPlaylistSongCount(ActivePlaylistID); i++) { - PlaylistElementContent pec = new PlaylistElementContent(); + CPlaylistElementContent pec = new CPlaylistElementContent(); pec.SongID = CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).SongID; pec.Modes = CBase.Songs.GetSongByID(CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).SongID).AvailableGameModes; pec.Mode = CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).GameMode; - PlaylistElementContents.Add(pec); + _PlaylistElementContents.Add(pec); } Update(); return true; @@ -1146,14 +1146,14 @@ namespace VocaluxeLib.Menu public void UpdatePlaylist() { - PlaylistElementContents.Clear(); + _PlaylistElementContents.Clear(); for (int i = 0; i < CBase.Playlist.GetPlaylistSongCount(ActivePlaylistID); i++) { - PlaylistElementContent pec = new PlaylistElementContent(); + CPlaylistElementContent pec = new CPlaylistElementContent(); pec.SongID = CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).SongID; pec.Modes = CBase.Songs.GetSongByID(pec.SongID).AvailableGameModes; pec.Mode = CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).GameMode; - PlaylistElementContents.Add(pec); + _PlaylistElementContents.Add(pec); } Update(); @@ -1166,7 +1166,7 @@ namespace VocaluxeLib.Menu ActivePlaylistID = -1; } - private void StartPlaylistSongs() + private void _StartPlaylistSongs() { CBase.Game.Reset(); CBase.Game.ClearSongs(); @@ -1180,7 +1180,7 @@ namespace VocaluxeLib.Menu } } - private void StartPlaylistSong(int selected) + private void _StartPlaylistSong(int selected) { CBase.Game.Reset(); CBase.Game.ClearSongs(); @@ -1195,35 +1195,35 @@ namespace VocaluxeLib.Menu { if (ActivePlaylistID > -1 && ActivePlaylistID < CBase.Playlist.GetNumPlaylists()) { - for (int i = 0; i < PlaylistElements.Count; i++) + for (int i = 0; i < _PlaylistElements.Count; i++) { - if (Offset + i < PlaylistElementContents.Count) + if (Offset + i < _PlaylistElementContents.Count) { - PlaylistElements[i].Content = Offset + i; - PlaylistElements[i].Background.Visible = true; - PlaylistElements[i].Cover.Visible = true; - PlaylistElements[i].SelectSlide.Visible = true; - PlaylistElements[i].Text1.Visible = true; - PlaylistElementContent pec = PlaylistElementContents[Offset + i]; + _PlaylistElements[i].Content = Offset + i; + _PlaylistElements[i].Background.Visible = true; + _PlaylistElements[i].Cover.Visible = true; + _PlaylistElements[i].SelectSlide.Visible = true; + _PlaylistElements[i].Text1.Visible = true; + CPlaylistElementContent pec = _PlaylistElementContents[Offset + i]; CSong song = CBase.Songs.GetSongByID(pec.SongID); - PlaylistElements[i].Cover.Texture = song.CoverTextureSmall; + _PlaylistElements[i].Cover.Texture = song.CoverTextureSmall; string t1 = _Theme.Text1.Text.Replace("%a", song.Artist).Replace("%t", song.Title); - PlaylistElements[i].Text1.Text = /*(Offset + i + 1).ToString() + ") " + */ song.Artist + " - " + song.Title; //TODO: Add text field for the number - PlaylistElements[i].SelectSlide.Clear(); + _PlaylistElements[i].Text1.Text = /*(Offset + i + 1).ToString() + ") " + */ song.Artist + " - " + song.Title; //TODO: Add text field for the number + _PlaylistElements[i].SelectSlide.Clear(); for (int g = 0; g < pec.Modes.Length; g++) { - PlaylistElements[i].SelectSlide.AddValue(Enum.GetName(typeof(EGameMode), pec.Modes[g])); + _PlaylistElements[i].SelectSlide.AddValue(Enum.GetName(typeof(EGameMode), pec.Modes[g])); if (pec.Modes[g] == pec.Mode) - PlaylistElements[i].SelectSlide.SetSelectionByValueIndex(g); + _PlaylistElements[i].SelectSlide.SetSelectionByValueIndex(g); } } else { - PlaylistElements[i].Background.Visible = false; - PlaylistElements[i].Cover.Visible = false; - PlaylistElements[i].SelectSlide.Visible = false; - PlaylistElements[i].Text1.Visible = false; - PlaylistElements[i].Content = -1; + _PlaylistElements[i].Background.Visible = false; + _PlaylistElements[i].Cover.Visible = false; + _PlaylistElements[i].SelectSlide.Visible = false; + _PlaylistElements[i].Text1.Visible = false; + _PlaylistElements[i].Content = -1; } } } diff --git a/VocaluxeLib/Menu/CPoints.cs b/VocaluxeLib/Menu/CPoints.cs index 5b3d3b11..1ac00827 100644 --- a/VocaluxeLib/Menu/CPoints.cs +++ b/VocaluxeLib/Menu/CPoints.cs @@ -8,17 +8,17 @@ namespace VocaluxeLib.Menu { private readonly SPlayer[,] _Rounds; - public CPoints(int NumRounds, SPlayer[] Players) + public CPoints(int numRounds, SPlayer[] players) { - _Rounds = new SPlayer[NumRounds, Players.Length]; + _Rounds = new SPlayer[numRounds, players.Length]; - for (int round = 0; round < NumRounds; round++) + for (int round = 0; round < numRounds; round++) { - for (int player = 0; player < Players.Length; player++) + for (int player = 0; player < players.Length; player++) { - _Rounds[round, player].ProfileID = Players[player].ProfileID; - _Rounds[round, player].Name = Players[player].Name; - _Rounds[round, player].Difficulty = Players[player].Difficulty; + _Rounds[round, player].ProfileID = players[player].ProfileID; + _Rounds[round, player].Name = players[player].Name; + _Rounds[round, player].Difficulty = players[player].Difficulty; _Rounds[round, player].Points = 0f; _Rounds[round, player].PointsGoldenNotes = 0f; _Rounds[round, player].PointsLineBonus = 0f; @@ -30,21 +30,21 @@ namespace VocaluxeLib.Menu } } - public void SetPoints(int Round, int SongID, SPlayer[] Players, bool Medley, bool Duet, bool ShortSong) + public void SetPoints(int round, int songID, SPlayer[] players, bool medley, bool duet, bool shortSong) { - long DateTicks = DateTime.Now.Ticks; - for (int player = 0; player < Players.Length; player++) + long dateTicks = DateTime.Now.Ticks; + for (int player = 0; player < players.Length; player++) { - _Rounds[Round, player].SongID = SongID; - _Rounds[Round, player].LineNr = Players[player].LineNr; - _Rounds[Round, player].Points = Players[player].Points; - _Rounds[Round, player].PointsGoldenNotes = Players[player].PointsGoldenNotes; - _Rounds[Round, player].PointsLineBonus = Players[player].PointsLineBonus; - _Rounds[Round, player].Medley = Medley; - _Rounds[Round, player].Duet = Duet; - _Rounds[Round, player].ShortSong = ShortSong; - _Rounds[Round, player].DateTicks = DateTicks; - _Rounds[Round, player].SongFinished = Players[player].SongFinished; + _Rounds[round, player].SongID = songID; + _Rounds[round, player].LineNr = players[player].LineNr; + _Rounds[round, player].Points = players[player].Points; + _Rounds[round, player].PointsGoldenNotes = players[player].PointsGoldenNotes; + _Rounds[round, player].PointsLineBonus = players[player].PointsLineBonus; + _Rounds[round, player].Medley = medley; + _Rounds[round, player].Duet = duet; + _Rounds[round, player].ShortSong = shortSong; + _Rounds[round, player].DateTicks = dateTicks; + _Rounds[round, player].SongFinished = players[player].SongFinished; } } @@ -58,30 +58,30 @@ namespace VocaluxeLib.Menu get { return _Rounds.GetLength(1); } } - public SPlayer[] GetPlayer(int Round, int numPlayer) + public SPlayer[] GetPlayer(int round, int numPlayer) { if (NumPlayer == 0) return new SPlayer[1]; - if (Round >= NumRounds) + if (round >= NumRounds) return new SPlayer[1]; SPlayer[] player = new SPlayer[numPlayer]; for (int p = 0; p < player.Length; p++) { - player[p].Name = _Rounds[Round, p].Name; - 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].Difficulty = _Rounds[Round, p].Difficulty; - 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; + player[p].Name = _Rounds[round, p].Name; + 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].Difficulty = _Rounds[round, p].Difficulty; + 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; } return player; } diff --git a/VocaluxeLib/Menu/CScreenSetting.cs b/VocaluxeLib/Menu/CScreenSetting.cs index 49bcd712..abda8752 100644 --- a/VocaluxeLib/Menu/CScreenSetting.cs +++ b/VocaluxeLib/Menu/CScreenSetting.cs @@ -30,9 +30,9 @@ namespace VocaluxeLib.Menu return _Theme.Name; } - public CScreenSetting(int PartyModeID) + public CScreenSetting(int partyModeID) { - _PartyModeID = PartyModeID; + _PartyModeID = partyModeID; _Theme = new SScreenSetting(); _ThemeLoaded = false; } @@ -44,16 +44,16 @@ namespace VocaluxeLib.Menu _ThemeLoaded = ts._ThemeLoaded; } - public bool LoadTheme(string XmlPath, string ElementName, CXMLReader xmlReader, int SkinIndex) + public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex) { - string item = XmlPath + "/" + ElementName; + string item = xmlPath + "/" + elementName; _ThemeLoaded = true; _ThemeLoaded &= xmlReader.GetValue(item + "/Value", ref _Theme.Value, String.Empty); _ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/Type", ref _Theme.Type); if (_ThemeLoaded) - _Theme.Name = ElementName; + _Theme.Name = elementName; return _ThemeLoaded; } @@ -78,16 +78,16 @@ namespace VocaluxeLib.Menu switch (_Theme.Type) { case ESettingType.Int: - return GetIntValue(_Theme.Value); + return _GetIntValue(_Theme.Value); case ESettingType.String: return _Theme.Value; case ESettingType.Color: - return GetColorValue(_Theme.Value); + return _GetColorValue(_Theme.Value); case ESettingType.Texture: - return GetTextureValue(_Theme.Value); + return _GetTextureValue(_Theme.Value); } return null; @@ -100,7 +100,7 @@ namespace VocaluxeLib.Menu public void ReloadTextures() {} #region Private - private int GetIntValue(string value) + private int _GetIntValue(string value) { try { @@ -112,12 +112,12 @@ namespace VocaluxeLib.Menu } } - private STexture GetTextureValue(string value) + private STexture _GetTextureValue(string value) { return CBase.Theme.GetSkinTexture(value, _PartyModeID); } - private SColorF GetColorValue(string value) + private SColorF _GetColorValue(string value) { return CBase.Theme.GetColor(value, _PartyModeID); } diff --git a/VocaluxeLib/Menu/CSelectSlide.cs b/VocaluxeLib/Menu/CSelectSlide.cs index 43d08123..ed049e8e 100644 --- a/VocaluxeLib/Menu/CSelectSlide.cs +++ b/VocaluxeLib/Menu/CSelectSlide.cs @@ -138,9 +138,9 @@ namespace VocaluxeLib.Menu } } - public CSelectSlide(int PartyModeID) + public CSelectSlide(int partyModeID) { - _PartyModeID = PartyModeID; + _PartyModeID = partyModeID; _Theme = new SThemeSelectSlide(); _ThemeLoaded = false; @@ -225,9 +225,9 @@ namespace VocaluxeLib.Menu Visible = slide.Visible; } - public bool LoadTheme(string XmlPath, string ElementName, CXMLReader xmlReader, int SkinIndex) + public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex) { - string item = XmlPath + "/" + ElementName; + string item = xmlPath + "/" + elementName; _ThemeLoaded = true; _ThemeLoaded &= xmlReader.GetValue(item + "/Skin", ref _Theme.TextureName, String.Empty); @@ -247,7 +247,7 @@ namespace VocaluxeLib.Menu _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref Rect.H); if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty)) - _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, SkinIndex, out Color); + _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out Color); else { _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref Color.R); @@ -257,7 +257,7 @@ namespace VocaluxeLib.Menu } if (xmlReader.GetValue(item + "/SColor", ref _Theme.SelColorName, String.Empty)) - _ThemeLoaded &= CBase.Theme.GetColor(_Theme.SelColorName, SkinIndex, out SelColor); + _ThemeLoaded &= CBase.Theme.GetColor(_Theme.SelColorName, skinIndex, out SelColor); else { _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SR", ref SelColor.R); @@ -267,7 +267,7 @@ namespace VocaluxeLib.Menu } if (xmlReader.GetValue(item + "/HColor", ref _Theme.HighlightColorName, String.Empty)) - _ThemeLoaded &= CBase.Theme.GetColor(_Theme.HighlightColorName, SkinIndex, out HighlightColor); + _ThemeLoaded &= CBase.Theme.GetColor(_Theme.HighlightColorName, skinIndex, out HighlightColor); else { _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/HR", ref HighlightColor.R); @@ -289,7 +289,7 @@ namespace VocaluxeLib.Menu _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowRightH", ref RectArrowRight.H); if (xmlReader.GetValue(item + "/ArrowColor", ref _Theme.ArrowColorName, String.Empty)) - _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ArrowColorName, SkinIndex, out ColorArrow); + _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ArrowColorName, skinIndex, out ColorArrow); else { _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowR", ref ColorArrow.R); @@ -299,7 +299,7 @@ namespace VocaluxeLib.Menu } if (xmlReader.GetValue(item + "/ArrowSColor", ref _Theme.SelArrowColorName, String.Empty)) - _ThemeLoaded &= CBase.Theme.GetColor(_Theme.SelArrowColorName, SkinIndex, out SelColorArrow); + _ThemeLoaded &= CBase.Theme.GetColor(_Theme.SelArrowColorName, skinIndex, out SelColorArrow); else { _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowSR", ref SelColorArrow.R); @@ -309,7 +309,7 @@ namespace VocaluxeLib.Menu } if (xmlReader.GetValue(item + "/TextColor", ref _Theme.TextColorName, String.Empty)) - _ThemeLoaded &= CBase.Theme.GetColor(_Theme.TextColorName, SkinIndex, out TextColor); + _ThemeLoaded &= CBase.Theme.GetColor(_Theme.TextColorName, skinIndex, out TextColor); else { _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextR", ref TextColor.R); @@ -319,7 +319,7 @@ namespace VocaluxeLib.Menu } if (xmlReader.GetValue(item + "/TextSColor", ref _Theme.SelTextColorName, String.Empty)) - _ThemeLoaded &= CBase.Theme.GetColor(_Theme.SelTextColorName, SkinIndex, out SelTextColor); + _ThemeLoaded &= CBase.Theme.GetColor(_Theme.SelTextColorName, skinIndex, out SelTextColor); else { _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextSR", ref SelTextColor.R); @@ -341,7 +341,7 @@ namespace VocaluxeLib.Menu if (_ThemeLoaded) { - _Theme.Name = ElementName; + _Theme.Name = elementName; LoadTextures(); } return _ThemeLoaded; @@ -515,9 +515,9 @@ namespace VocaluxeLib.Menu AddValue(value, _PartyModeID); } - public void AddValue(string value, int PartyModeID) + public void AddValue(string value, int partyModeID) { - AddValue(value, new STexture(-1), _ValueIndexes.Count, PartyModeID); + AddValue(value, new STexture(-1), _ValueIndexes.Count, partyModeID); } public void AddValue(string value, STexture texture) @@ -525,17 +525,17 @@ namespace VocaluxeLib.Menu AddValue(value, texture, _ValueIndexes.Count, _PartyModeID); } - private void AddValue(string value, STexture texture, int valueIndex) + private void _AddValue(string value, STexture texture, int valueIndex) { AddValue(value, texture, valueIndex, _PartyModeID); } - public void AddValue(string value, STexture texture, int valueIndex, int PartyModeID) + public void AddValue(string value, STexture texture, int valueIndex, int partyModeID) { _ValueNames.Add(value); _Textures.Add(texture); _ValueIndexes.Add(valueIndex); - _ValuePartyModeIDs.Add(PartyModeID); + _ValuePartyModeIDs.Add(partyModeID); if (Selection == -1) Selection = 0; @@ -546,7 +546,7 @@ namespace VocaluxeLib.Menu public void AddValues(string[] values) { foreach (string value in values) - AddValue(value, new STexture(-1), _PartyModeID); + _AddValue(value, new STexture(-1), _PartyModeID); _ValueBounds.Clear(); } @@ -570,30 +570,30 @@ namespace VocaluxeLib.Menu Selection = selection; } - public void RenameValue(string NewName) + public void RenameValue(string newName) { - RenameValue(Selection, NewName); + RenameValue(Selection, newName); } - public void RenameValue(int selection, string NewName) + public void RenameValue(int selection, string newName) { - RenameValue(selection, NewName, new STexture(-1)); + RenameValue(selection, newName, new STexture(-1)); } - public void RenameValue(int selection, string NewName, STexture NewTexture) + public void RenameValue(int selection, string newName, STexture newTexture) { if (selection < 0 && selection >= _ValueNames.Count) return; - _ValueNames[selection] = NewName; - _Textures[selection] = NewTexture; + _ValueNames[selection] = newName; + _Textures[selection] = newTexture; } - public bool SetSelectionByValueIndex(int ValueIndex) + public bool SetSelectionByValueIndex(int valueIndex) { for (int i = 0; i < _ValueIndexes.Count; i++) { - if (_ValueIndexes[i] == ValueIndex) + if (_ValueIndexes[i] == valueIndex) { Selection = i; return true; @@ -683,40 +683,40 @@ namespace VocaluxeLib.Menu if (!Visible && CBase.Settings.GetGameState() != EGameState.EditTheme) return; - STexture Texture = CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID); - STexture TextureArrowLeft = CBase.Theme.GetSkinTexture(_Theme.TextureArrowLeftName, _PartyModeID); - STexture TextureArrowRight = CBase.Theme.GetSkinTexture(_Theme.TextureArrowRightName, _PartyModeID); + STexture texture = CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID); + STexture textureArrowLeft = CBase.Theme.GetSkinTexture(_Theme.TextureArrowLeftName, _PartyModeID); + STexture textureArrowRight = CBase.Theme.GetSkinTexture(_Theme.TextureArrowRightName, _PartyModeID); STexture selTexture = CBase.Theme.GetSkinTexture(_Theme.SelTextureName, _PartyModeID); STexture selTextureArrowLeft = CBase.Theme.GetSkinTexture(_Theme.SelTextureArrowLeftName, _PartyModeID); - STexture SelTextureArrowRight = CBase.Theme.GetSkinTexture(_Theme.SelTextureArrowRightName, _PartyModeID); + STexture selTextureArrowRight = CBase.Theme.GetSkinTexture(_Theme.SelTextureArrowRightName, _PartyModeID); - STexture HighlightTexture = CBase.Theme.GetSkinTexture(_Theme.HighlightTextureName, _PartyModeID); + STexture highlightTexture = CBase.Theme.GetSkinTexture(_Theme.HighlightTextureName, _PartyModeID); if (Selected) { if (Highlighted) - CBase.Drawing.DrawTexture(HighlightTexture, Rect, HighlightColor); + CBase.Drawing.DrawTexture(highlightTexture, Rect, HighlightColor); else CBase.Drawing.DrawTexture(selTexture, Rect, SelColor); } else - CBase.Drawing.DrawTexture(Texture, Rect, Color); + CBase.Drawing.DrawTexture(texture, Rect, Color); if (_Selection > 0 || CBase.Settings.GetGameState() == EGameState.EditTheme) { if (_ArrowLeftSelected) CBase.Drawing.DrawTexture(selTextureArrowLeft, RectArrowLeft, SelColorArrow); else - CBase.Drawing.DrawTexture(TextureArrowLeft, RectArrowLeft, ColorArrow); + CBase.Drawing.DrawTexture(textureArrowLeft, RectArrowLeft, ColorArrow); } if (_Selection < _ValueNames.Count - 1 || CBase.Settings.GetGameState() == EGameState.EditTheme) { if (_ArrowRightSelected) - CBase.Drawing.DrawTexture(SelTextureArrowRight, RectArrowRight, SelColorArrow); + CBase.Drawing.DrawTexture(selTextureArrowRight, RectArrowRight, SelColorArrow); else - CBase.Drawing.DrawTexture(TextureArrowRight, RectArrowRight, ColorArrow); + CBase.Drawing.DrawTexture(textureArrowRight, RectArrowRight, ColorArrow); } if (_NumVisible < 1 || _ValueNames.Count == 0) @@ -741,36 +741,36 @@ namespace VocaluxeLib.Menu _ValueBounds.Clear(); for (int i = 0; i < numvis; i++) { - CText Text = new CText(0, 0, 0, TextH, MaxW, EAlignment.Center, _Theme.TextStyle, _Theme.TextFont, TextColor, _ValueNames[i + offset], + CText text = new CText(0, 0, 0, TextH, MaxW, EAlignment.Center, _Theme.TextStyle, _Theme.TextFont, TextColor, _ValueNames[i + offset], _ValuePartyModeIDs[i + offset]); - SColorF Alpha = new SColorF(1f, 1f, 1f, 0.35f); + SColorF alpha = new SColorF(1f, 1f, 1f, 0.35f); if (i + offset == _Selection) { - Text.Color = SelTextColor; - Alpha = new SColorF(1f, 1f, 1f, 1f); + text.Color = SelTextColor; + alpha = new SColorF(1f, 1f, 1f, 1f); } - RectangleF bounds = CBase.Drawing.GetTextBounds(Text); - Text.X = (x + dx / 2f + dx * i) + TextRelativeX; + RectangleF bounds = CBase.Drawing.GetTextBounds(text); + text.X = (x + dx / 2f + dx * i) + TextRelativeX; if (!WithTextures) - Text.Y = (int)((Rect.Y + (Rect.H - bounds.Height) / 2) + TextRelativeY); + text.Y = (int)((Rect.Y + (Rect.H - bounds.Height) / 2) + TextRelativeY); else - Text.Y = (int)((Rect.Y + (Rect.H - bounds.Height)) + TextRelativeY); + text.Y = (int)((Rect.Y + (Rect.H - bounds.Height)) + TextRelativeY); - Text.Z = Rect.Z; - Text.Draw(); + text.Z = Rect.Z; + text.Draw(); if (WithTextures) { - float dh = Text.Y - Rect.Y - Rect.H * 0.1f; - SRectF rect = new SRectF(Text.X - dh / 2, Rect.Y + Rect.H * 0.05f, dh, dh, Rect.Z); - CBase.Drawing.DrawTexture(_Textures[i + offset], rect, Alpha); + float dh = text.Y - Rect.Y - Rect.H * 0.1f; + SRectF rect = new SRectF(text.X - dh / 2, Rect.Y + Rect.H * 0.05f, dh, dh, Rect.Z); + CBase.Drawing.DrawTexture(_Textures[i + offset], rect, alpha); _ValueBounds.Add(rect); } else - _ValueBounds.Add(new SRectF(Text.X - bounds.Width / 2f, Text.Y, bounds.Width, bounds.Height, Rect.Z)); + _ValueBounds.Add(new SRectF(text.X - bounds.Width / 2f, text.Y, bounds.Width, bounds.Height, Rect.Z)); } } diff --git a/VocaluxeLib/Menu/CStatic.cs b/VocaluxeLib/Menu/CStatic.cs index aebb2da0..20c900c0 100644 --- a/VocaluxeLib/Menu/CStatic.cs +++ b/VocaluxeLib/Menu/CStatic.cs @@ -28,7 +28,7 @@ namespace VocaluxeLib.Menu { get { - if (_Texture.index != -1) + if (_Texture.Index != -1) return _Texture; else return CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID); @@ -51,9 +51,9 @@ namespace VocaluxeLib.Menu public EAspect Aspect = EAspect.Stretch; - public CStatic(int PartyModeID) + public CStatic(int partyModeID) { - _PartyModeID = PartyModeID; + _PartyModeID = partyModeID; _Theme = new SThemeStatic(); _ThemeLoaded = false; @@ -87,9 +87,9 @@ namespace VocaluxeLib.Menu Visible = s.Visible; } - public CStatic(int PartyModeID, STexture texture, SColorF color, SRectF rect) + public CStatic(int partyModeID, STexture texture, SColorF color, SRectF rect) { - _PartyModeID = PartyModeID; + _PartyModeID = partyModeID; _Theme = new SThemeStatic(); _ThemeLoaded = false; @@ -105,11 +105,11 @@ namespace VocaluxeLib.Menu Visible = true; } - public CStatic(int PartyModeID, string TextureSkinName, SColorF color, SRectF rect) + public CStatic(int partyModeID, string textureSkinName, SColorF color, SRectF rect) { - _PartyModeID = PartyModeID; + _PartyModeID = partyModeID; _Theme = new SThemeStatic(); - _Theme.TextureName = TextureSkinName; + _Theme.TextureName = textureSkinName; _ThemeLoaded = false; _Texture = new STexture(-1); @@ -124,9 +124,9 @@ namespace VocaluxeLib.Menu Visible = true; } - public bool LoadTheme(string XmlPath, string ElementName, CXMLReader xmlReader, int SkinIndex) + public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex) { - string item = XmlPath + "/" + ElementName; + string item = xmlPath + "/" + elementName; _ThemeLoaded = true; _ThemeLoaded &= xmlReader.GetValue(item + "/Skin", ref _Theme.TextureName, String.Empty); @@ -138,7 +138,7 @@ namespace VocaluxeLib.Menu _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref Rect.H); if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty)) - _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, SkinIndex, out Color); + _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out Color); else { _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref Color.R); @@ -158,7 +158,7 @@ namespace VocaluxeLib.Menu if (_ThemeLoaded) { - _Theme.Name = ElementName; + _Theme.Name = elementName; LoadTextures(); } return _ThemeLoaded; @@ -229,10 +229,10 @@ namespace VocaluxeLib.Menu 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) { STexture texture; - if (_Texture.index != -1) + if (_Texture.Index != -1) texture = _Texture; else texture = CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID); @@ -249,8 +249,8 @@ namespace VocaluxeLib.Menu if (aspect != EAspect.Stretch) { RectangleF bounds2 = new RectangleF(bounds.X, bounds.Y, bounds.W, bounds.H); - RectangleF rect2 = new RectangleF(0f, 0f, texture.width, texture.height); - CHelper.SetRect(bounds2, ref rect2, texture.width / texture.height, aspect); + RectangleF rect2 = new RectangleF(0f, 0f, texture.Width, texture.Height); + CHelper.SetRect(bounds2, ref rect2, texture.Width / texture.Height, aspect); rect.X = rect2.X; rect.Y = rect2.Y; @@ -259,7 +259,7 @@ namespace VocaluxeLib.Menu } SColorF color = new SColorF(Color.R, Color.G, Color.B, Color.A * Alpha); - if (Visible || ForceDraw || (CBase.Settings.GetGameState() == EGameState.EditTheme)) + if (Visible || forceDraw || (CBase.Settings.GetGameState() == EGameState.EditTheme)) { CBase.Drawing.DrawTexture(texture, rect, color, bounds); if (Reflection) diff --git a/VocaluxeLib/Menu/CText.cs b/VocaluxeLib/Menu/CText.cs index a35f608f..5a2cbdb6 100644 --- a/VocaluxeLib/Menu/CText.cs +++ b/VocaluxeLib/Menu/CText.cs @@ -17,7 +17,7 @@ namespace VocaluxeLib.Menu { public float X; public float Y; - public float textHeight; + public float TextHeight; public float Width; public float Height; @@ -25,7 +25,7 @@ namespace VocaluxeLib.Menu { X = 0f; Y = 0f; - textHeight = 0f; + TextHeight = 0f; Width = 0f; Height = 0f; } @@ -249,9 +249,9 @@ namespace VocaluxeLib.Menu public float Alpha = 1f; - public CText(int PartyModeID) + public CText(int partyModeID) { - _PartyModeID = PartyModeID; + _PartyModeID = partyModeID; _TranslationID = _PartyModeID; _Font = "Normal"; } @@ -390,12 +390,12 @@ namespace VocaluxeLib.Menu ReflectionHeight = rheight; } - public CText(float x, float y, float z, float h, float mw, EAlignment align, EStyle style, string font, SColorF col, string text, int PartyModeID = -1) + public CText(float x, float y, float z, float h, float mw, EAlignment align, EStyle style, string font, SColorF col, string text, int partyModeID = -1) { _Theme = new SThemeText(); _ThemeLoaded = false; _ButtonText = false; - _PartyModeID = PartyModeID; + _PartyModeID = partyModeID; _TranslationID = _PartyModeID; X = x; @@ -423,27 +423,27 @@ namespace VocaluxeLib.Menu Reflection = false; } - public bool LoadTheme(string XmlPath, string ElementName, CXMLReader xmlReader, int SkinIndex) + public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex) { - return LoadTheme(XmlPath, ElementName, xmlReader, SkinIndex, false); + return LoadTheme(xmlPath, elementName, xmlReader, skinIndex, false); } - public bool LoadTheme(string XmlPath, string ElementName, CXMLReader xmlReader, int SkinIndex, bool ButtonText) + public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex, bool buttonText) { - string item = XmlPath + "/" + ElementName; + string item = xmlPath + "/" + elementName; _ThemeLoaded = true; _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/X", ref _X); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Y", ref _Y); - if (!ButtonText) + if (!buttonText) _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Z", ref _Z); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref _Height); xmlReader.TryGetFloatValue(item + "/MaxW", ref _MaxWidth); if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty)) - _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, SkinIndex, out Color); + _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out Color); else { _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref Color.R); @@ -453,7 +453,7 @@ namespace VocaluxeLib.Menu } if (xmlReader.GetValue(item + "/SColor", ref _Theme.SelColorName, String.Empty)) - _ThemeLoaded &= CBase.Theme.GetColor(_Theme.SelColorName, SkinIndex, out SelColor); + _ThemeLoaded &= CBase.Theme.GetColor(_Theme.SelColorName, skinIndex, out SelColor); else { if (xmlReader.TryGetFloatValue(item + "/SR", ref SelColor.R)) @@ -471,7 +471,7 @@ namespace VocaluxeLib.Menu _ThemeLoaded &= xmlReader.GetValue(item + "/Text", ref _Theme.Text, String.Empty); - if (xmlReader.ItemExists(item + "/Reflection") && !ButtonText) + if (xmlReader.ItemExists(item + "/Reflection") && !buttonText) { Reflection = true; _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Reflection/Space", ref ReflectionSpace); @@ -481,8 +481,8 @@ namespace VocaluxeLib.Menu Reflection = false; // Set values - _Theme.Name = ElementName; - _ButtonText = ButtonText; + _Theme.Name = elementName; + _ButtonText = buttonText; _PositionNeedsUpdate = true; if (_ThemeLoaded) @@ -589,27 +589,27 @@ namespace VocaluxeLib.Menu Draw(true); } - public void Draw(bool ForceDraw = false) + public void Draw(bool forceDraw = false) { - if (!ForceDraw && !Visible && CBase.Settings.GetGameState() != EGameState.EditTheme) + if (!forceDraw && !Visible && CBase.Settings.GetGameState() != EGameState.EditTheme) return; // Update Text Text = Text; if (_PositionNeedsUpdate) - UpdateTextPosition(); + _UpdateTextPosition(); CBase.Fonts.SetFont(Font); CBase.Fonts.SetStyle(Style); - SColorF CurrentColor = new SColorF(Color); + SColorF currentColor = new SColorF(Color); if (Selected) - CurrentColor = new SColorF(SelColor); + currentColor = new SColorF(SelColor); - SColorF color = new SColorF(CurrentColor.R, CurrentColor.G, CurrentColor.B, CurrentColor.A * Alpha); + SColorF color = new SColorF(currentColor.R, currentColor.G, currentColor.B, currentColor.A * Alpha); - CBase.Fonts.DrawText(_Text, _DrawPosition.textHeight, _DrawPosition.X, _DrawPosition.Y, Z, color); + CBase.Fonts.DrawText(_Text, _DrawPosition.TextHeight, _DrawPosition.X, _DrawPosition.Y, Z, color); if (Reflection) { @@ -617,16 +617,16 @@ namespace VocaluxeLib.Menu switch (HAlign) { case EHAlignment.Top: - factor = (Height - _DrawPosition.textHeight) * 1.5f; + factor = (Height - _DrawPosition.TextHeight) * 1.5f; break; case EHAlignment.Center: - factor = (Height - _DrawPosition.textHeight) * 1.0f; + factor = (Height - _DrawPosition.TextHeight) * 1.0f; break; case EHAlignment.Bottom: - factor = (Height - _DrawPosition.textHeight) * 0.5f; + factor = (Height - _DrawPosition.TextHeight) * 0.5f; break; } - CBase.Fonts.DrawTextReflection(_Text, _DrawPosition.textHeight, _DrawPosition.X, _DrawPosition.Y, Z, color, ReflectionSpace + factor, ReflectionHeight); + CBase.Fonts.DrawTextReflection(_Text, _DrawPosition.TextHeight, _DrawPosition.X, _DrawPosition.Y, Z, color, ReflectionSpace + factor, ReflectionHeight); } if (Selected && (CBase.Settings.GetGameState() == EGameState.EditTheme)) @@ -653,11 +653,11 @@ namespace VocaluxeLib.Menu break; } - SColorF CurrentColor = new SColorF(Color); + SColorF currentColor = new SColorF(Color); if (Selected) - CurrentColor = new SColorF(SelColor); + currentColor = new SColorF(SelColor); - SColorF color = new SColorF(CurrentColor.R, CurrentColor.G, CurrentColor.B, CurrentColor.A * Alpha); + SColorF color = new SColorF(currentColor.R, currentColor.G, currentColor.B, currentColor.A * Alpha); CBase.Fonts.SetFont(Font); CBase.Fonts.SetStyle(Style); @@ -730,11 +730,11 @@ namespace VocaluxeLib.Menu } - SColorF CurrentColor = new SColorF(Color); + SColorF currentColor = new SColorF(Color); if (Selected) - CurrentColor = new SColorF(SelColor); + currentColor = new SColorF(SelColor); - SColorF color = new SColorF(CurrentColor.R, CurrentColor.G, CurrentColor.B, CurrentColor.A * Alpha); + SColorF color = new SColorF(currentColor.R, currentColor.G, currentColor.B, currentColor.A * Alpha); CBase.Fonts.SetFont(Font); CBase.Fonts.SetStyle(Style); @@ -785,7 +785,7 @@ namespace VocaluxeLib.Menu } #endregion ThemeEdit - private void UpdateTextPosition() + private void _UpdateTextPosition() { if (_Text.Length == 0) return; @@ -831,7 +831,7 @@ namespace VocaluxeLib.Menu _DrawPosition.X = x; _DrawPosition.Y = y; - _DrawPosition.textHeight = h; + _DrawPosition.TextHeight = h; _DrawPosition.Width = bounds.Width; _DrawPosition.Height = bounds.Height; diff --git a/VocaluxeLib/Menu/CXMLReader.cs b/VocaluxeLib/Menu/CXMLReader.cs index 64c15abd..6ef54d0c 100644 --- a/VocaluxeLib/Menu/CXMLReader.cs +++ b/VocaluxeLib/Menu/CXMLReader.cs @@ -40,11 +40,11 @@ namespace VocaluxeLib.Menu } } - public bool TryGetEnumValue(string Cast, ref T value) + public bool TryGetEnumValue(string cast, ref T value) where T : struct { string val = String.Empty; - if (GetValue(Cast, ref val, Enum.GetName(typeof(T), value))) + if (GetValue(cast, ref val, Enum.GetName(typeof(T), value))) { CHelper.TryParse(val, out value, true); return true; @@ -52,17 +52,17 @@ namespace VocaluxeLib.Menu return false; } - public bool TryGetIntValue(string Cast, ref int value) + public bool TryGetIntValue(string cast, ref int value) { string val = String.Empty; - if (GetValue(Cast, ref val, value.ToString())) + if (GetValue(cast, ref val, value.ToString())) return int.TryParse(val, out value); return false; } - public bool TryGetIntValueRange(string Cast, ref int value, int min = 0, int max = 100) + public bool TryGetIntValueRange(string cast, ref int value, int min = 0, int max = 100) { - bool result = TryGetIntValue(Cast, ref value); + bool result = TryGetIntValue(cast, ref value); if (result) { if (value < min) @@ -73,22 +73,22 @@ namespace VocaluxeLib.Menu return result; } - public bool TryGetFloatValue(string Cast, ref float value) + public bool TryGetFloatValue(string cast, ref float value) { string val = String.Empty; - if (GetValue(Cast, ref val, value.ToString())) + if (GetValue(cast, ref val, value.ToString())) return CHelper.TryParse(val, out value); return false; } - public bool GetValue(string Cast, ref string Value, string DefaultValue) + public bool GetValue(string cast, ref string value, string defaultValue) { XPathNodeIterator iterator; int results = 0; string val = string.Empty; _Navigator.MoveToFirstChild(); - iterator = _Navigator.Select(Cast); + iterator = _Navigator.Select(cast); while (iterator.MoveNext()) { @@ -98,17 +98,17 @@ namespace VocaluxeLib.Menu if ((results == 0) || (results > 1)) { - Value = DefaultValue; + value = defaultValue; return false; } else { - Value = val; + value = val; return true; } } - public List GetValues(string Cast) + public List GetValues(string cast) { List values = new List(); @@ -116,7 +116,7 @@ namespace VocaluxeLib.Menu _Navigator.MoveToFirstChild(); _Navigator.MoveToFirstChild(); - while (_Navigator.Name != Cast) + while (_Navigator.Name != cast) _Navigator.MoveToNext(); _Navigator.MoveToFirstChild(); @@ -128,14 +128,14 @@ namespace VocaluxeLib.Menu return values; } - public List GetAttributes(string Cast, string attribute) + public List GetAttributes(string cast, string attribute) { List values = new List(); _Navigator.MoveToRoot(); _Navigator.MoveToFirstChild(); - while (_Navigator.Name != Cast) + while (_Navigator.Name != cast) _Navigator.MoveToNext(); _Navigator.MoveToFirstChild(); @@ -147,31 +147,31 @@ namespace VocaluxeLib.Menu return values; } - public bool GetInnerValues(string Cast, ref List Values) + public bool GetInnerValues(string cast, ref List values) { _Navigator.MoveToRoot(); _Navigator.MoveToFirstChild(); _Navigator.MoveToFirstChild(); - while (_Navigator.Name != Cast) + while (_Navigator.Name != cast) _Navigator.MoveToNext(); _Navigator.MoveToFirstChild(); - Values.Add(_Navigator.Value); + values.Add(_Navigator.Value); while (_Navigator.MoveToNext()) - Values.Add(_Navigator.Value); + values.Add(_Navigator.Value); return true; } - public bool ItemExists(string Cast) + public bool ItemExists(string cast) { XPathNodeIterator iterator; int results = 0; _Navigator.MoveToFirstChild(); - iterator = _Navigator.Select(Cast); + iterator = _Navigator.Select(cast); while (iterator.MoveNext()) results++; diff --git a/VocaluxeLib/Menu/Enums.cs b/VocaluxeLib/Menu/Enums.cs index 3acc1e8e..4387d4b2 100644 --- a/VocaluxeLib/Menu/Enums.cs +++ b/VocaluxeLib/Menu/Enums.cs @@ -55,21 +55,23 @@ namespace VocaluxeLib.Menu #region Config public enum ERenderer { + // ReSharper disable InconsistentNaming #if WIN TR_CONFIG_DIRECT3D, #endif TR_CONFIG_OPENGL, TR_CONFIG_SOFTWARE + // ReSharper restore InconsistentNaming } public enum EAntiAliasingModes { - x0 = 0, - x2 = 2, - x4 = 4, - x8 = 8, - x16 = 16, - x32 = 32 + X0 = 0, + X2 = 2, + X4 = 4, + X8 = 8, + X16 = 16, + X32 = 32 } public enum EColorDeep @@ -82,21 +84,26 @@ namespace VocaluxeLib.Menu public enum ETextureQuality { + // ReSharper disable InconsistentNaming TR_CONFIG_TEXTURE_LOWEST, TR_CONFIG_TEXTURE_LOW, TR_CONFIG_TEXTURE_MEDIUM, TR_CONFIG_TEXTURE_HIGH, TR_CONFIG_TEXTURE_HIGHEST + // ReSharper restore InconsistentNaming } public enum EOffOn { + // ReSharper disable InconsistentNaming TR_CONFIG_OFF, TR_CONFIG_ON + // ReSharper restore InconsistentNaming } public enum EDebugLevel { + // ReSharper disable InconsistentNaming // don't change the order! TR_CONFIG_OFF, //no debug infos TR_CONFIG_ONLY_FPS, @@ -104,19 +111,20 @@ namespace VocaluxeLib.Menu TR_CONFIG_LEVEL2, TR_CONFIG_LEVEL3, TR_CONFIG_LEVEL_MAX //all debug infos + // ReSharper restore InconsistentNaming } public enum EBufferSize { - b0 = 0, - b512 = 512, - b1024 = 1024, - b1536 = 1536, - b2048 = 2048, - b2560 = 2560, - b3072 = 3072, - b3584 = 3584, - b4096 = 4096 + B0 = 0, + B512 = 512, + B1024 = 1024, + B1536 = 1536, + B2048 = 2048, + B2560 = 2560, + B3072 = 3072, + B3584 = 3584, + B4096 = 4096 } public enum EPlaybackLib @@ -148,10 +156,12 @@ namespace VocaluxeLib.Menu public enum ESongMenu { + // ReSharper disable InconsistentNaming //TR_CONFIG_LIST, //a simple list //TR_CONFIG_DREIDEL, //as in ultrastar deluxe TR_CONFIG_TILE_BOARD, //chessboard like //TR_CONFIG_BOOK //for playlists + // ReSharper restore InconsistentNaming } public enum EDuetOptions @@ -163,6 +173,7 @@ namespace VocaluxeLib.Menu public enum ESongSorting { + // ReSharper disable InconsistentNaming TR_CONFIG_NONE, //TR_CONFIG_RANDOM, TR_CONFIG_FOLDER, @@ -174,55 +185,70 @@ namespace VocaluxeLib.Menu TR_CONFIG_LANGUAGE, TR_CONFIG_YEAR, TR_CONFIG_DECADE + // ReSharper restore InconsistentNaming } public enum ECoverLoading { + // ReSharper disable InconsistentNaming TR_CONFIG_COVERLOADING_ONDEMAND, TR_CONFIG_COVERLOADING_ATSTART, TR_CONFIG_COVERLOADING_DYNAMIC + // ReSharper restore InconsistentNaming } public enum EGameDifficulty { + // ReSharper disable InconsistentNaming TR_CONFIG_EASY, TR_CONFIG_NORMAL, TR_CONFIG_HARD + // ReSharper restore InconsistentNaming } public enum ETimerMode { + // ReSharper disable InconsistentNaming TR_CONFIG_TIMERMODE_CURRENT, TR_CONFIG_TIMERMODE_REMAINING, TR_CONFIG_TIMERMODE_TOTAL + // ReSharper restore InconsistentNaming } public enum ETimerLook { + // ReSharper disable InconsistentNaming TR_CONFIG_TIMERLOOK_NORMAL, TR_CONFIG_TIMERLOOK_EXPANDED + // ReSharper restore InconsistentNaming } public enum EBackgroundMusicSource { + // ReSharper disable InconsistentNaming TR_CONFIG_NO_OWN_MUSIC, TR_CONFIG_OWN_MUSIC, TR_CONFIG_ONLY_OWN_MUSIC + // ReSharper restore InconsistentNaming } public enum EPlayerInfo { + // ReSharper disable InconsistentNaming TR_CONFIG_PLAYERINFO_BOTH, TR_CONFIG_PLAYERINFO_NAME, TR_CONFIG_PLAYERINFO_AVATAR, TR_CONFIG_PLAYERINFO_OFF + // ReSharper restore InconsistentNaming } public enum EFadePlayerInfo { + // ReSharper disable InconsistentNaming TR_CONFIG_FADEPLAYERINFO_ALL, TR_CONFIG_FADEPLAYERINFO_INFO, TR_CONFIG_FADEPLAYERINFO_OFF + // ReSharper restore InconsistentNaming } public enum ELyricStyle @@ -243,10 +269,12 @@ namespace VocaluxeLib.Menu public enum EGameMode { + // ReSharper disable InconsistentNaming TR_GAMEMODE_NORMAL, TR_GAMEMODE_MEDLEY, TR_GAMEMODE_DUET, TR_GAMEMODE_SHORTSONG + // ReSharper restore InconsistentNaming } public enum ENoteType diff --git a/VocaluxeLib/Menu/IMenu.cs b/VocaluxeLib/Menu/IMenu.cs index 42bfd321..39287afc 100644 --- a/VocaluxeLib/Menu/IMenu.cs +++ b/VocaluxeLib/Menu/IMenu.cs @@ -12,16 +12,16 @@ namespace VocaluxeLib.Menu { void Init(); - void LoadTheme(string XmlPath); + void LoadTheme(string xmlPath); void SaveTheme(); void ReloadTextures(); void UnloadTextures(); - void ReloadTheme(string XmlPath); + void ReloadTheme(string xmlPath); - bool HandleInput(KeyEvent keyEvent); - bool HandleMouse(MouseEvent mouseEvent); - bool HandleInputThemeEditor(KeyEvent KeyEvent); - bool HandleMouseThemeEditor(MouseEvent MouseEvent); + bool HandleInput(SKeyEvent keyEvent); + bool HandleMouse(SMouseEvent mouseEvent); + bool HandleInputThemeEditor(SKeyEvent keyEvent); + bool HandleMouseThemeEditor(SMouseEvent mouseEvent); bool UpdateGame(); void ApplyVolume(); @@ -44,16 +44,16 @@ namespace VocaluxeLib.Menu public interface IMenuParty { - void SetPartyModeID(int PartyModeID); + void SetPartyModeID(int partyModeID); int GetPartyModeID(); - void AssingPartyMode(IPartyMode PartyMode); - void DataToScreen(Object Data); + void AssingPartyMode(IPartyMode partyMode); + void DataToScreen(Object data); } public interface IConfig { - void SetBackgroundMusicVolume(int NewVolume); + void SetBackgroundMusicVolume(int newVolume); int GetBackgroundMusicVolume(); int GetPreviewMusicVolume(); @@ -74,7 +74,7 @@ namespace VocaluxeLib.Menu EOffOn GetTabs(); EOffOn GetIgnoreArticles(); - bool IsMicConfigured(int PlayerNr); + bool IsMicConfigured(int playerNr); int GetMaxNumMics(); } @@ -103,17 +103,17 @@ namespace VocaluxeLib.Menu public interface ITheme { - string GetThemeScreensPath(int PartyModeID); - int GetSkinIndex(int PartyModeID); - STexture GetSkinTexture(string TextureName, int PartyModeID); - STexture GetSkinVideoTexture(string VideoName, int PartyModeID); + string GetThemeScreensPath(int partyModeID); + int GetSkinIndex(int partyModeID); + STexture GetSkinTexture(string textureName, int partyModeID); + STexture GetSkinVideoTexture(string videoName, int partyModeID); - void SkinVideoResume(string VideoName, int PartyModeID); - void SkinVideoPause(string VideoName, int PartyModeID); + void SkinVideoResume(string videoName, int partyModeID); + void SkinVideoPause(string videoName, int partyModeID); - SColorF GetColor(string ColorName, int PartyModeID); - bool GetColor(string ColorName, int SkinIndex, out SColorF Color); - SColorF GetPlayerColor(int PlayerNr); + SColorF GetColor(string colorName, int partyModeID); + bool GetColor(string colorName, int skinIndex, out SColorF color); + SColorF GetPlayerColor(int playerNr); void UnloadSkins(); void ListSkins(); @@ -130,7 +130,7 @@ namespace VocaluxeLib.Menu bool SongHasVideo(); bool VideoEnabled(); - void SetStatus(bool Disabled); + void SetStatus(bool disabled); void Next(); void Previous(); void Pause(); @@ -145,66 +145,66 @@ namespace VocaluxeLib.Menu { RectangleF GetTextBounds(CText text); - void DrawTexture(STexture Texture, SRectF Rect); - void DrawTexture(STexture Texture, SRectF Rect, SColorF Color); - void DrawTexture(STexture Texture, SRectF Rect, SColorF Color, SRectF Bounds); - void DrawTexture(STexture Texture, SRectF Rect, SColorF Color, SRectF Bounds, bool Mirrored); - void DrawTextureReflection(STexture Texture, SRectF Rect, SColorF Color, SRectF Bounds, float ReflectionSpace, float ReflectionHeight); + void DrawTexture(STexture texture, SRectF rect); + void DrawTexture(STexture texture, SRectF rect, SColorF color); + void DrawTexture(STexture texture, SRectF rect, SColorF color, SRectF bounds); + void DrawTexture(STexture texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored); + void DrawTextureReflection(STexture texture, SRectF rect, SColorF color, SRectF bounds, float reflectionSpace, float reflectionHeight); - void RemoveTexture(ref STexture Texture); + void RemoveTexture(ref STexture texture); - void DrawColor(SColorF Color, SRectF Rect); - void DrawColorReflection(SColorF Color, SRectF Rect, float Space, float Height); + void DrawColor(SColorF color, SRectF rect); + void DrawColorReflection(SColorF color, SRectF rect, float space, float height); } public interface IGraphics { void ReloadTheme(); void SaveTheme(); - void FadeTo(EScreens NextScreen); + void FadeTo(EScreens nextScreen); float GetGlobalAlpha(); } public interface ILog { - void LogError(string ErrorText); + void LogError(string errorText); } public interface IFonts { - void SetFont(string FontName); - void SetStyle(EStyle FontStyle); + void SetFont(string fontName); + void SetStyle(EStyle fontStyle); - RectangleF GetTextBounds(CText Text, float TextHeight); + RectangleF GetTextBounds(CText text, float textHeight); - void DrawText(string Text, float TextHeight, float x, float y, float z, SColorF Color); - void DrawTextReflection(string Text, float TextHeight, float x, float y, float z, SColorF Color, float ReflectionSpace, float ReflectionHeight); - void DrawText(string Text, float TextHeight, float x, float y, float z, SColorF Color, float Begin, float End); + void DrawText(string text, float textHeight, float x, float y, float z, SColorF color); + void DrawTextReflection(string text, float textHeight, float x, float y, float z, SColorF color, float reflectionSpace, float reflectionHeight); + void DrawText(string text, float textHeight, float x, float y, float z, SColorF color, float begin, float end); } public interface ILanguage { - string Translate(string KeyWord); - string Translate(string KeyWord, int PartyModeID); - bool TranslationExists(string KeyWord); + string Translate(string keyWord); + string Translate(string keyWord, int partyModeID); + bool TranslationExists(string keyWord); } public interface IGame { int GetNumPlayer(); - void SetNumPlayer(int NumPlayer); + void SetNumPlayer(int numPlayer); SPlayer[] GetPlayer(); CPoints GetPoints(); float GetMidBeatD(); int GetCurrentBeatD(); - int GetRandom(int Max); + int GetRandom(int max); double GetRandomDouble(); - float GetTimeFromBeats(float Beat, float BPM); + float GetTimeFromBeats(float beat, float bpm); - void AddSong(int SongID, EGameMode GameMode); + void AddSong(int songID, EGameMode gameMode); void Reset(); void ClearSongs(); int GetNumSongs(); @@ -212,7 +212,7 @@ namespace VocaluxeLib.Menu public interface IRecording { - int GetToneAbs(int PlayerNr); + int GetToneAbs(int playerNr); } public interface IProfiles @@ -225,26 +225,26 @@ namespace VocaluxeLib.Menu int GetNumSongs(); int GetNumVisibleSongs(); int GetNumCategories(); - int NumSongsInCategory(int CategoryIndex); + int NumSongsInCategory(int categoryIndex); int GetCurrentCategoryIndex(); EOffOn GetTabs(); string GetSearchFilter(); - void SetCategory(int CategoryIndex); + void SetCategory(int categoryIndex); void UpdateRandomSongList(); - CSong GetVisibleSong(int VisibleIndex); - CSong GetSongByID(int SongID); + CSong GetVisibleSong(int visibleIndex); + CSong GetSongByID(int songID); CSong[] GetSongs(); CSong[] GetSongsNotSung(); - CCategory GetCategory(int Index); + CCategory GetCategory(int index); - void AddPartySongSung(int SongID); + void AddPartySongSung(int songID); void ResetPartySongSung(); - void ResetPartySongSung(int CatIndex); + void ResetPartySongSung(int catIndex); - void SortSongs(ESongSorting Sorting, EOffOn Tabs, EOffOn IgnoreArticles, String SearchString, EDuetOptions DuetOptions); + void SortSongs(ESongSorting sorting, EOffOn tabs, EOffOn ignoreArticles, String searchString, EDuetOptions duetOptions); void NextCategory(); void PrevCategory(); @@ -252,27 +252,27 @@ namespace VocaluxeLib.Menu public interface IVideo { - int Load(string VideoFileName); - bool Skip(int VideoStream, float StartPosition, float VideoGap); - bool GetFrame(int VideoStream, ref STexture VideoTexture, float Time, ref float VideoTime); - bool IsFinished(int VideoStream); - bool Close(int VideoStream); + int Load(string videoFileName); + bool Skip(int videoStream, float startPosition, float videoGap); + bool GetFrame(int videoStream, ref STexture videoTexture, float time, ref float videoTime); + bool IsFinished(int videoStream); + bool Close(int videoStream); } public interface ISound { - int Load(string SoundFile, bool Prescan); - void SetPosition(int SoundStream, float NewPosition); - void Play(int SoundStream); - void Fade(int SoundStream, float TargetVolume, float Duration); + int Load(string soundFile, bool prescan); + void SetPosition(int soundStream, float newPosition); + void Play(int soundStream); + void Fade(int soundStream, float targetVolume, float duration); - bool IsFinished(int SoundStream); - float GetPosition(int SoundStream); - float GetLength(int SoundStream); - void FadeAndStop(int SoundStream, float TargetVolume, float Duration); + bool IsFinished(int soundStream); + float GetPosition(int soundStream); + float GetLength(int soundStream); + void FadeAndStop(int soundStream, float targetVolume, float duration); - void SetStreamVolume(int SoundStream, float Volume); - void SetStreamVolumeMax(int SoundStream, float MaxVolume); + void SetStreamVolume(int soundStream, float volume); + void SetStreamVolumeMax(int soundStream, float maxVolume); } public interface ICover @@ -282,34 +282,34 @@ namespace VocaluxeLib.Menu public interface IDataBase { - bool GetCover(string FileName, ref STexture Texture, int CoverSize); + bool GetCover(string fileName, ref STexture texture, int coverSize); } public interface IInputs { - void SetRumble(float Duration); + void SetRumble(float duration); } public interface IPlaylist { - string GetPlaylistName(int PlaylistID); + string GetPlaylistName(int playlistID); string[] GetPlaylistNames(); - void SetPlaylistName(int PlaylistID, string Name); - void DeletePlaylist(int PlaylistID); - void SavePlaylist(int PlaylistID); + void SetPlaylistName(int playlistID, string name); + void DeletePlaylist(int playlistID); + void SavePlaylist(int playlistID); int GetNumPlaylists(); - void AddPlaylistSong(int PlaylistID, int SongID); - void AddPlaylistSong(int PlaylistID, int SongID, EGameMode GameMode); - void InsertPlaylistSong(int PlaylistID, int PositionIndex, int SongID, EGameMode GameMode); + void AddPlaylistSong(int playlistID, int songID); + void AddPlaylistSong(int playlistID, int songID, EGameMode gameMode); + void InsertPlaylistSong(int playlistID, int positionIndex, int songID, EGameMode gameMode); - void MovePlaylistSong(int PlaylistID, int SourceIndex, int DestIndex); - void MovePlaylistSongDown(int PlaylistID, int SongIndex); - void MovePlaylistSongUp(int PlaylistID, int SongIndex); - void DeletePlaylistSong(int PlaylistID, int SongIndex); + void MovePlaylistSong(int playlistID, int sourceIndex, int destIndex); + void MovePlaylistSongDown(int playlistID, int songIndex); + void MovePlaylistSongUp(int playlistID, int songIndex); + void DeletePlaylistSong(int playlistID, int songIndex); - int GetPlaylistSongCount(int PlaylistID); - CPlaylistSong GetPlaylistSong(int PlaylistID, int SongIndex); + int GetPlaylistSongCount(int playlistID); + CPlaylistSong GetPlaylistSong(int playlistID, int songIndex); } } \ No newline at end of file diff --git a/VocaluxeLib/Menu/IMenuElement.cs b/VocaluxeLib/Menu/IMenuElement.cs index 2c46e515..73bbcb3e 100644 --- a/VocaluxeLib/Menu/IMenuElement.cs +++ b/VocaluxeLib/Menu/IMenuElement.cs @@ -6,7 +6,7 @@ namespace VocaluxeLib.Menu { string GetThemeName(); - bool LoadTheme(string XmlPath, string ElementName, CXMLReader xmlReader, int SkinIndex); + bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex); bool SaveTheme(XmlWriter writer); void UnloadTextures(); diff --git a/VocaluxeLib/Menu/SingNotes/CNotes.cs b/VocaluxeLib/Menu/SingNotes/CNotes.cs index 7e424075..6730b9c8 100644 --- a/VocaluxeLib/Menu/SingNotes/CNotes.cs +++ b/VocaluxeLib/Menu/SingNotes/CNotes.cs @@ -25,41 +25,41 @@ namespace VocaluxeLib.Menu.SingNotes _Lines.Add(new CLines(lines)); } - public CLines GetLines(int Index) + public CLines GetLines(int index) { - while (Index >= _Lines.Count) + while (index >= _Lines.Count) _Lines.Add(new CLines()); - return _Lines[Index]; + return _Lines[index]; } - public int GetPoints(int Index) + public int GetPoints(int index) { - if (Index >= _Lines.Count) + if (index >= _Lines.Count) return 0; - return _Lines[Index].Points; + return _Lines[index].Points; } - public int GetNumLinesWithPoints(int Index) + public int GetNumLinesWithPoints(int index) { - if (Index >= _Lines.Count) + if (index >= _Lines.Count) return 0; - return _Lines[Index].NumLinesWithPoints; + return _Lines[index].NumLinesWithPoints; } - public void AddLines(CLines Lines) + public void AddLines(CLines lines) { - _Lines.Add(Lines); + _Lines.Add(lines); } - public bool ReplaceLinesAt(int Index, CLines Lines) + public bool ReplaceLinesAt(int index, CLines lines) { - if (Index >= _Lines.Count) + if (index >= _Lines.Count) return false; - _Lines[Index] = Lines; + _Lines[index] = lines; return true; } @@ -68,10 +68,10 @@ namespace VocaluxeLib.Menu.SingNotes _Lines.Clear(); } - public void SetMedley(int StartBeat, int EndBeat) + public void SetMedley(int startBeat, int endBeat) { foreach (CLines lines in _Lines) - lines.SetMedley(StartBeat, EndBeat); + lines.SetMedley(startBeat, endBeat); } } @@ -108,38 +108,38 @@ namespace VocaluxeLib.Menu.SingNotes _Perfect = note._Perfect; } - public CNote(int StartBeat, int Duration, int Tone, string Text) + public CNote(int startBeat, int duration, int tone, string text) : this() { - this.StartBeat = StartBeat; - this.Duration = Duration; - this.Tone = Tone; + this.StartBeat = startBeat; + this.Duration = duration; + this.Tone = tone; NoteType = ENoteType.Normal; - this.Text = Text; + this.Text = text; } - public CNote(int StartBeat, int Duration, int Tone, string Text, bool Hit) + public CNote(int startBeat, int duration, int tone, string text, bool hit) : this() { - this.StartBeat = StartBeat; - this.Duration = Duration; - this.Tone = Tone; + this.StartBeat = startBeat; + this.Duration = duration; + this.Tone = tone; NoteType = ENoteType.Normal; - this.Text = Text; - this.Hit = Hit; + this.Text = text; + this.Hit = hit; } - public CNote(int StartBeat, int Duration, int Tone, string Text, ENoteType NoteType) - : this(StartBeat, Duration, Tone, Text) + public CNote(int startBeat, int duration, int tone, string text, ENoteType noteType) + : this(startBeat, duration, tone, text) { - this.NoteType = NoteType; + this.NoteType = noteType; } - public CNote(int StartBeat, int Duration, int Tone, string Text, bool Hit, ENoteType NoteType) - : this(StartBeat, Duration, Tone, Text) + public CNote(int startBeat, int duration, int tone, string text, bool hit, ENoteType noteType) + : this(startBeat, duration, tone, text) { - this.NoteType = NoteType; - this.Hit = Hit; + this.NoteType = noteType; + this.Hit = hit; } #endregion Constructors @@ -237,24 +237,24 @@ namespace VocaluxeLib.Menu.SingNotes #endregion Properties #region Methods - public bool IsPerfect(CNote CompareNote) + public bool IsPerfect(CNote compareNote) { - bool Result = true; + bool result = true; if (!Hit) - Result = false; + result = false; - if (StartBeat != CompareNote.StartBeat) - Result = false; + if (StartBeat != compareNote.StartBeat) + result = false; - if (EndBeat != CompareNote.EndBeat) - Result = false; + if (EndBeat != compareNote.EndBeat) + result = false; - if (Tone != CompareNote.Tone) - Result = false; + if (Tone != compareNote.Tone) + result = false; - Perfect = Result; - return Result; + Perfect = result; + return result; } #endregion Methods } @@ -387,38 +387,38 @@ namespace VocaluxeLib.Menu.SingNotes { get { - int Min = int.MaxValue; - int Max = int.MinValue; + int min = int.MaxValue; + int max = int.MinValue; foreach (CNote note in _Notes) { - if (note.Tone < Min) - Min = note.Tone; - if (note.Tone > Max) - Max = note.Tone; + if (note.Tone < min) + min = note.Tone; + if (note.Tone > max) + max = note.Tone; } - return Min - (Max - Min) / 4; + return min - (max - min) / 4; } } #endregion Properties #region Methods - public bool IsPerfect(CLine CompareLine) + public bool IsPerfect(CLine compareLine) { if (_Notes.Count == 0) return false; - if (_Notes.Count != CompareLine.NoteCount) + if (_Notes.Count != compareLine.NoteCount) return false; - if (CompareLine.Points == 0) + if (compareLine.Points == 0) return false; - _PerfectLine = Points == CompareLine.Points; + _PerfectLine = Points == compareLine.Points; return _PerfectLine; } - public int FindPreviousNote(int Beat) + public int FindPreviousNote(int beat) { //If no notes -> No previous note if (_Notes.Count == 0) @@ -426,15 +426,15 @@ namespace VocaluxeLib.Menu.SingNotes int start = 0; int end = _Notes.Count - 1; //Ensure that start.StartBeat<=Beat && end.StartBeat>Beat - if (_Notes[0].StartBeat > Beat) + if (_Notes[0].StartBeat > beat) return -1; - if (_Notes[end].StartBeat <= Beat) + if (_Notes[end].StartBeat <= beat) return end; //Binary search while (end - start > 1) { int mid = (start + end) / 2; - if (_Notes[mid].StartBeat <= Beat) + if (_Notes[mid].StartBeat <= beat) start = mid; else end = mid; @@ -442,13 +442,13 @@ namespace VocaluxeLib.Menu.SingNotes return start; } - public bool AddNote(CNote Note) + public bool AddNote(CNote note) { if (_Notes.Count == 0) - _Notes.Add(Note); + _Notes.Add(note); else { - int insPos = FindPreviousNote(Note.StartBeat); + int insPos = FindPreviousNote(note.StartBeat); //Flamefire: May be a performance hit as notes are also used for sung notes //But for song loading this might be very helpful! //Check for overlapping notes @@ -457,30 +457,30 @@ namespace VocaluxeLib.Menu.SingNotes if (insPos < _Notes.Count - 1 && _Notes[insPos+1].StartBeat > Note.EndBeat) return false; * */ - _Notes.Insert(insPos + 1, Note); + _Notes.Insert(insPos + 1, note); } - updateMinMaxBeat(Note); + _UpdateMinMaxBeat(note); return true; } - public bool DeleteNote(int Index) + public bool DeleteNote(int index) { - if (_Notes.Count > Index) + if (_Notes.Count > index) { - _Notes.RemoveAt(Index); - if (Index == 0 || Index == _Notes.Count - 1) - updateMinMaxBeat(); + _Notes.RemoveAt(index); + if (index == 0 || index == _Notes.Count - 1) + _UpdateMinMaxBeat(); return true; } return false; } - public bool ReplaceNote(int Index, CNote Note) + public bool ReplaceNote(int index, CNote note) { - if (_Notes.Count > Index) + if (_Notes.Count > index) { - _Notes.RemoveAt(Index); - return AddNote(Note); + _Notes.RemoveAt(index); + return AddNote(note); } return false; } @@ -498,30 +498,30 @@ namespace VocaluxeLib.Menu.SingNotes public void DeleteAllNotes() { _Notes.Clear(); - updateMinMaxBeat(); + _UpdateMinMaxBeat(); } - public void SetMedley(int StartBeat, int EndBeat) + public void SetMedley(int startBeat, int endBeat) { foreach (CNote note in _Notes) { - if (note.StartBeat < StartBeat || note.EndBeat > EndBeat) + if (note.StartBeat < startBeat || note.EndBeat > endBeat) note.NoteType = ENoteType.Freestyle; } - _VisibleInTimeLine = _MinBeat >= StartBeat && _MaxBeat <= EndBeat; + _VisibleInTimeLine = _MinBeat >= startBeat && _MaxBeat <= endBeat; } - private void updateMinMaxBeat(CNote Note) + private void _UpdateMinMaxBeat(CNote note) { - if (Note.StartBeat < _MinBeat) - _MinBeat = Note.StartBeat; + if (note.StartBeat < _MinBeat) + _MinBeat = note.StartBeat; - if (Note.EndBeat > _MaxBeat) - _MaxBeat = Note.EndBeat; + if (note.EndBeat > _MaxBeat) + _MaxBeat = note.EndBeat; } - private void updateMinMaxBeat() + private void _UpdateMinMaxBeat() { if (_Notes.Count > 0) { @@ -617,7 +617,7 @@ namespace VocaluxeLib.Menu.SingNotes #region Methods //Find last line with StartBeat<=Beat - public int FindPreviousLine(int Beat) + public int FindPreviousLine(int beat) { //If no line -> No previous line if (_Lines.Count == 0) @@ -625,15 +625,15 @@ namespace VocaluxeLib.Menu.SingNotes int start = 0; int end = _Lines.Count - 1; //Ensure that start.StartBeat<=Beat && end.StartBeat>Beat - if (_Lines[0].StartBeat > Beat) + if (_Lines[0].StartBeat > beat) return -1; - if (_Lines[end].StartBeat <= Beat) + if (_Lines[end].StartBeat <= beat) return end; //Binary search while (end - start > 1) { int mid = (start + end) / 2; - if (_Lines[mid].StartBeat <= Beat) + if (_Lines[mid].StartBeat <= beat) start = mid; else end = mid; @@ -641,22 +641,22 @@ namespace VocaluxeLib.Menu.SingNotes return start; } - public void AddLine(CLine Line) + public void AddLine(CLine line) { if (_Lines.Count == 0) - _Lines.Add(Line); + _Lines.Add(line); else { - int insPos = FindPreviousLine(Line.StartBeat); - _Lines.Insert(insPos + 1, Line); + int insPos = FindPreviousLine(line.StartBeat); + _Lines.Insert(insPos + 1, line); } } - public bool DeleteLine(int Index) + public bool DeleteLine(int index) { - if (_Lines.Count > Index) + if (_Lines.Count > index) { - _Lines.RemoveAt(Index); + _Lines.RemoveAt(index); UpdateTimings(); return true; } @@ -668,20 +668,20 @@ namespace VocaluxeLib.Menu.SingNotes _Lines.Clear(); } - public bool AddNote(CNote Note, bool updateTimings = false) + public bool AddNote(CNote note, bool updateTimings = false) { - int LineIndex = FindPreviousLine(Note.StartBeat); - if (LineIndex < 0) + int lineIndex = FindPreviousLine(note.StartBeat); + if (lineIndex < 0) { //Note is before ALL lines - CLine Line = new CLine(); - Line.StartBeat = Note.StartBeat; - Line.AddNote(Note); - _Lines.Insert(0, Line); + CLine line = new CLine(); + line.StartBeat = note.StartBeat; + line.AddNote(note); + _Lines.Insert(0, line); } else { - if (!_Lines[LineIndex].AddNote(Note)) + if (!_Lines[lineIndex].AddNote(note)) return false; } if (updateTimings) @@ -689,11 +689,11 @@ namespace VocaluxeLib.Menu.SingNotes return true; } - public bool InsertNote(CNote Note, int LineIndex, bool updateTimings = false) + public bool InsertNote(CNote note, int lineIndex, bool updateTimings = false) { - if (_Lines.Count > LineIndex && _Lines[LineIndex].StartBeat <= Note.StartBeat) + if (_Lines.Count > lineIndex && _Lines[lineIndex].StartBeat <= note.StartBeat) { - _Lines[LineIndex].AddNote(Note); + _Lines[lineIndex].AddNote(note); if (updateTimings) UpdateTimings(); return true; @@ -703,7 +703,7 @@ namespace VocaluxeLib.Menu.SingNotes public void UpdateTimings() { - CNote LastNote, FirstNote; + CNote lastNote; int min, max, s; if (_Lines.Count > 0) @@ -711,13 +711,13 @@ namespace VocaluxeLib.Menu.SingNotes for (int i = 1; i < _Lines.Count; i++) { - LastNote = _Lines[i - 1].LastNote; - FirstNote = _Lines[i].FirstNote; + lastNote = _Lines[i - 1].LastNote; + CNote firstNote = _Lines[i].FirstNote; - if ((LastNote != null) && (FirstNote != null)) + if ((lastNote != null) && (firstNote != null)) { - min = LastNote.EndBeat; - max = FirstNote.StartBeat; + min = lastNote.EndBeat; + max = firstNote.StartBeat; switch (max - min) { @@ -743,15 +743,15 @@ namespace VocaluxeLib.Menu.SingNotes } } - LastNote = _Lines[_Lines.Count - 1].LastNote; - if (LastNote != null) - _Lines[_Lines.Count - 1].EndBeat = LastNote.EndBeat; + lastNote = _Lines[_Lines.Count - 1].LastNote; + if (lastNote != null) + _Lines[_Lines.Count - 1].EndBeat = lastNote.EndBeat; } - public void SetMedley(int StartBeat, int EndBeat) + public void SetMedley(int startBeat, int endBeat) { foreach (CLine line in _Lines) - line.SetMedley(StartBeat, EndBeat); + line.SetMedley(startBeat, endBeat); } #endregion Methods } diff --git a/VocaluxeLib/Menu/SingNotes/CSingNotes.cs b/VocaluxeLib/Menu/SingNotes/CSingNotes.cs index b38ceba2..0df5b15c 100644 --- a/VocaluxeLib/Menu/SingNotes/CSingNotes.cs +++ b/VocaluxeLib/Menu/SingNotes/CSingNotes.cs @@ -61,9 +61,9 @@ namespace VocaluxeLib.Menu.SingNotes set { _BarPos = value; } } - public CSingNotes(int PartyModeID) + public CSingNotes(int partyModeID) { - _PartyModeID = PartyModeID; + _PartyModeID = partyModeID; _Theme = new SThemeSingBar(); _ThemeLoaded = false; @@ -76,9 +76,9 @@ namespace VocaluxeLib.Menu.SingNotes return _Theme.Name; } - public bool LoadTheme(string XmlPath, string ElementName, CXMLReader xmlReader, int SkinIndex) + public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex) { - string item = XmlPath + "/" + ElementName; + string item = xmlPath + "/" + elementName; _ThemeLoaded = true; _ThemeLoaded &= xmlReader.GetValue(item + "/SkinLeft", ref _Theme.SkinLeftName, String.Empty); @@ -113,7 +113,7 @@ namespace VocaluxeLib.Menu.SingNotes if (_ThemeLoaded) { - _Theme.Name = ElementName; + _Theme.Name = elementName; LoadTextures(); } @@ -189,17 +189,17 @@ namespace VocaluxeLib.Menu.SingNotes _ActID = 0; } - public virtual int AddPlayer(SRectF Rect, SColorF Color, int PlayerNr) + public virtual int AddPlayer(SRectF rect, SColorF color, int playerNr) { SPlayerNotes notes = new SPlayerNotes(); - notes.Rect = Rect; - notes.Color = Color; + notes.Rect = rect; + notes.Color = color; notes.Alpha = 1f; notes.ID = ++_ActID; notes.Lines = null; notes.LineNr = -1; - notes.PlayerNr = PlayerNr; + notes.PlayerNr = playerNr; notes.Timer = new Stopwatch(); notes.GoldenStars = new List(); notes.Flares = new List(); @@ -210,27 +210,27 @@ namespace VocaluxeLib.Menu.SingNotes return notes.ID; } - public virtual void RemovePlayer(int ID) {} + public virtual void RemovePlayer(int iD) {} - public virtual void AddLine(int ID, CLine[] Line, int LineNr, int Player) + public virtual void AddLine(int iD, CLine[] line, int lineNr, int player) { - if (Line == null) + if (line == null) return; - int n = FindPlayerLine(ID); + int n = _FindPlayerLine(iD); if (n == -1) return; - if (LineNr == _PlayerNotes[n].LineNr) + if (lineNr == _PlayerNotes[n].LineNr) return; SPlayerNotes notes = _PlayerNotes[n]; - if (Line.Length == 0 || Line.Length <= LineNr) + if (line.Length == 0 || line.Length <= lineNr) return; - notes.Lines = Line; - notes.LineNr = LineNr; + notes.Lines = line; + notes.LineNr = lineNr; notes.GoldenStars.Clear(); notes.Flares.Clear(); notes.PerfectNoteEffect.Clear(); @@ -239,38 +239,38 @@ namespace VocaluxeLib.Menu.SingNotes _PlayerNotes.Add(notes); } - public virtual void RemoveLine(int ID) {} + public virtual void RemoveLine(int iD) {} - public virtual void AddNote(int ID, CNote Note) {} + public virtual void AddNote(int iD, CNote note) {} - public virtual void SetAlpha(int ID, float Alpha) + public virtual void SetAlpha(int iD, float alpha) { - int n = FindPlayerLine(ID); + int n = _FindPlayerLine(iD); if (n == -1) return; SPlayerNotes pn = _PlayerNotes[n]; - pn.Alpha = Alpha; + pn.Alpha = alpha; _PlayerNotes[n] = pn; } - public virtual float GetAlpha(int ID) + public virtual float GetAlpha(int iD) { - int n = FindPlayerLine(ID); + int n = _FindPlayerLine(iD); if (n == -1) return 0f; return _PlayerNotes[n].Alpha; } - public virtual void Draw(int ID, int Player) + public virtual void Draw(int iD, int player) { - Draw(ID, null, Player); + Draw(iD, null, player); } - public virtual void Draw(int ID, List SingLine, int Player) + public virtual void Draw(int iD, List singLine, int player) { - int n = FindPlayerLine(ID); + int n = _FindPlayerLine(iD); if (n == -1) return; @@ -283,19 +283,19 @@ namespace VocaluxeLib.Menu.SingNotes if (_PlayerNotes[n].Lines.Length <= _PlayerNotes[n].LineNr) return; - CLine Line = _PlayerNotes[n].Lines[_PlayerNotes[n].LineNr]; + CLine 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)); + _DrawNoteLines(_PlayerNotes[n].Rect, new SColorF(0.5f, 0.5f, 0.5f, 0.5f * _PlayerNotes[n].Alpha)); - if (Line.NoteCount == 0) + if (line.NoteCount == 0) return; float w = _PlayerNotes[n].Rect.W; float h = _PlayerNotes[n].Rect.H; float dh = h / CBase.Settings.GetNumNoteLines() * (2f - (int)CBase.Game.GetPlayer()[_PlayerNotes[n].PlayerNr].Difficulty) / 4f; - float beats = Line.LastNoteBeat - Line.FirstNoteBeat + 1; + float beats = line.LastNoteBeat - line.FirstNoteBeat + 1; if (beats == 0) return; @@ -306,35 +306,35 @@ namespace VocaluxeLib.Menu.SingNotes _PlayerNotes[n].Color.B, _PlayerNotes[n].Color.A * _PlayerNotes[n].Alpha); - float BaseLine = Line.BaseLine; - int Nr = 1; - foreach (CNote note in Line.Notes) + float baseLine = line.BaseLine; + int nr = 1; + foreach (CNote note in line.Notes) { if (note.NoteType != ENoteType.Freestyle) { float width = note.Duration / beats * w; SRectF 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, + _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(5f, 5f, 5f, 0.7f * _PlayerNotes[n].Alpha), 0.7f); + _DrawNoteBG(rect, color, 1f, _PlayerNotes[n].Timer); + _DrawNote(rect, new SColorF(5f, 5f, 5f, 0.7f * _PlayerNotes[n].Alpha), 0.7f); if (note.NoteType == ENoteType.Golden) { - AddGoldenNote(rect, n, Nr); - Nr++; + _AddGoldenNote(rect, n, nr); + nr++; } } } if (CBase.Config.GetDrawToneHelper() == EOffOn.TR_CONFIG_ON) - DrawToneHelper(n, (int)BaseLine, (CBase.Game.GetMidBeatD() - Line.FirstNoteBeat) / beats * w); + _DrawToneHelper(n, (int)baseLine, (CBase.Game.GetMidBeatD() - line.FirstNoteBeat) / beats * w); int i = 0; while (i < _PlayerNotes[n].PerfectLineTwinkle.Count) @@ -348,7 +348,7 @@ namespace VocaluxeLib.Menu.SingNotes foreach (CParticleEffect perfline in _PlayerNotes[n].PerfectLineTwinkle) perfline.Draw(); - if (SingLine == null || SingLine.Count == 0 || CBase.Game.GetPlayer()[Player].CurrentLine == -1 || SingLine.Count <= CBase.Game.GetPlayer()[Player].CurrentLine) + if (singLine == null || singLine.Count == 0 || CBase.Game.GetPlayer()[player].CurrentLine == -1 || singLine.Count <= CBase.Game.GetPlayer()[player].CurrentLine) { foreach (CParticleEffect stars in _PlayerNotes[n].GoldenStars) { @@ -358,9 +358,9 @@ namespace VocaluxeLib.Menu.SingNotes return; } - foreach (CNote note in SingLine[CBase.Game.GetPlayer()[Player].CurrentLine].Notes) + foreach (CNote note in singLine[CBase.Game.GetPlayer()[player].CurrentLine].Notes) { - if (note.StartBeat >= Line.FirstNoteBeat && note.EndBeat <= Line.LastNoteBeat) + if (note.StartBeat >= line.FirstNoteBeat && note.EndBeat <= line.LastNoteBeat) { float width = note.Duration / beats * w; @@ -368,8 +368,8 @@ namespace VocaluxeLib.Menu.SingNotes width -= (1 - (CBase.Game.GetMidBeatD() - CBase.Game.GetCurrentBeatD())) / beats * w; SRectF 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, + _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 @@ -379,30 +379,30 @@ namespace VocaluxeLib.Menu.SingNotes if (!note.Hit) f = 0.4f; - DrawNote(rect, color, f); + _DrawNote(rect, color, f); if (note.EndBeat >= CBase.Game.GetCurrentBeatD() && note.Hit && note.NoteType == ENoteType.Golden) { SRectF re = new SRectF(rect); re.W = (CBase.Game.GetMidBeatD() - note.StartBeat) / beats * w; - AddFlare(re, n); + _AddFlare(re, n); } if (note.Perfect && note.EndBeat < CBase.Game.GetCurrentBeatD()) { - AddPerfectNote(rect, n); + _AddPerfectNote(rect, n); note.Perfect = false; } } } - int currentLine = CBase.Game.GetPlayer()[Player].SingLine.Count - 1; + int currentLine = CBase.Game.GetPlayer()[player].SingLine.Count - 1; if (currentLine > 0) { - if (CBase.Game.GetPlayer()[Player].SingLine[currentLine - 1].PerfectLine) + if (CBase.Game.GetPlayer()[player].SingLine[currentLine - 1].PerfectLine) { - AddPerfectLine(n); - CBase.Game.GetPlayer()[Player].SingLine[currentLine - 1].PerfectLine = false; + _AddPerfectLine(n); + CBase.Game.GetPlayer()[player].SingLine[currentLine - 1].PerfectLine = false; } } @@ -448,15 +448,15 @@ namespace VocaluxeLib.Menu.SingNotes LoadTextures(); } - private int FindPlayerLine(int ID) + private int _FindPlayerLine(int iD) { - if (ID < 0 || ID > _PlayerNotes.Count) + if (iD < 0 || iD > _PlayerNotes.Count) return -1; int n = -1; for (int i = 0; i < _PlayerNotes.Count; i++) { - if (_PlayerNotes[i].ID == ID) + if (_PlayerNotes[i].ID == iD) { n = i; break; @@ -466,128 +466,128 @@ namespace VocaluxeLib.Menu.SingNotes return n; } - private void DrawNote(SRectF Rect, SColorF Color) + private void _DrawNote(SRectF rect, SColorF color) { - DrawNote(Rect, Color, 1f); + _DrawNote(rect, color, 1f); } - private void DrawNote(SRectF Rect, SColorF Color, float factor) + private void _DrawNote(SRectF rect, SColorF color, float factor) { const int spacing = 0; - float d = (1f - factor) / 2 * Rect.H; + float d = (1f - factor) / 2 * rect.H; float dw = d; - if (2 * dw > Rect.W) - dw = Rect.W / 2; + if (2 * dw > rect.W) + dw = rect.W / 2; SRectF 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 + rect.X + dw + spacing, + rect.Y + d + spacing, + rect.W - 2 * dw - 2 * spacing, + rect.H - 2 * d - 2 * spacing, + rect.Z ); - STexture NoteBegin = CBase.Theme.GetSkinTexture(_Theme.SkinLeftName, _PartyModeID); - STexture NoteMiddle = CBase.Theme.GetSkinTexture(_Theme.SkinMiddleName, _PartyModeID); - STexture NoteEnd = CBase.Theme.GetSkinTexture(_Theme.SkinRightName, _PartyModeID); + STexture noteBegin = CBase.Theme.GetSkinTexture(_Theme.SkinLeftName, _PartyModeID); + STexture noteMiddle = CBase.Theme.GetSkinTexture(_Theme.SkinMiddleName, _PartyModeID); + STexture noteEnd = CBase.Theme.GetSkinTexture(_Theme.SkinRightName, _PartyModeID); - float dx = NoteBegin.width * r.H / NoteBegin.height; + float dx = noteBegin.Width * r.H / noteBegin.Height; if (2 * dx > r.W) dx = r.W / 2; - CBase.Drawing.DrawTexture(NoteBegin, new SRectF(r.X, r.Y, dx, r.H, r.Z), Color); + CBase.Drawing.DrawTexture(noteBegin, new SRectF(r.X, r.Y, dx, r.H, r.Z), color); if (r.W - 2 * dx >= 2 * dx) - CBase.Drawing.DrawTexture(NoteMiddle, new SRectF(r.X + dx, r.Y, r.W - 2 * dx, r.H, r.Z), Color); + CBase.Drawing.DrawTexture(noteMiddle, new SRectF(r.X + dx, r.Y, r.W - 2 * dx, r.H, r.Z), color); else - CBase.Drawing.DrawTexture(NoteMiddle, new SRectF(r.X + dx, r.Y, 2 * dx, r.H, r.Z), Color, new SRectF(r.X + dx, r.Y, r.W - 2 * dx, r.H, r.Z)); + CBase.Drawing.DrawTexture(noteMiddle, new SRectF(r.X + dx, r.Y, 2 * dx, r.H, r.Z), color, new SRectF(r.X + dx, r.Y, r.W - 2 * dx, r.H, r.Z)); - CBase.Drawing.DrawTexture(NoteEnd, new SRectF(r.X + r.W - dx, r.Y, dx, r.H, r.Z), Color); + CBase.Drawing.DrawTexture(noteEnd, new SRectF(r.X + r.W - dx, r.Y, dx, r.H, r.Z), color); } - private void DrawNoteBG(SRectF Rect, SColorF Color, float factor, Stopwatch Timer) + 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.IsRunning) + timer.Start(); - if (Timer.ElapsedMilliseconds / 1000f > period) + if (timer.ElapsedMilliseconds / 1000f > period) { - Timer.Reset(); - Timer.Start(); + 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 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; + if (2 * dw > rect.W) + dw = rect.W / 2; SRectF 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 + rect.X + dw + spacing, + rect.Y + d + spacing, + rect.W - 2 * dw - 2 * spacing, + rect.H - 2 * d - 2 * spacing, + rect.Z ); - STexture NoteBackgroundBegin = CBase.Theme.GetSkinTexture(_Theme.SkinBackgroundLeftName, _PartyModeID); - STexture NoteBackgroundMiddle = CBase.Theme.GetSkinTexture(_Theme.SkinBackgroundMiddleName, _PartyModeID); - STexture NoteBackgroundEnd = CBase.Theme.GetSkinTexture(_Theme.SkinBackgroundRightName, _PartyModeID); + STexture noteBackgroundBegin = CBase.Theme.GetSkinTexture(_Theme.SkinBackgroundLeftName, _PartyModeID); + STexture noteBackgroundMiddle = CBase.Theme.GetSkinTexture(_Theme.SkinBackgroundMiddleName, _PartyModeID); + STexture noteBackgroundEnd = CBase.Theme.GetSkinTexture(_Theme.SkinBackgroundRightName, _PartyModeID); - float dx = NoteBackgroundBegin.width * r.H / NoteBackgroundBegin.height; + float dx = noteBackgroundBegin.Width * r.H / noteBackgroundBegin.Height; if (2 * dx > r.W) dx = r.W / 2; - SColorF col = new SColorF(Color.R, Color.G, Color.B, Color.A * alpha); + SColorF 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); + 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); + 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(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); + CBase.Drawing.DrawTexture(noteBackgroundEnd, new SRectF(r.X + r.W - dx, r.Y, dx, r.H, r.Z), col); } - protected void DrawNoteLines(SRectF Rect, SColorF Color) + protected void _DrawNoteLines(SRectF rect, SColorF color) { for (int i = 0; i < CBase.Settings.GetNumNoteLines() - 1; i++) { - float y = Rect.Y + Rect.H / CBase.Settings.GetNumNoteLines() * (i + 1); - CBase.Drawing.DrawColor(Color, new SRectF(Rect.X, y, Rect.W, 1, -1.0f)); + float y = rect.Y + rect.H / CBase.Settings.GetNumNoteLines() * (i + 1); + CBase.Drawing.DrawColor(color, new SRectF(rect.X, y, rect.W, 1, -1.0f)); } } - private void AddGoldenNote(SRectF Rect, int n, int Nr) + private void _AddGoldenNote(SRectF rect, int n, int nr) { - AddGoldenNote(Rect, n, Nr, 1f); + _AddGoldenNote(rect, n, nr, 1f); } - private void AddGoldenNote(SRectF Rect, int n, int Nr, float factor) + private void _AddGoldenNote(SRectF rect, int n, int nr, float factor) { const int spacing = 0; - if (Nr > _PlayerNotes[n].GoldenStars.Count) + if (nr > _PlayerNotes[n].GoldenStars.Count) { - float d = (1f - factor) / 2 * Rect.H; + float d = (1f - factor) / 2 * rect.H; float dw = d; - if (2 * dw > Rect.W) - dw = Rect.W / 2; + if (2 * dw > rect.W) + dw = rect.W / 2; SRectF 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 + rect.X + dw + spacing, + rect.Y + d + spacing, + rect.W - 2 * dw - 2 * spacing, + rect.H - 2 * d - 2 * spacing, + rect.Z ); int numstars = (int)(r.W * 0.25f); @@ -596,58 +596,58 @@ namespace VocaluxeLib.Menu.SingNotes } } - private void AddFlare(SRectF Rect, int n) + private void _AddFlare(SRectF rect, int n) { - AddFlare(Rect, n, 1f); + _AddFlare(rect, n, 1f); } - private void AddFlare(SRectF Rect, int n, float factor) + private void _AddFlare(SRectF rect, int n, float factor) { const int spacing = 0; - float d = (1f - factor) / 2 * Rect.H; + float d = (1f - factor) / 2 * rect.H; float dw = d; - if (2 * dw > Rect.W) - dw = Rect.W / 2; + if (2 * dw > rect.W) + dw = rect.W / 2; SRectF r = new SRectF( - Rect.X + dw + spacing + Rect.W - 2 * dw - 2 * spacing, - Rect.Y + d + spacing, + rect.X + dw + spacing + rect.W - 2 * dw - 2 * spacing, + rect.Y + d + spacing, 0f, - Rect.H - 2 * d - 2 * spacing, - Rect.Z + rect.H - 2 * d - 2 * spacing, + rect.Z ); CParticleEffect flares = new CParticleEffect(_PartyModeID, 15, new SColorF(1f, 1f, 1f, 1f), r, _Theme.SkinGoldenStarName, 20, EParticleType.Flare); _PlayerNotes[n].Flares.Add(flares); } - private void AddPerfectNote(SRectF Rect, int n) + private void _AddPerfectNote(SRectF rect, int n) { - AddPerfectNote(Rect, n, 1f); + _AddPerfectNote(rect, n, 1f); } - private void AddPerfectNote(SRectF Rect, int n, float factor) + private void _AddPerfectNote(SRectF rect, int n, float factor) { const int spacing = 0; - float d = (1f - factor) / 2 * Rect.H; + float d = (1f - factor) / 2 * rect.H; float dw = d; - if (2 * dw > Rect.W) - dw = Rect.W / 2; + if (2 * dw > rect.W) + dw = rect.W / 2; SRectF 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 + rect.X + dw + spacing, + rect.Y + d + spacing, + rect.W - 2 * dw - 2 * spacing, + rect.H - 2 * d - 2 * spacing, + rect.Z ); - STexture NoteBegin = CBase.Theme.GetSkinTexture(_Theme.SkinLeftName, _PartyModeID); - float dx = NoteBegin.width * r.H / NoteBegin.height; + STexture noteBegin = CBase.Theme.GetSkinTexture(_Theme.SkinLeftName, _PartyModeID); + float dx = noteBegin.Width * r.H / noteBegin.Height; if (2 * dx > r.W) dx = r.W / 2; @@ -656,7 +656,7 @@ namespace VocaluxeLib.Menu.SingNotes r.Y, dx * 0.5f, dx * 0.2f, - Rect.Z + rect.Z ); CParticleEffect stars = new CParticleEffect(_PartyModeID, CBase.Game.GetRandom(2) + 1, new SColorF(1f, 1f, 1f, 1f), r, _Theme.SkinPerfectNoteStarName, 35, @@ -664,34 +664,34 @@ namespace VocaluxeLib.Menu.SingNotes _PlayerNotes[n].PerfectNoteEffect.Add(stars); } - private void AddPerfectLine(int n) + private void _AddPerfectLine(int n) { CParticleEffect twinkle = new CParticleEffect(_PartyModeID, 200, _PlayerNotes[n].Color, _PlayerNotes[n].Rect, _Theme.SkinGoldenStarName, 25, EParticleType.Twinkle); _PlayerNotes[n].PerfectLineTwinkle.Add(twinkle); } - private void DrawToneHelper(int n, int BaseLine, float OffsetX) + private void _DrawToneHelper(int n, int baseLine, float offsetX) { - int TonePlayer = CBase.Record.GetToneAbs(_PlayerNotes[n].PlayerNr); + int tonePlayer = CBase.Record.GetToneAbs(_PlayerNotes[n].PlayerNr); SRectF noteBounds = _PlayerNotes[n].Rect; - while (TonePlayer - BaseLine < 0) - TonePlayer += 12; + while (tonePlayer - baseLine < 0) + tonePlayer += 12; - while (TonePlayer - BaseLine > 12) - TonePlayer -= 12; + while (tonePlayer - baseLine > 12) + tonePlayer -= 12; - if (OffsetX < 0f) - OffsetX = 0f; + if (offsetX < 0f) + offsetX = 0f; - if (OffsetX > noteBounds.W) - OffsetX = noteBounds.W; + if (offsetX > noteBounds.W) + offsetX = noteBounds.W; float dy = noteBounds.H / CBase.Settings.GetNumNoteLines(); SRectF drawRect = new SRectF( - noteBounds.X - dy + OffsetX, - noteBounds.Y + dy * (CBase.Settings.GetNumNoteLines() - 1 - (TonePlayer - BaseLine) / 2f), + noteBounds.X - dy + offsetX, + noteBounds.Y + dy * (CBase.Settings.GetNumNoteLines() - 1 - (tonePlayer - baseLine) / 2f), dy, dy, noteBounds.Z @@ -703,25 +703,25 @@ namespace VocaluxeLib.Menu.SingNotes _PlayerNotes[n].Color.B, _PlayerNotes[n].Color.A * _PlayerNotes[n].Alpha); - STexture ToneHelper = CBase.Theme.GetSkinTexture(_Theme.SkinToneHelperName, _PartyModeID); - CBase.Drawing.DrawTexture(ToneHelper, drawRect, color); + STexture toneHelper = CBase.Theme.GetSkinTexture(_Theme.SkinToneHelperName, _PartyModeID); + CBase.Drawing.DrawTexture(toneHelper, drawRect, color); - while (TonePlayer - BaseLine < 12) - TonePlayer += 12; + while (tonePlayer - baseLine < 12) + tonePlayer += 12; - while (TonePlayer - BaseLine > 24) - 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), + noteBounds.X - dy + offsetX, + noteBounds.Y + dy * (CBase.Settings.GetNumNoteLines() - 1 - (tonePlayer - baseLine) / 2f), dy, dy, noteBounds.Z ); - CBase.Drawing.DrawTexture(ToneHelper, drawRect, color); + CBase.Drawing.DrawTexture(toneHelper, drawRect, color); } #region ThemeEdit diff --git a/VocaluxeLib/Menu/SingNotes/CSingNotesClassic.cs b/VocaluxeLib/Menu/SingNotes/CSingNotesClassic.cs index 87f2d4e5..53cc55fa 100644 --- a/VocaluxeLib/Menu/SingNotes/CSingNotesClassic.cs +++ b/VocaluxeLib/Menu/SingNotes/CSingNotesClassic.cs @@ -2,7 +2,7 @@ { class CSingNotesClassic : CSingNotes { - public CSingNotesClassic(int PartyModeID) - : base(PartyModeID) {} + public CSingNotesClassic(int partyModeID) + : base(partyModeID) {} } } \ No newline at end of file diff --git a/VocaluxeLib/Menu/SingNotes/ISingNotes.cs b/VocaluxeLib/Menu/SingNotes/ISingNotes.cs index c1ae7287..0a814f4b 100644 --- a/VocaluxeLib/Menu/SingNotes/ISingNotes.cs +++ b/VocaluxeLib/Menu/SingNotes/ISingNotes.cs @@ -5,18 +5,18 @@ namespace VocaluxeLib.Menu.SingNotes public interface ISingNotes { void Reset(); - int AddPlayer(SRectF Rect, SColorF Color, int PlayerNr); - void RemovePlayer(int ID); + int AddPlayer(SRectF rect, SColorF color, int playerNr); + void RemovePlayer(int iD); - void AddLine(int ID, CLine[] Line, int LineNr, int Player); - void RemoveLine(int ID); + void AddLine(int iD, CLine[] line, int lineNr, int player); + void RemoveLine(int iD); - void AddNote(int ID, CNote Note); + void AddNote(int iD, CNote note); - void SetAlpha(int ID, float Alpha); - float GetAlpha(int ID); + void SetAlpha(int iD, float alpha); + float GetAlpha(int iD); - void Draw(int ID, int Player); - void Draw(int ID, List SingLine, int Player); + void Draw(int iD, int player); + void Draw(int iD, List singLine, int player); } } \ No newline at end of file diff --git a/VocaluxeLib/Menu/SongMenu/CSong.cs b/VocaluxeLib/Menu/SongMenu/CSong.cs index 4864601c..1d4fb03d 100644 --- a/VocaluxeLib/Menu/SongMenu/CSong.cs +++ b/VocaluxeLib/Menu/SongMenu/CSong.cs @@ -56,7 +56,7 @@ namespace VocaluxeLib.Menu.SongMenu } set { - if (value.index != -1) + if (value.Index != -1) { _CoverTextureBig = value; _CoverBigLoaded = true; @@ -64,11 +64,11 @@ namespace VocaluxeLib.Menu.SongMenu } } - public CCategory(string name, STexture CoverSmall, STexture CoverBig) + public CCategory(string name, STexture coverSmall, STexture coverBig) { Name = name; - CoverTextureSmall = CoverSmall; - CoverTextureBig = CoverBig; + CoverTextureSmall = coverSmall; + CoverTextureBig = coverBig; } public CCategory(CCategory cat) @@ -227,11 +227,11 @@ namespace VocaluxeLib.Menu.SongMenu //No point creating a song without a text file --> Use factory method LoadSong private CSong() {} - public static CSong LoadSong(string FilePath) + public static CSong LoadSong(string filePath) { - CSong Song = new CSong(); - if (Song.ReadHeader(FilePath)) - return Song; + CSong song = new CSong(); + if (song.ReadHeader(filePath)) + return song; return null; } @@ -316,12 +316,12 @@ namespace VocaluxeLib.Menu.SongMenu return Path.Combine(Folder, VideoFileName); } - public bool ReadHeader(string FilePath) + public bool ReadHeader(string filePath) { - if (!File.Exists(FilePath)) + if (!File.Exists(filePath)) return false; - Folder = Path.GetDirectoryName(FilePath); + Folder = Path.GetDirectoryName(filePath); foreach (string folder in CBase.Config.GetSongFolder()) { @@ -341,19 +341,19 @@ namespace VocaluxeLib.Menu.SongMenu } } - FileName = Path.GetFileName(FilePath); + FileName = Path.GetFileName(filePath); - EHeaderFlags HeaderFlags = new EHeaderFlags(); + EHeaderFlags headerFlags = new EHeaderFlags(); StreamReader sr = null; try { - sr = new StreamReader(FilePath, Encoding.Default, true); + sr = new StreamReader(filePath, Encoding.Default, true); string line; int pos = -1; - string Identifier = String.Empty; - string Value = String.Empty; + string identifier = String.Empty; + string value = String.Empty; while (!sr.EndOfStream) { @@ -367,19 +367,19 @@ namespace VocaluxeLib.Menu.SongMenu if (pos > 0) { - Identifier = line.Substring(1, pos - 1).Trim().ToUpper(); - Value = line.Substring(pos + 1, line.Length - pos - 1).Trim(); + identifier = line.Substring(1, pos - 1).Trim().ToUpper(); + value = line.Substring(pos + 1, line.Length - pos - 1).Trim(); - if (Value.Length > 0) + if (value.Length > 0) { - switch (Identifier) + switch (identifier) { case "ENCODING": - Encoding = CEncoding.GetEncoding(Value); + Encoding = CEncoding.GetEncoding(value); sr.Dispose(); sr = null; - sr = new StreamReader(FilePath, Encoding); - Identifier = String.Empty; + sr = new StreamReader(filePath, Encoding); + identifier = String.Empty; //Scip everything till encoding while (!sr.EndOfStream) @@ -394,136 +394,136 @@ namespace VocaluxeLib.Menu.SongMenu if (pos > 0) { - Identifier = line.Substring(1, pos - 1).Trim().ToUpper(); - if (Identifier == "ENCODING") + identifier = line.Substring(1, pos - 1).Trim().ToUpper(); + if (identifier == "ENCODING") break; } } break; case "TITLE": - if (Value.Length > 0) + if (value.Length > 0) { - Title = Value; - HeaderFlags |= EHeaderFlags.Title; + Title = value; + headerFlags |= EHeaderFlags.Title; } break; case "ARTIST": - if (Value.Length > 0) + if (value.Length > 0) { - Artist = Value; - HeaderFlags |= EHeaderFlags.Artist; + Artist = value; + headerFlags |= EHeaderFlags.Artist; } break; case "TITLE-ON-SORTING": - if (Value.Length > 0) - TitleSorting = Value; + if (value.Length > 0) + TitleSorting = value; break; case "ARTIST-ON-SORTING": - if (Value.Length > 0) - ArtistSorting = Value; + if (value.Length > 0) + ArtistSorting = value; break; case "P1": - if (Value.Length > 0) - DuetPart1 = Value; + if (value.Length > 0) + DuetPart1 = value; break; case "P2": - if (Value.Length > 0) - DuetPart2 = Value; + if (value.Length > 0) + DuetPart2 = value; break; case "MP3": - if (File.Exists(Path.Combine(Folder, Value))) + if (File.Exists(Path.Combine(Folder, value))) { - MP3FileName = Value; - HeaderFlags |= EHeaderFlags.MP3; + MP3FileName = value; + headerFlags |= EHeaderFlags.MP3; } else { - CBase.Log.LogError("Can't find audio file: " + Path.Combine(Folder, Value)); + CBase.Log.LogError("Can't find audio file: " + Path.Combine(Folder, value)); return false; } break; case "BPM": - if (CHelper.TryParse(Value, out BPM)) + if (CHelper.TryParse(value, out BPM)) { BPM *= 4; - HeaderFlags |= EHeaderFlags.BPM; + headerFlags |= EHeaderFlags.BPM; } break; case "EDITION": - if (Value.Length > 1) - Edition.Add(Value); + if (value.Length > 1) + Edition.Add(value); break; case "GENRE": - if (Value.Length > 1) - Genre.Add(Value); + if (value.Length > 1) + Genre.Add(value); break; case "YEAR": int num = 0; - if (Value.Length == 4 && int.TryParse(Value, out num) && num != 0) - Year = Value; + if (value.Length == 4 && int.TryParse(value, out num) && num != 0) + Year = value; break; case "LANGUAGE": - if (Value.Length > 1) - Language.Add(Value); + if (value.Length > 1) + Language.Add(value); break; case "COMMENT": - if (Value.Length > 1) - Comment.Add(Value); + if (value.Length > 1) + Comment.Add(value); break; case "GAP": - if (CHelper.TryParse(Value, out Gap)) + if (CHelper.TryParse(value, out Gap)) Gap /= 1000f; break; case "COVER": - if (File.Exists(Path.Combine(Folder, Value))) - CoverFileName = Value; + if (File.Exists(Path.Combine(Folder, value))) + CoverFileName = value; break; case "BACKGROUND": - if (File.Exists(Path.Combine(Folder, Value))) - BackgroundFileName = Value; + if (File.Exists(Path.Combine(Folder, value))) + BackgroundFileName = value; break; case "VIDEO": - if (File.Exists(Path.Combine(Folder, Value))) - VideoFileName = Value; + if (File.Exists(Path.Combine(Folder, value))) + VideoFileName = value; else - CBase.Log.LogError("Can't find video file: " + Path.Combine(Folder, Value)); + CBase.Log.LogError("Can't find video file: " + Path.Combine(Folder, value)); break; case "VIDEOGAP": - CHelper.TryParse(Value, out VideoGap); + CHelper.TryParse(value, out VideoGap); break; case "VIDEOASPECT": - CHelper.TryParse(Value, out VideoAspect, true); + CHelper.TryParse(value, out VideoAspect, true); break; case "START": - CHelper.TryParse(Value, out Start); + CHelper.TryParse(value, out Start); break; case "END": - if (CHelper.TryParse(Value, out Finish)) + if (CHelper.TryParse(value, out Finish)) Finish /= 1000f; break; case "PREVIEWSTART": - if (CHelper.TryParse(Value, out PreviewStart)) + if (CHelper.TryParse(value, out PreviewStart)) { if (PreviewStart < 0f) PreviewStart = 0f; else - HeaderFlags |= EHeaderFlags.PreviewStart; + headerFlags |= EHeaderFlags.PreviewStart; } break; case "MEDLEYSTARTBEAT": - if (int.TryParse(Value, out Medley.StartBeat)) - HeaderFlags |= EHeaderFlags.MedleyStartBeat; + if (int.TryParse(value, out Medley.StartBeat)) + headerFlags |= EHeaderFlags.MedleyStartBeat; break; case "MEDLEYENDBEAT": - if (int.TryParse(Value, out Medley.EndBeat)) - HeaderFlags |= EHeaderFlags.MedleyEndBeat; + if (int.TryParse(value, out Medley.EndBeat)) + headerFlags |= EHeaderFlags.MedleyEndBeat; break; case "CALCMEDLEY": - if (Value.ToUpper() == "OFF") + if (value.ToUpper() == "OFF") CalculateMedley = false; break; case "RELATIVE": - if (Value.ToUpper() == "YES" && Value.ToUpper() != "NO") + if (value.ToUpper() == "YES" && value.ToUpper() != "NO") Relative = EOffOn.TR_CONFIG_ON; break; } @@ -534,48 +534,48 @@ namespace VocaluxeLib.Menu.SongMenu if (sr.EndOfStream) { //No other data then header - CBase.Log.LogError("Lyrics/Notes missing: " + FilePath); + CBase.Log.LogError("Lyrics/Notes missing: " + filePath); return false; } - if ((HeaderFlags & EHeaderFlags.Title) == 0) + if ((headerFlags & EHeaderFlags.Title) == 0) { - CBase.Log.LogError("Title tag missing: " + FilePath); + CBase.Log.LogError("Title tag missing: " + filePath); return false; } - if ((HeaderFlags & EHeaderFlags.Artist) == 0) + if ((headerFlags & EHeaderFlags.Artist) == 0) { - CBase.Log.LogError("Artist tag missing: " + FilePath); + CBase.Log.LogError("Artist tag missing: " + filePath); return false; } - if ((HeaderFlags & EHeaderFlags.MP3) == 0) + if ((headerFlags & EHeaderFlags.MP3) == 0) { - CBase.Log.LogError("MP3 tag missing: " + FilePath); + CBase.Log.LogError("MP3 tag missing: " + filePath); return false; } - if ((HeaderFlags & EHeaderFlags.BPM) == 0) + if ((headerFlags & EHeaderFlags.BPM) == 0) { - CBase.Log.LogError("BPM tag missing: " + FilePath); + CBase.Log.LogError("BPM tag missing: " + filePath); return false; } #region check medley tags - if ((HeaderFlags & EHeaderFlags.MedleyStartBeat) != 0 && (HeaderFlags & EHeaderFlags.MedleyEndBeat) != 0) + if ((headerFlags & EHeaderFlags.MedleyStartBeat) != 0 && (headerFlags & EHeaderFlags.MedleyEndBeat) != 0) { if (Medley.StartBeat > Medley.EndBeat) { - CBase.Log.LogError("MedleyStartBeat is bigger than MedleyEndBeat in file: " + FilePath); - HeaderFlags = HeaderFlags - EHeaderFlags.MedleyStartBeat - EHeaderFlags.MedleyEndBeat; + CBase.Log.LogError("MedleyStartBeat is bigger than MedleyEndBeat in file: " + filePath); + headerFlags = headerFlags - EHeaderFlags.MedleyStartBeat - EHeaderFlags.MedleyEndBeat; } } - if ((HeaderFlags & EHeaderFlags.PreviewStart) == 0 || PreviewStart == 0f) + if ((headerFlags & EHeaderFlags.PreviewStart) == 0 || PreviewStart == 0f) { //PreviewStart is not set or <=0 - if ((HeaderFlags & EHeaderFlags.MedleyStartBeat) != 0) + if ((headerFlags & EHeaderFlags.MedleyStartBeat) != 0) //fallback to MedleyStart PreviewStart = CBase.Game.GetTimeFromBeats(Medley.StartBeat, BPM); else @@ -583,7 +583,7 @@ namespace VocaluxeLib.Menu.SongMenu PreviewStart = 0f; } - if ((HeaderFlags & EHeaderFlags.MedleyStartBeat) != 0 && (HeaderFlags & EHeaderFlags.MedleyEndBeat) != 0) + if ((headerFlags & EHeaderFlags.MedleyStartBeat) != 0 && (headerFlags & EHeaderFlags.MedleyEndBeat) != 0) { Medley.Source = EMedleySource.Tag; Medley.FadeInTime = CBase.Settings.GetDefaultMedleyFadeInTime(); @@ -597,11 +597,11 @@ namespace VocaluxeLib.Menu.SongMenu { if (sr != null) sr.Dispose(); - CBase.Log.LogError("Error reading txt header in file \"" + FilePath + "\": " + e.Message); + CBase.Log.LogError("Error reading txt header in file \"" + filePath + "\": " + e.Message); return false; } sr.Dispose(); - CheckFiles(); + _CheckFiles(); //Before saving this tags to .txt: Check, if ArtistSorting and Artist are equal, then don't save this tag. if (ArtistSorting.Length == 0) @@ -618,34 +618,34 @@ namespace VocaluxeLib.Menu.SongMenu return ReadNotes(Path.Combine(Folder, FileName)); } - public bool ReadNotes(string FilePath, bool forceReload = false) + public bool ReadNotes(string filePath, bool forceReload = false) { //Skip loading if already done and no reload is forced if (_NotesLoaded && !forceReload) return true; - if (!File.Exists(FilePath)) + if (!File.Exists(filePath)) { - CBase.Log.LogError("Error loading song. The file does not exist: " + FilePath); + CBase.Log.LogError("Error loading song. The file does not exist: " + filePath); return false; } - char TempC = char.MinValue; - int Param1 = 0; - int Param2 = 0; - int Param3 = 0; + char tempC = char.MinValue; + int param1 = 0; + int param2 = 0; + int param3 = 0; int currentPos = 0; - string ParamS = String.Empty; + string paramS = String.Empty; bool isNewSentence = false; string line = String.Empty; - int Player = 0; - int FileLineNo = 0; + int player = 0; + int fileLineNo = 0; StreamReader sr = null; try { - sr = new StreamReader(FilePath, Encoding, true); + sr = new StreamReader(filePath, Encoding, true); Notes.Reset(); @@ -653,42 +653,42 @@ namespace VocaluxeLib.Menu.SongMenu while (!sr.EndOfStream) { line = sr.ReadLine(); - FileLineNo++; + fileLineNo++; - TempC = (char)sr.Peek(); - if ((TempC == '#') || (TempC == '\r') || (TempC == '\n')) + tempC = (char)sr.Peek(); + if ((tempC == '#') || (tempC == '\r') || (tempC == '\n')) continue; - if ((TempC == ':') || (TempC == 'F') || (TempC == '*') || (TempC == 'P')) + if ((tempC == ':') || (tempC == 'F') || (tempC == '*') || (tempC == 'P')) { - TempC = (char)sr.Read(); + tempC = (char)sr.Read(); break; } } if (sr.EndOfStream) { - CBase.Log.LogError("Error loading song. Line No.: " + FileLineNo.ToString() + ". No lyrics/notes found: " + FilePath); + CBase.Log.LogError("Error loading song. Line No.: " + fileLineNo.ToString() + ". No lyrics/notes found: " + filePath); return false; } do { char chr; - switch (TempC) + switch (tempC) { case 'P': while ((chr = (char)sr.Read()) == ' ') {} - int.TryParse(chr.ToString(), out Param1); - if (Param1 == 1) - Player = 0; - else if (Param1 == 2) - Player = 1; - else if (Param1 == 3) - Player = 2; + int.TryParse(chr.ToString(), out param1); + if (param1 == 1) + player = 0; + else if (param1 == 2) + player = 1; + else if (param1 == 3) + player = 2; else { - CBase.Log.LogError("Error loading song. Line No.: " + FileLineNo.ToString() + ". Wrong or missing number after \"P\": " + FilePath); + CBase.Log.LogError("Error loading song. Line No.: " + fileLineNo.ToString() + ". Wrong or missing number after \"P\": " + filePath); return false; } sr.ReadLine(); @@ -697,72 +697,72 @@ namespace VocaluxeLib.Menu.SongMenu case '*': case 'F': sr.Read(); - Param1 = CHelper.TryReadInt(sr); + param1 = CHelper.TryReadInt(sr); sr.Read(); - Param2 = CHelper.TryReadInt(sr); + param2 = CHelper.TryReadInt(sr); sr.Read(); - Param3 = CHelper.TryReadInt(sr); + param3 = CHelper.TryReadInt(sr); sr.Read(); - ParamS = sr.ReadLine(); + paramS = sr.ReadLine(); - ENoteType NoteType; + ENoteType noteType; - if (TempC.CompareTo('*') == 0) - NoteType = ENoteType.Golden; - else if (TempC.CompareTo('F') == 0) - NoteType = ENoteType.Freestyle; + if (tempC.CompareTo('*') == 0) + noteType = ENoteType.Golden; + else if (tempC.CompareTo('F') == 0) + noteType = ENoteType.Freestyle; else - NoteType = ENoteType.Normal; + noteType = ENoteType.Normal; if (Relative == EOffOn.TR_CONFIG_ON) - Param1 += currentPos; + param1 += currentPos; - if (Player != 2) + if (player != 2) // one singer - ParseNote(Player, NoteType, Param1, Param2, Param3, ParamS); + _ParseNote(player, noteType, param1, param2, param3, paramS); else { // both singer - ParseNote(0, NoteType, Param1, Param2, Param3, ParamS); - ParseNote(1, NoteType, Param1, Param2, Param3, ParamS); + _ParseNote(0, noteType, param1, param2, param3, paramS); + _ParseNote(1, noteType, param1, param2, param3, paramS); } isNewSentence = false; break; case '-': if (isNewSentence) { - CBase.Log.LogError("Error loading song. Line No.: " + FileLineNo.ToString() + ". Double sentence break: " + FilePath); + CBase.Log.LogError("Error loading song. Line No.: " + fileLineNo.ToString() + ". Double sentence break: " + filePath); return false; } sr.Read(); - Param1 = CHelper.TryReadInt(sr); + param1 = CHelper.TryReadInt(sr); if (Relative == EOffOn.TR_CONFIG_ON) { - Param1 += currentPos; + param1 += currentPos; sr.Read(); - Param2 = CHelper.TryReadInt(sr); - currentPos += Param2; + param2 = CHelper.TryReadInt(sr); + currentPos += param2; } - if (Player != 2) + if (player != 2) // one singer - NewSentence(Player, Param1); + _NewSentence(player, param1); else { // both singer - NewSentence(0, Param1); - NewSentence(1, Param1); + _NewSentence(0, param1); + _NewSentence(1, param1); } isNewSentence = true; sr.ReadLine(); break; default: - CBase.Log.LogError("Error loading song. Line No.: " + FileLineNo.ToString() + ". Unexpected or missing character (" + TempC + "): " + FilePath); + CBase.Log.LogError("Error loading song. Line No.: " + fileLineNo.ToString() + ". Unexpected or missing character (" + tempC + "): " + filePath); return false; } int c = 0; @@ -770,41 +770,41 @@ namespace VocaluxeLib.Menu.SongMenu { c = sr.Read(); } while (!sr.EndOfStream && (c == 19 || c == 16 || c == 13 || c == 10)); - TempC = (char)c; - FileLineNo++; - } while (!sr.EndOfStream && (TempC != 'E')); + tempC = (char)c; + fileLineNo++; + } while (!sr.EndOfStream && (tempC != 'E')); foreach (CLines lines in Notes.Lines) lines.UpdateTimings(); } catch (Exception e) { - CBase.Log.LogError("Error loading song. Line No.: " + FileLineNo.ToString() + ". An unhandled exception occured (" + e.Message + "): " + FilePath); + CBase.Log.LogError("Error loading song. Line No.: " + fileLineNo.ToString() + ". An unhandled exception occured (" + e.Message + "): " + filePath); if (sr != null) sr.Dispose(); return false; } sr.Dispose(); - FindRefrain(); - FindShortEnd(); + _FindRefrain(); + _FindShortEnd(); _NotesLoaded = true; if (IsDuet) - CheckDuet(); + _CheckDuet(); return true; } - private bool ParseNote(int Player, ENoteType NoteType, int Start, int Length, int Tone, string Text) + private bool _ParseNote(int player, ENoteType noteType, int start, int length, int tone, string text) { - CNote note = new CNote(Start, Length, Tone, Text, NoteType); - CLines lines = Notes.GetLines(Player); + CNote note = new CNote(start, length, tone, text, noteType); + CLines lines = Notes.GetLines(player); return lines.AddNote(note); } - private void NewSentence(int Player, int Start) + private void _NewSentence(int player, int start) { - CLines lines = Notes.GetLines(Player); + CLines lines = Notes.GetLines(player); CLine line = new CLine(); - line.StartBeat = Start; + line.StartBeat = start; lines.AddLine(line); } @@ -823,7 +823,7 @@ namespace VocaluxeLib.Menu.SongMenu _CoverSmallLoaded = true; } - private void CheckFiles() + private void _CheckFiles() { if (CoverFileName.Length == 0) { @@ -850,7 +850,7 @@ namespace VocaluxeLib.Menu.SongMenu } } - private void CheckDuet() + private void _CheckDuet() { if (DuetPart1.Length == 0) { @@ -864,14 +864,14 @@ namespace VocaluxeLib.Menu.SongMenu } } - private struct Series + private struct SSeries { public int Start; - public int end; - public int length; + public int End; + public int Length; } - private List GetSeries() + private List _GetSeries() { CLines lines = Notes.GetLines(0); @@ -889,16 +889,16 @@ namespace VocaluxeLib.Menu.SongMenu } // find equal sentences series - List series = new List(); + List series = new List(); for (int i = 0; i < lines.LineCount - 1; i++) { for (int j = i + 1; j < lines.LineCount; j++) { if (sentences[i] == sentences[j] && sentences[i].Length > 0) { - Series tempSeries = new Series(); + SSeries tempSeries = new SSeries(); tempSeries.Start = i; - tempSeries.end = i; + tempSeries.End = i; int max = 0; if (j + j - i - 1 > lines.LineCount - 1) @@ -909,12 +909,12 @@ namespace VocaluxeLib.Menu.SongMenu for (int k = 1; k <= max; k++) { if (sentences[i + k] == sentences[j + k] && sentences[i + k].Length > 0) - tempSeries.end = i + k; + tempSeries.End = i + k; else break; } - tempSeries.length = tempSeries.end - tempSeries.Start + 1; + tempSeries.Length = tempSeries.End - tempSeries.Start + 1; series.Add(tempSeries); } } @@ -922,7 +922,7 @@ namespace VocaluxeLib.Menu.SongMenu return series; } - private void FindRefrain() + private void _FindRefrain() { if (IsDuet) { @@ -936,7 +936,7 @@ namespace VocaluxeLib.Menu.SongMenu if (!CalculateMedley) return; - List series = GetSeries(); + List series = _GetSeries(); if (series == null) return; @@ -944,17 +944,17 @@ namespace VocaluxeLib.Menu.SongMenu int longest = 0; for (int i = 0; i < series.Count; i++) { - if (series[i].length > series[longest].length) + if (series[i].Length > series[longest].Length) longest = i; } CLines lines = Notes.GetLines(0); // set medley vars - if (series.Count > 0 && series[longest].length > CBase.Settings.GetMedleyMinSeriesLength()) + if (series.Count > 0 && series[longest].Length > CBase.Settings.GetMedleyMinSeriesLength()) { Medley.StartBeat = lines.Line[series[longest].Start].FirstNoteBeat; - Medley.EndBeat = lines.Line[series[longest].end].LastNoteBeat; + Medley.EndBeat = lines.Line[series[longest].End].LastNoteBeat; bool foundEnd = false; @@ -991,9 +991,9 @@ namespace VocaluxeLib.Menu.SongMenu } } - private void FindShortEnd() + private void _FindShortEnd() { - List series = GetSeries(); + List series = _GetSeries(); if (series == null) return; @@ -1005,16 +1005,16 @@ namespace VocaluxeLib.Menu.SongMenu //Check if stop is in series for (int i = 0; i < series.Count; i++) { - if (lines.Line[series[i].Start].FirstNoteBeat < stop && lines.Line[series[i].end].LastNoteBeat > stop) + if (lines.Line[series[i].Start].FirstNoteBeat < stop && lines.Line[series[i].End].LastNoteBeat > stop) { - if (stop < (lines.Line[series[i].Start].FirstNoteBeat + ((lines.Line[series[i].end].LastNoteBeat - lines.Line[series[i].Start].FirstNoteBeat) / 2))) + if (stop < (lines.Line[series[i].Start].FirstNoteBeat + ((lines.Line[series[i].End].LastNoteBeat - lines.Line[series[i].Start].FirstNoteBeat) / 2))) { ShortEnd = lines.Line[series[i].Start - 1].LastNote.EndBeat; return; } else { - ShortEnd = lines.Line[series[i].end].LastNote.EndBeat; + ShortEnd = lines.Line[series[i].End].LastNote.EndBeat; return; } } diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenu.cs b/VocaluxeLib/Menu/SongMenu/CSongMenu.cs index 9742e62f..4c46093b 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenu.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenu.cs @@ -10,16 +10,16 @@ namespace VocaluxeLib.Menu.SongMenu private ISongMenu _SongMenu; private ESongMenu _Type; - public CSongMenu(int PartyModeID) + public CSongMenu(int partyModeID) { - _PartyModeID = PartyModeID; - CreateSongMenu(); + _PartyModeID = partyModeID; + _CreateSongMenu(); } public void UpdateSongMenuType() { if (_Type != CBase.Config.GetSongMenuType()) - CreateSongMenu(); + _CreateSongMenu(); } public bool Selected @@ -40,9 +40,9 @@ namespace VocaluxeLib.Menu.SongMenu } #region ISongMenu - public void Update(ScreenSongOptions SongOptions) + public void Update(SScreenSongOptions songOptions) { - _SongMenu.Update(SongOptions); + _SongMenu.Update(songOptions); } public void OnShow() @@ -55,14 +55,14 @@ namespace VocaluxeLib.Menu.SongMenu _SongMenu.OnHide(); } - public void HandleInput(ref KeyEvent KeyEvent, ScreenSongOptions SongOptions) + public void HandleInput(ref SKeyEvent keyEvent, SScreenSongOptions songOptions) { - _SongMenu.HandleInput(ref KeyEvent, SongOptions); + _SongMenu.HandleInput(ref keyEvent, songOptions); } - public void HandleMouse(ref MouseEvent MouseEvent, ScreenSongOptions SongOptions) + public void HandleMouse(ref SMouseEvent mouseEvent, SScreenSongOptions songOptions) { - _SongMenu.HandleMouse(ref MouseEvent, SongOptions); + _SongMenu.HandleMouse(ref mouseEvent, songOptions); } public void Draw() @@ -70,9 +70,9 @@ namespace VocaluxeLib.Menu.SongMenu _SongMenu.Draw(); } - public void ApplyVolume(float VolumeMax) + public void ApplyVolume(float volumeMax) { - _SongMenu.ApplyVolume(VolumeMax); + _SongMenu.ApplyVolume(volumeMax); } public bool IsActive() @@ -80,9 +80,9 @@ namespace VocaluxeLib.Menu.SongMenu return _SongMenu.IsActive(); } - public void SetActive(bool Active) + public void SetActive(bool active) { - _SongMenu.SetActive(Active); + _SongMenu.SetActive(active); } public int GetSelectedSong() @@ -95,9 +95,9 @@ namespace VocaluxeLib.Menu.SongMenu return _SongMenu.GetSelectedSongCover(); } - public void SetSelectedSong(int VisibleSongNr) + public void SetSelectedSong(int visibleSongNr) { - _SongMenu.SetSelectedSong(VisibleSongNr); + _SongMenu.SetSelectedSong(visibleSongNr); } public int GetSelectedCategory() @@ -105,9 +105,9 @@ namespace VocaluxeLib.Menu.SongMenu return _SongMenu.GetSelectedCategory(); } - public void SetSelectedCategory(int CategoryNr) + public void SetSelectedCategory(int categoryNr) { - _SongMenu.SetSelectedCategory(CategoryNr); + _SongMenu.SetSelectedCategory(categoryNr); } public bool EnterCurrentCategory() @@ -125,9 +125,9 @@ namespace VocaluxeLib.Menu.SongMenu return _SongMenu.IsSelected(); } - public void SetSelected(bool Selected) + public void SetSelected(bool selected) { - _SongMenu.SetSelected(Selected); + _SongMenu.SetSelected(selected); } public bool IsVisible() @@ -135,9 +135,9 @@ namespace VocaluxeLib.Menu.SongMenu return _SongMenu.IsVisible(); } - public void SetVisible(bool Visible) + public void SetVisible(bool visible) { - _SongMenu.SetVisible(Visible); + _SongMenu.SetVisible(visible); } public SRectF GetRect() @@ -150,9 +150,9 @@ namespace VocaluxeLib.Menu.SongMenu return _SongMenu.IsSmallView(); } - public void SetSmallView(bool SmallView) + public void SetSmallView(bool smallView) { - _SongMenu.SetSmallView(SmallView); + _SongMenu.SetSmallView(smallView); } #endregion ISongMenu @@ -162,9 +162,9 @@ namespace VocaluxeLib.Menu.SongMenu return _SongMenu.GetThemeName(); } - public bool LoadTheme(string XmlPath, string ElementName, CXMLReader xmlReader, int SkinIndex) + public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex) { - return _SongMenu.LoadTheme(XmlPath, ElementName, xmlReader, SkinIndex); + return _SongMenu.LoadTheme(xmlPath, elementName, xmlReader, skinIndex); } public bool SaveTheme(XmlWriter writer) @@ -198,7 +198,7 @@ namespace VocaluxeLib.Menu.SongMenu } #endregion IMenuElement - private void CreateSongMenu() + private void _CreateSongMenu() { if (_SongMenu != null) _SongMenu.OnHide(); diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenuBook.cs b/VocaluxeLib/Menu/SongMenu/CSongMenuBook.cs index abba0394..e8503b9b 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenuBook.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenuBook.cs @@ -2,7 +2,7 @@ { class CSongMenuBook : CSongMenuFramework { - public CSongMenuBook(int PartyModeID) - : base(PartyModeID) {} + public CSongMenuBook(int partyModeID) + : base(partyModeID) {} } } \ No newline at end of file diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenuDreidel.cs b/VocaluxeLib/Menu/SongMenu/CSongMenuDreidel.cs index 27898f75..b38a53fd 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenuDreidel.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenuDreidel.cs @@ -21,8 +21,8 @@ return _actualSelection; } */ - public CSongMenuDreidel(int PartyModeID) - : base(PartyModeID) {} + public CSongMenuDreidel(int partyModeID) + : base(partyModeID) {} public override void Init() { diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs b/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs index 5781304d..3ada6f36 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs @@ -24,7 +24,7 @@ namespace VocaluxeLib.Menu.SongMenu //public SThemeSongMenuBook songMenuBook; //public SThemeSongMenuDreidel songMenuDreidel; //public SThemeSongMenuList songMenuList; - public SThemeSongMenuTileBoard songMenuTileBoard; + public SThemeSongMenuTileBoard SongMenuTileBoard; } struct SThemeSongMenuBook {} @@ -38,32 +38,32 @@ namespace VocaluxeLib.Menu.SongMenu /// /// Number of tiles horizontal /// - public int numW; + public int NumW; /// /// Number of tiles vertical /// - public int numH; + public int NumH; /// /// Number of tiles horizontal in small-modus /// - public int numWsmall; + public int NumWsmall; /// /// Number of tiles vertical in small-modus /// - public int numHsmall; + public int NumHsmall; /// /// Space between tiles horizontal /// - public float spaceW; + public float SpaceW; /// /// Space between tiles vertical /// - public float spaceH; + public float SpaceH; public SRectF TileRect; public SRectF TileRectSmall; @@ -86,12 +86,12 @@ namespace VocaluxeLib.Menu.SongMenu protected SThemeSongMenu _Theme; private bool _ThemeLoaded; - private readonly Stopwatch _timer = new Stopwatch(); + private readonly Stopwatch _Timer = new Stopwatch(); private readonly Stopwatch _VideoFadeTimer = new Stopwatch(); - private readonly List _streams = new List(); - private int _actsong = -1; - private int _actsongstream = -1; - protected STexture _vidtex = new STexture(-1); + private readonly List _Streams = new List(); + private int _Actsong = -1; + private int _Actsongstream = -1; + protected STexture _Vidtex = new STexture(-1); protected bool _Initialized = false; protected int _LastKnownNumSongs = 0; @@ -114,10 +114,10 @@ namespace VocaluxeLib.Menu.SongMenu //for preview only get { - if ((_SelectedInternal != _SelectedPending) && (_timer.ElapsedMilliseconds >= _PendingTime)) + if ((_SelectedInternal != _SelectedPending) && (_Timer.ElapsedMilliseconds >= _PendingTime)) { - _timer.Stop(); - _timer.Reset(); + _Timer.Stop(); + _Timer.Reset(); _SelectedInternal = _SelectedPending; } return _SelectedInternal; @@ -126,8 +126,8 @@ namespace VocaluxeLib.Menu.SongMenu { if (value == -1) { - _timer.Stop(); - _timer.Reset(); + _Timer.Stop(); + _Timer.Reset(); _SelectedInternal = -1; _SelectedPending = -1; @@ -136,25 +136,25 @@ namespace VocaluxeLib.Menu.SongMenu if ((value != _SelectedInternal) && (value != _SelectedPending)) { - _timer.Reset(); - _timer.Start(); + _Timer.Reset(); + _Timer.Start(); _SelectedPending = value; } - if ((value == _SelectedPending) && ((_timer.ElapsedMilliseconds >= _PendingTime) || (_SelectedInternal == -1))) + if ((value == _SelectedPending) && ((_Timer.ElapsedMilliseconds >= _PendingTime) || (_SelectedInternal == -1))) { - _timer.Stop(); - _timer.Reset(); + _Timer.Stop(); + _Timer.Reset(); _SelectedInternal = _SelectedPending; } } } - protected virtual void SetSelectedNow() + protected virtual void _SetSelectedNow() { - _timer.Stop(); - _timer.Reset(); + _Timer.Stop(); + _Timer.Reset(); _SelectedInternal = _SelectedPending; } @@ -167,14 +167,14 @@ namespace VocaluxeLib.Menu.SongMenu protected int _SongStream { - get { return _actsongstream; } + get { return _Actsongstream; } } protected int _Video { get; private set; } protected int _ActSong { - get { return _actsong; } + get { return _Actsong; } } public SRectF Rect @@ -194,7 +194,7 @@ namespace VocaluxeLib.Menu.SongMenu public virtual int GetActualSelection() { - return _actsong; + return _Actsong; } private bool _Selected; @@ -205,10 +205,10 @@ namespace VocaluxeLib.Menu.SongMenu return _Selected; } - public void SetSelected(bool Selected) + public void SetSelected(bool selected) { - _Selected = Selected; - SetActive(Selected); + _Selected = selected; + SetActive(selected); } public bool IsVisible() @@ -216,26 +216,26 @@ namespace VocaluxeLib.Menu.SongMenu return _Visible; } - public void SetVisible(bool Visible) + public void SetVisible(bool visible) { - _Visible = Visible; + _Visible = visible; } - public CSongMenuFramework(int PartyModeID) + public CSongMenuFramework(int partyModeID) { - _PartyModeID = PartyModeID; + _PartyModeID = partyModeID; _Theme = new SThemeSongMenu(); - _Theme.songMenuTileBoard.TextArtist = new CText(_PartyModeID); - _Theme.songMenuTileBoard.TextTitle = new CText(_PartyModeID); - _Theme.songMenuTileBoard.TextSongLength = new CText(_PartyModeID); + _Theme.SongMenuTileBoard.TextArtist = new CText(_PartyModeID); + _Theme.SongMenuTileBoard.TextTitle = new CText(_PartyModeID); + _Theme.SongMenuTileBoard.TextSongLength = new CText(_PartyModeID); - _Theme.songMenuTileBoard.StaticCoverBig = new CStatic(_PartyModeID); - _Theme.songMenuTileBoard.StaticTextBG = new CStatic(_PartyModeID); - _Theme.songMenuTileBoard.StaticDuetIcon = new CStatic(_PartyModeID); - _Theme.songMenuTileBoard.StaticVideoIcon = new CStatic(_PartyModeID); - _Theme.songMenuTileBoard.StaticMedleyCalcIcon = new CStatic(_PartyModeID); - _Theme.songMenuTileBoard.StaticMedleyTagIcon = new CStatic(_PartyModeID); + _Theme.SongMenuTileBoard.StaticCoverBig = new CStatic(_PartyModeID); + _Theme.SongMenuTileBoard.StaticTextBG = new CStatic(_PartyModeID); + _Theme.SongMenuTileBoard.StaticDuetIcon = new CStatic(_PartyModeID); + _Theme.SongMenuTileBoard.StaticVideoIcon = new CStatic(_PartyModeID); + _Theme.SongMenuTileBoard.StaticMedleyCalcIcon = new CStatic(_PartyModeID); + _Theme.SongMenuTileBoard.StaticMedleyTagIcon = new CStatic(_PartyModeID); _ThemeLoaded = false; } @@ -245,9 +245,9 @@ namespace VocaluxeLib.Menu.SongMenu return _Theme.Name; } - public bool LoadTheme(string XmlPath, string ElementName, CXMLReader xmlReader, int SkinIndex) + public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex) { - string item = XmlPath + "/" + ElementName; + string item = xmlPath + "/" + elementName; _ThemeLoaded = true; _ThemeLoaded &= xmlReader.GetValue(item + "/CoverBackground", ref _Theme.CoverBackgroundName, String.Empty); @@ -258,7 +258,7 @@ namespace VocaluxeLib.Menu.SongMenu _ThemeLoaded &= xmlReader.GetValue(item + "/MedleyTagIcon", ref _Theme.MedleyTagIcon, String.Empty); if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty)) - _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, SkinIndex, out _Color); + _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out _Color); else { _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref _Color.R); @@ -268,41 +268,41 @@ namespace VocaluxeLib.Menu.SongMenu } #region SongMenuTileBoard - _ThemeLoaded &= xmlReader.TryGetIntValue(item + "/SongMenuTileBoard/NumW", ref _Theme.songMenuTileBoard.numW); - _ThemeLoaded &= xmlReader.TryGetIntValue(item + "/SongMenuTileBoard/NumH", ref _Theme.songMenuTileBoard.numH); - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuTileBoard/SpaceW", ref _Theme.songMenuTileBoard.spaceW); - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuTileBoard/SpaceH", ref _Theme.songMenuTileBoard.spaceH); + _ThemeLoaded &= xmlReader.TryGetIntValue(item + "/SongMenuTileBoard/NumW", ref _Theme.SongMenuTileBoard.NumW); + _ThemeLoaded &= xmlReader.TryGetIntValue(item + "/SongMenuTileBoard/NumH", ref _Theme.SongMenuTileBoard.NumH); + _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuTileBoard/SpaceW", ref _Theme.SongMenuTileBoard.SpaceW); + _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuTileBoard/SpaceH", ref _Theme.SongMenuTileBoard.SpaceH); - _ThemeLoaded &= xmlReader.TryGetIntValue(item + "/SongMenuTileBoard/NumWsmall", ref _Theme.songMenuTileBoard.numWsmall); - _ThemeLoaded &= xmlReader.TryGetIntValue(item + "/SongMenuTileBoard/NumHsmall", ref _Theme.songMenuTileBoard.numHsmall); + _ThemeLoaded &= xmlReader.TryGetIntValue(item + "/SongMenuTileBoard/NumWsmall", ref _Theme.SongMenuTileBoard.NumWsmall); + _ThemeLoaded &= xmlReader.TryGetIntValue(item + "/SongMenuTileBoard/NumHsmall", ref _Theme.SongMenuTileBoard.NumHsmall); - _ThemeLoaded &= _Theme.songMenuTileBoard.TextArtist.LoadTheme(item + "/SongMenuTileBoard", "TextArtist", xmlReader, SkinIndex); - _ThemeLoaded &= _Theme.songMenuTileBoard.TextTitle.LoadTheme(item + "/SongMenuTileBoard", "TextTitle", xmlReader, SkinIndex); - _ThemeLoaded &= _Theme.songMenuTileBoard.TextSongLength.LoadTheme(item + "/SongMenuTileBoard", "TextSongLength", xmlReader, SkinIndex); + _ThemeLoaded &= _Theme.SongMenuTileBoard.TextArtist.LoadTheme(item + "/SongMenuTileBoard", "TextArtist", xmlReader, skinIndex); + _ThemeLoaded &= _Theme.SongMenuTileBoard.TextTitle.LoadTheme(item + "/SongMenuTileBoard", "TextTitle", xmlReader, skinIndex); + _ThemeLoaded &= _Theme.SongMenuTileBoard.TextSongLength.LoadTheme(item + "/SongMenuTileBoard", "TextSongLength", xmlReader, skinIndex); - _ThemeLoaded &= _Theme.songMenuTileBoard.StaticCoverBig.LoadTheme(item + "/SongMenuTileBoard", "StaticCoverBig", xmlReader, SkinIndex); - _ThemeLoaded &= _Theme.songMenuTileBoard.StaticTextBG.LoadTheme(item + "/SongMenuTileBoard", "StaticTextBG", xmlReader, SkinIndex); - _ThemeLoaded &= _Theme.songMenuTileBoard.StaticDuetIcon.LoadTheme(item + "/SongMenuTileBoard", "StaticDuetIcon", xmlReader, SkinIndex); - _ThemeLoaded &= _Theme.songMenuTileBoard.StaticVideoIcon.LoadTheme(item + "/SongMenuTileBoard", "StaticVideoIcon", xmlReader, SkinIndex); - _ThemeLoaded &= _Theme.songMenuTileBoard.StaticMedleyCalcIcon.LoadTheme(item + "/SongMenuTileBoard", "StaticMedleyCalcIcon", xmlReader, SkinIndex); - _ThemeLoaded &= _Theme.songMenuTileBoard.StaticMedleyTagIcon.LoadTheme(item + "/SongMenuTileBoard", "StaticMedleyTagIcon", xmlReader, SkinIndex); + _ThemeLoaded &= _Theme.SongMenuTileBoard.StaticCoverBig.LoadTheme(item + "/SongMenuTileBoard", "StaticCoverBig", xmlReader, skinIndex); + _ThemeLoaded &= _Theme.SongMenuTileBoard.StaticTextBG.LoadTheme(item + "/SongMenuTileBoard", "StaticTextBG", xmlReader, skinIndex); + _ThemeLoaded &= _Theme.SongMenuTileBoard.StaticDuetIcon.LoadTheme(item + "/SongMenuTileBoard", "StaticDuetIcon", xmlReader, skinIndex); + _ThemeLoaded &= _Theme.SongMenuTileBoard.StaticVideoIcon.LoadTheme(item + "/SongMenuTileBoard", "StaticVideoIcon", xmlReader, skinIndex); + _ThemeLoaded &= _Theme.SongMenuTileBoard.StaticMedleyCalcIcon.LoadTheme(item + "/SongMenuTileBoard", "StaticMedleyCalcIcon", xmlReader, skinIndex); + _ThemeLoaded &= _Theme.SongMenuTileBoard.StaticMedleyTagIcon.LoadTheme(item + "/SongMenuTileBoard", "StaticMedleyTagIcon", xmlReader, skinIndex); - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuTileBoard/TileRectX", ref _Theme.songMenuTileBoard.TileRect.X); - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuTileBoard/TileRectY", ref _Theme.songMenuTileBoard.TileRect.Y); - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuTileBoard/TileRectZ", ref _Theme.songMenuTileBoard.TileRect.Z); - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuTileBoard/TileRectW", ref _Theme.songMenuTileBoard.TileRect.W); - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuTileBoard/TileRectH", ref _Theme.songMenuTileBoard.TileRect.H); + _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuTileBoard/TileRectX", ref _Theme.SongMenuTileBoard.TileRect.X); + _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuTileBoard/TileRectY", ref _Theme.SongMenuTileBoard.TileRect.Y); + _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuTileBoard/TileRectZ", ref _Theme.SongMenuTileBoard.TileRect.Z); + _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuTileBoard/TileRectW", ref _Theme.SongMenuTileBoard.TileRect.W); + _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuTileBoard/TileRectH", ref _Theme.SongMenuTileBoard.TileRect.H); - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuTileBoard/TileRectSmallX", ref _Theme.songMenuTileBoard.TileRectSmall.X); - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuTileBoard/TileRectSmallY", ref _Theme.songMenuTileBoard.TileRectSmall.Y); - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuTileBoard/TileRectSmallZ", ref _Theme.songMenuTileBoard.TileRectSmall.Z); - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuTileBoard/TileRectSmallW", ref _Theme.songMenuTileBoard.TileRectSmall.W); - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuTileBoard/TileRectSmallH", ref _Theme.songMenuTileBoard.TileRectSmall.H); + _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuTileBoard/TileRectSmallX", ref _Theme.SongMenuTileBoard.TileRectSmall.X); + _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuTileBoard/TileRectSmallY", ref _Theme.SongMenuTileBoard.TileRectSmall.Y); + _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuTileBoard/TileRectSmallZ", ref _Theme.SongMenuTileBoard.TileRectSmall.Z); + _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuTileBoard/TileRectSmallW", ref _Theme.SongMenuTileBoard.TileRectSmall.W); + _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuTileBoard/TileRectSmallH", ref _Theme.SongMenuTileBoard.TileRectSmall.H); #endregion SongMenuTileBoard if (_ThemeLoaded) { - _Theme.Name = ElementName; + _Theme.Name = elementName; LoadTextures(); Init(); } @@ -351,47 +351,47 @@ namespace VocaluxeLib.Menu.SongMenu writer.WriteStartElement("SongMenuTileBoard"); writer.WriteComment(": Number of tiles horizontal"); - writer.WriteElementString("NumW", _Theme.songMenuTileBoard.numW.ToString()); + writer.WriteElementString("NumW", _Theme.SongMenuTileBoard.NumW.ToString()); writer.WriteComment(": Number of tiles vertical"); - writer.WriteElementString("NumH", _Theme.songMenuTileBoard.numH.ToString()); + writer.WriteElementString("NumH", _Theme.SongMenuTileBoard.NumH.ToString()); writer.WriteComment(": Space between tiles horizontal"); - writer.WriteElementString("SpaceW", _Theme.songMenuTileBoard.spaceW.ToString("#0.00")); + writer.WriteElementString("SpaceW", _Theme.SongMenuTileBoard.SpaceW.ToString("#0.00")); writer.WriteComment(": Space between tiles vertical"); - writer.WriteElementString("SpaceH", _Theme.songMenuTileBoard.spaceH.ToString("#0.00")); + writer.WriteElementString("SpaceH", _Theme.SongMenuTileBoard.SpaceH.ToString("#0.00")); writer.WriteComment(": Number of tiles horizontal in small-mode"); - writer.WriteElementString("NumWsmall", _Theme.songMenuTileBoard.numWsmall.ToString()); + writer.WriteElementString("NumWsmall", _Theme.SongMenuTileBoard.NumWsmall.ToString()); writer.WriteComment(": Number of tiles vertical in small-mode"); - writer.WriteElementString("NumHsmall", _Theme.songMenuTileBoard.numHsmall.ToString()); + writer.WriteElementString("NumHsmall", _Theme.SongMenuTileBoard.NumHsmall.ToString()); writer.WriteComment(", , , , : SongMenu position, width and height"); - writer.WriteElementString("TileRectX", _Theme.songMenuTileBoard.TileRect.X.ToString("#0")); - writer.WriteElementString("TileRectY", _Theme.songMenuTileBoard.TileRect.Y.ToString("#0")); - writer.WriteElementString("TileRectZ", _Theme.songMenuTileBoard.TileRect.Z.ToString("#0.00")); - writer.WriteElementString("TileRectW", _Theme.songMenuTileBoard.TileRect.W.ToString("#0")); - writer.WriteElementString("TileRectH", _Theme.songMenuTileBoard.TileRect.H.ToString("#0")); + writer.WriteElementString("TileRectX", _Theme.SongMenuTileBoard.TileRect.X.ToString("#0")); + writer.WriteElementString("TileRectY", _Theme.SongMenuTileBoard.TileRect.Y.ToString("#0")); + writer.WriteElementString("TileRectZ", _Theme.SongMenuTileBoard.TileRect.Z.ToString("#0.00")); + writer.WriteElementString("TileRectW", _Theme.SongMenuTileBoard.TileRect.W.ToString("#0")); + writer.WriteElementString("TileRectH", _Theme.SongMenuTileBoard.TileRect.H.ToString("#0")); writer.WriteComment(", , , , : SongMenu position, width and height in small-mode"); - writer.WriteElementString("TileRectSmallX", _Theme.songMenuTileBoard.TileRectSmall.X.ToString("#0")); - writer.WriteElementString("TileRectSmallY", _Theme.songMenuTileBoard.TileRectSmall.Y.ToString("#0")); - writer.WriteElementString("TileRectSmallZ", _Theme.songMenuTileBoard.TileRectSmall.Z.ToString("#0.00")); - writer.WriteElementString("TileRectSmallW", _Theme.songMenuTileBoard.TileRectSmall.W.ToString("#0")); - writer.WriteElementString("TileRectSmallH", _Theme.songMenuTileBoard.TileRectSmall.H.ToString("#0")); + writer.WriteElementString("TileRectSmallX", _Theme.SongMenuTileBoard.TileRectSmall.X.ToString("#0")); + writer.WriteElementString("TileRectSmallY", _Theme.SongMenuTileBoard.TileRectSmall.Y.ToString("#0")); + writer.WriteElementString("TileRectSmallZ", _Theme.SongMenuTileBoard.TileRectSmall.Z.ToString("#0.00")); + writer.WriteElementString("TileRectSmallW", _Theme.SongMenuTileBoard.TileRectSmall.W.ToString("#0")); + writer.WriteElementString("TileRectSmallH", _Theme.SongMenuTileBoard.TileRectSmall.H.ToString("#0")); - _Theme.songMenuTileBoard.TextArtist.SaveTheme(writer); - _Theme.songMenuTileBoard.TextTitle.SaveTheme(writer); - _Theme.songMenuTileBoard.TextSongLength.SaveTheme(writer); + _Theme.SongMenuTileBoard.TextArtist.SaveTheme(writer); + _Theme.SongMenuTileBoard.TextTitle.SaveTheme(writer); + _Theme.SongMenuTileBoard.TextSongLength.SaveTheme(writer); - _Theme.songMenuTileBoard.StaticCoverBig.SaveTheme(writer); - _Theme.songMenuTileBoard.StaticTextBG.SaveTheme(writer); - _Theme.songMenuTileBoard.StaticDuetIcon.SaveTheme(writer); - _Theme.songMenuTileBoard.StaticVideoIcon.SaveTheme(writer); - _Theme.songMenuTileBoard.StaticMedleyCalcIcon.SaveTheme(writer); - _Theme.songMenuTileBoard.StaticMedleyTagIcon.SaveTheme(writer); + _Theme.SongMenuTileBoard.StaticCoverBig.SaveTheme(writer); + _Theme.SongMenuTileBoard.StaticTextBG.SaveTheme(writer); + _Theme.SongMenuTileBoard.StaticDuetIcon.SaveTheme(writer); + _Theme.SongMenuTileBoard.StaticVideoIcon.SaveTheme(writer); + _Theme.SongMenuTileBoard.StaticMedleyCalcIcon.SaveTheme(writer); + _Theme.SongMenuTileBoard.StaticMedleyTagIcon.SaveTheme(writer); writer.WriteEndElement(); #endregion SongMenuTileBoard @@ -405,7 +405,7 @@ namespace VocaluxeLib.Menu.SongMenu public virtual void Init() { - Reset(); + _Reset(); _Initialized = true; } @@ -415,32 +415,32 @@ namespace VocaluxeLib.Menu.SongMenu Init(); } - public virtual void Update(ScreenSongOptions SongOptions) + public virtual void Update(SScreenSongOptions songOptions) { if (!_Initialized) return; - if (_actsong != _PreviewSelected) - SelectSong(_PreviewSelected); + if (_Actsong != _PreviewSelected) + _SelectSong(_PreviewSelected); - if (_streams.Count > 0 && _Video != -1) + if (_Streams.Count > 0 && _Video != -1) { - if (CBase.Video.IsFinished(_Video) || CBase.Sound.IsFinished(_actsongstream)) + if (CBase.Video.IsFinished(_Video) || CBase.Sound.IsFinished(_Actsongstream)) { CBase.Video.Close(_Video); _Video = -1; return; } - float time = CBase.Sound.GetPosition(_actsongstream); + float time = CBase.Sound.GetPosition(_Actsongstream); float vtime = 0f; - CBase.Video.GetFrame(_Video, ref _vidtex, time, ref vtime); + CBase.Video.GetFrame(_Video, ref _Vidtex, time, ref vtime); if (_VideoFadeTimer.ElapsedMilliseconds <= 3000L) - _vidtex.color.A = _VideoFadeTimer.ElapsedMilliseconds / 3000f; + _Vidtex.Color.A = _VideoFadeTimer.ElapsedMilliseconds / 3000f; else { - _vidtex.color.A = 1f; + _Vidtex.Color.A = 1f; _VideoFadeTimer.Stop(); } } @@ -448,33 +448,33 @@ namespace VocaluxeLib.Menu.SongMenu public virtual void OnShow() { - _actsongstream = -1; - _vidtex = new STexture(-1); + _Actsongstream = -1; + _Vidtex = new STexture(-1); } public virtual void OnHide() { - foreach (int stream in _streams) + foreach (int stream in _Streams) CBase.Sound.FadeAndStop(stream, 0f, 0.75f); - _streams.Clear(); + _Streams.Clear(); CBase.Video.Close(_Video); _Video = -1; - CBase.Drawing.RemoveTexture(ref _vidtex); + CBase.Drawing.RemoveTexture(ref _Vidtex); - _timer.Stop(); - _timer.Reset(); + _Timer.Stop(); + _Timer.Reset(); _SelectedInternal = _SelectedPending; } - public virtual void HandleInput(ref KeyEvent KeyEvent, ScreenSongOptions SongOptions) + public virtual void HandleInput(ref SKeyEvent keyEvent, SScreenSongOptions songOptions) { if (!_Initialized) return; } - public virtual void HandleMouse(ref MouseEvent MouseEvent, ScreenSongOptions SongOptions) + public virtual void HandleMouse(ref SMouseEvent mouseEvent, SScreenSongOptions songOptions) { if (!_Initialized) return; @@ -486,14 +486,14 @@ namespace VocaluxeLib.Menu.SongMenu return; if (_Video != -1) - CBase.Drawing.DrawTexture(_vidtex, new SRectF(0, 0, 1280, 720, 0)); + CBase.Drawing.DrawTexture(_Vidtex, new SRectF(0, 0, 1280, 720, 0)); } - public virtual void ApplyVolume(float VolumeMax) + public virtual void ApplyVolume(float volumeMax) { - _MaxVolume = VolumeMax; + _MaxVolume = volumeMax; - foreach (int stream in _streams) + foreach (int stream in _Streams) CBase.Sound.SetStreamVolumeMax(stream, _MaxVolume); } @@ -502,9 +502,9 @@ namespace VocaluxeLib.Menu.SongMenu return _Active; } - public virtual void SetActive(bool Active) + public virtual void SetActive(bool active) { - _Active = Active; + _Active = active; } public virtual int GetSelectedSong() @@ -522,19 +522,19 @@ namespace VocaluxeLib.Menu.SongMenu return -1; } - public virtual void SetSelectedSong(int VisibleSongNr) + public virtual void SetSelectedSong(int visibleSongNr) { if (!_Initialized) return; } - public virtual void SetSelectedCategory(int CategoryNr) + public virtual void SetSelectedCategory(int categoryNr) { if (!_Initialized) return; } - public virtual void SetSmallView(bool SmallView) + public virtual void SetSmallView(bool smallView) { if (!_Initialized) return; @@ -567,23 +567,23 @@ namespace VocaluxeLib.Menu.SongMenu return false; if (CBase.Songs.GetCurrentCategoryIndex() >= 0 || _PreviewSelected < 0 || _PreviewSelected >= CBase.Songs.GetNumCategories()) return false; - EnterCategory(_PreviewSelected); + _EnterCategory(_PreviewSelected); return true; } - protected virtual void EnterCategory(int Category) + protected virtual void _EnterCategory(int category) { if (!_Initialized) return; - if (Category >= CBase.Songs.GetNumCategories()) + if (category >= CBase.Songs.GetNumCategories()) return; - Reset(); - CBase.Songs.SetCategory(Category); + _Reset(); + CBase.Songs.SetCategory(category); } - protected virtual void ShowCategories() + protected virtual void _ShowCategories() { if (!_Initialized) return; @@ -591,37 +591,37 @@ namespace VocaluxeLib.Menu.SongMenu if (CBase.Songs.GetCurrentCategoryIndex() == -1) return; - Reset(); + _Reset(); CBase.Songs.SetCategory(-1); } public void ApplyVolume() { - CBase.Sound.SetStreamVolume(_actsongstream, CBase.Config.GetPreviewMusicVolume()); + CBase.Sound.SetStreamVolume(_Actsongstream, CBase.Config.GetPreviewMusicVolume()); } - protected void SelectSong(int nr) + 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.GetNumVisibleSongs() > 0) && (nr >= 0) && ((_Actsong != nr) || (_Streams.Count == 0))) { - _streams.ForEach(soundStream => CBase.Sound.FadeAndStop(soundStream, 0f, 1f)); - _streams.Clear(); + _Streams.ForEach(soundStream => CBase.Sound.FadeAndStop(soundStream, 0f, 1f)); + _Streams.Clear(); CBase.Video.Close(_Video); _Video = -1; - CBase.Drawing.RemoveTexture(ref _vidtex); + CBase.Drawing.RemoveTexture(ref _Vidtex); - _actsong = nr; - if (_actsong >= CBase.Songs.GetNumVisibleSongs()) - _actsong = 0; + _Actsong = nr; + if (_Actsong >= CBase.Songs.GetNumVisibleSongs()) + _Actsong = 0; - int stream = CBase.Sound.Load(Path.Combine(CBase.Songs.GetVisibleSong(_actsong).Folder, CBase.Songs.GetVisibleSong(_actsong).MP3FileName), true); + int stream = CBase.Sound.Load(Path.Combine(CBase.Songs.GetVisibleSong(_Actsong).Folder, CBase.Songs.GetVisibleSong(_Actsong).MP3FileName), true); CBase.Sound.SetStreamVolumeMax(stream, _MaxVolume); CBase.Sound.SetStreamVolume(stream, 0f); - float startposition = CBase.Songs.GetVisibleSong(_actsong).PreviewStart; + float startposition = CBase.Songs.GetVisibleSong(_Actsong).PreviewStart; if (startposition == 0f) startposition = CBase.Sound.GetLength(stream) / 4f; @@ -629,15 +629,15 @@ namespace VocaluxeLib.Menu.SongMenu CBase.Sound.SetPosition(stream, startposition); CBase.Sound.Play(stream); CBase.Sound.Fade(stream, 100f, 3f); - _streams.Add(stream); - _actsongstream = stream; + _Streams.Add(stream); + _Actsongstream = stream; - if (CBase.Songs.GetVisibleSong(_actsong).VideoFileName.Length > 0 && CBase.Config.GetVideoPreview() == EOffOn.TR_CONFIG_ON) + if (CBase.Songs.GetVisibleSong(_Actsong).VideoFileName.Length > 0 && CBase.Config.GetVideoPreview() == EOffOn.TR_CONFIG_ON) { - _Video = CBase.Video.Load(Path.Combine(CBase.Songs.GetVisibleSong(_actsong).Folder, CBase.Songs.GetVisibleSong(_actsong).VideoFileName)); + _Video = CBase.Video.Load(Path.Combine(CBase.Songs.GetVisibleSong(_Actsong).Folder, CBase.Songs.GetVisibleSong(_Actsong).VideoFileName)); if (_Video == -1) return; - CBase.Video.Skip(_Video, startposition, CBase.Songs.GetVisibleSong(_actsong).VideoGap); + CBase.Video.Skip(_Video, startposition, CBase.Songs.GetVisibleSong(_Actsong).VideoGap); _VideoFadeTimer.Stop(); _VideoFadeTimer.Reset(); _VideoFadeTimer.Start(); @@ -645,19 +645,19 @@ namespace VocaluxeLib.Menu.SongMenu } } - protected void Reset() + protected void _Reset() { - foreach (int stream in _streams) + foreach (int stream in _Streams) CBase.Sound.FadeAndStop(stream, 0f, 0.75f); - _streams.Clear(); + _Streams.Clear(); CBase.Video.Close(_Video); _Video = -1; - CBase.Drawing.RemoveTexture(ref _vidtex); + CBase.Drawing.RemoveTexture(ref _Vidtex); - _timer.Stop(); - _timer.Reset(); + _Timer.Stop(); + _Timer.Reset(); _SelectedInternal = _SelectedPending; } diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenuList.cs b/VocaluxeLib/Menu/SongMenu/CSongMenuList.cs index dca53e30..3111472a 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenuList.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenuList.cs @@ -2,7 +2,7 @@ { class CSongMenuList : CSongMenuFramework { - public CSongMenuList(int PartyModeID) - : base(PartyModeID) {} + public CSongMenuList(int partyModeID) + : base(partyModeID) {} } } \ No newline at end of file diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs b/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs index 39fdcd15..ec382871 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs @@ -34,33 +34,33 @@ namespace VocaluxeLib.Menu.SongMenu private int _TileH; private int _Offset = -1; - private int _actualSelection = -1; + private int _ActualSelection = -1; private bool _SmallView; - public CSongMenuTileBoard(int PartyModeID) - : base(PartyModeID) {} + public CSongMenuTileBoard(int partyModeID) + : base(partyModeID) {} public override int GetActualSelection() { - return _actualSelection; + return _ActualSelection; } public override void Init() { base.Init(); - _Rect = _Theme.songMenuTileBoard.TileRect; + _Rect = _Theme.SongMenuTileBoard.TileRect; - _NumW = _Theme.songMenuTileBoard.numW; - _NumH = _Theme.songMenuTileBoard.numH; - _SpaceW = _Theme.songMenuTileBoard.spaceW; - _SpaceH = _Theme.songMenuTileBoard.spaceH; + _NumW = _Theme.SongMenuTileBoard.NumW; + _NumH = _Theme.SongMenuTileBoard.NumH; + _SpaceW = _Theme.SongMenuTileBoard.SpaceW; + _SpaceH = _Theme.SongMenuTileBoard.SpaceH; _PendingTime = 100L; - _TileW = (int)((_Theme.songMenuTileBoard.TileRect.W - _SpaceW * (_NumW - 1)) / _NumW); - _TileH = (int)((_Theme.songMenuTileBoard.TileRect.H - _SpaceH * (_NumH - 1)) / _NumH); + _TileW = (int)((_Theme.SongMenuTileBoard.TileRect.W - _SpaceW * (_NumW - 1)) / _NumW); + _TileH = (int)((_Theme.SongMenuTileBoard.TileRect.H - _SpaceH * (_NumH - 1)) / _NumH); _CoverTexture = CBase.Theme.GetSkinTexture(_Theme.CoverBackgroundName, _PartyModeID); _CoverBigTexture = CBase.Theme.GetSkinTexture(_Theme.CoverBigBackgroundName, _PartyModeID); @@ -70,38 +70,38 @@ namespace VocaluxeLib.Menu.SongMenu { for (int j = 0; j < _NumW; j++) { - SRectF rect = new SRectF(_Theme.songMenuTileBoard.TileRect.X + j * (_TileW + _SpaceW), - _Theme.songMenuTileBoard.TileRect.Y + i * (_TileH + _SpaceH), _TileW, _TileH, _Rect.Z); + SRectF rect = new SRectF(_Theme.SongMenuTileBoard.TileRect.X + j * (_TileW + _SpaceW), + _Theme.SongMenuTileBoard.TileRect.Y + i * (_TileH + _SpaceH), _TileW, _TileH, _Rect.Z); CStatic tile = new CStatic(_PartyModeID, _CoverTexture, Color, rect); _Tiles.Add(tile); } } - _ScrollRect = new SRectF(0, 0, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH(), _Theme.songMenuTileBoard.TileRect.Z); + _ScrollRect = new SRectF(0, 0, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH(), _Theme.SongMenuTileBoard.TileRect.Z); _PreviewSelected = -1; _Offset = 0; - _CoverBig = _Theme.songMenuTileBoard.StaticCoverBig; - _TextBG = _Theme.songMenuTileBoard.StaticTextBG; - _DuetIcon = _Theme.songMenuTileBoard.StaticDuetIcon; - _VideoIcon = _Theme.songMenuTileBoard.StaticVideoIcon; - _MedleyCalcIcon = _Theme.songMenuTileBoard.StaticMedleyCalcIcon; - _MedleyTagIcon = _Theme.songMenuTileBoard.StaticMedleyTagIcon; + _CoverBig = _Theme.SongMenuTileBoard.StaticCoverBig; + _TextBG = _Theme.SongMenuTileBoard.StaticTextBG; + _DuetIcon = _Theme.SongMenuTileBoard.StaticDuetIcon; + _VideoIcon = _Theme.SongMenuTileBoard.StaticVideoIcon; + _MedleyCalcIcon = _Theme.SongMenuTileBoard.StaticMedleyCalcIcon; + _MedleyTagIcon = _Theme.SongMenuTileBoard.StaticMedleyTagIcon; - _Artist = _Theme.songMenuTileBoard.TextArtist; - _Title = _Theme.songMenuTileBoard.TextTitle; - _SongLength = _Theme.songMenuTileBoard.TextSongLength; + _Artist = _Theme.SongMenuTileBoard.TextArtist; + _Title = _Theme.SongMenuTileBoard.TextTitle; + _SongLength = _Theme.SongMenuTileBoard.TextSongLength; } - public override void Update(ScreenSongOptions SongOptions) + public override void Update(SScreenSongOptions songOptions) { - base.Update(SongOptions); + base.Update(songOptions); - if (SongOptions.Selection.RandomOnly) + if (songOptions.Selection.RandomOnly) { _Locked = _PreviewSelected; - _actualSelection = _PreviewSelected; + _ActualSelection = _PreviewSelected; for (int i = 0; i < _Tiles.Count; i++) _Tiles[i].Selected = _Locked == i + _Offset; } @@ -110,14 +110,14 @@ namespace VocaluxeLib.Menu.SongMenu public override void OnShow() { if (CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_OFF && CBase.Songs.GetNumCategories() > 0 && CBase.Songs.GetCurrentCategoryIndex() == -1) - EnterCategory(0); - _actualSelection = -1; + _EnterCategory(0); + _ActualSelection = -1; _Locked = -1; _PreviewSelected = -1; - UpdateList(0, true); + _UpdateList(0, true); //AfterCategoryChange(); SetSelectedSong(_ActSong); - AfterCategoryChange(); + _AfterCategoryChange(); CBase.Songs.UpdateRandomSongList(); int actcat = _PreviewSelected; @@ -150,15 +150,15 @@ namespace VocaluxeLib.Menu.SongMenu } } - public override void HandleInput(ref KeyEvent KeyEvent, ScreenSongOptions SongOptions) + public override void HandleInput(ref SKeyEvent keyEvent, SScreenSongOptions songOptions) { - base.HandleInput(ref KeyEvent, SongOptions); + base.HandleInput(ref keyEvent, songOptions); - if (!KeyEvent.KeyPressed) + if (!keyEvent.KeyPressed) { - if (!(KeyEvent.Key == Keys.Left || KeyEvent.Key == Keys.Right || KeyEvent.Key == Keys.Up || KeyEvent.Key == Keys.Down || - KeyEvent.Key == Keys.Escape || KeyEvent.Key == Keys.Back || KeyEvent.Key == Keys.Enter || - KeyEvent.Key == Keys.PageDown || KeyEvent.Key == Keys.PageUp)) + if (!(keyEvent.Key == Keys.Left || keyEvent.Key == Keys.Right || keyEvent.Key == Keys.Up || keyEvent.Key == Keys.Down || + keyEvent.Key == Keys.Escape || keyEvent.Key == Keys.Back || keyEvent.Key == Keys.Enter || + keyEvent.Key == Keys.PageDown || keyEvent.Key == Keys.PageUp)) return; bool sel = false; @@ -172,39 +172,39 @@ namespace VocaluxeLib.Menu.SongMenu } if ((_Locked == -1 || !sel) && - (KeyEvent.Key != Keys.Escape && KeyEvent.Key != Keys.Back && KeyEvent.Key != Keys.PageUp && KeyEvent.Key != Keys.PageDown)) + (keyEvent.Key != Keys.Escape && keyEvent.Key != Keys.Back && keyEvent.Key != Keys.PageUp && keyEvent.Key != Keys.PageDown)) { if (_PreviewSelected > -1) _Locked = _PreviewSelected; else { _Locked = 0; - _actualSelection = 0; + _ActualSelection = 0; _PreviewSelected = 0; - SetSelectedNow(); - UpdateList(0, true); + _SetSelectedNow(); + _UpdateList(0, true); } } else { - switch (KeyEvent.Key) + switch (keyEvent.Key) { case Keys.Enter: if (CBase.Songs.GetCurrentCategoryIndex() < 0) { - EnterCategory(_PreviewSelected); - KeyEvent.Handled = true; + _EnterCategory(_PreviewSelected); + keyEvent.Handled = true; } - else if (_actualSelection > -1 && _PreviewSelected >= 0) - _Locked = _actualSelection; + else if (_ActualSelection > -1 && _PreviewSelected >= 0) + _Locked = _ActualSelection; break; case Keys.Escape: case Keys.Back: - if (CBase.Songs.GetCurrentCategoryIndex() > -1 && CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_ON && SongOptions.Selection.CategoryChangeAllowed) + if (CBase.Songs.GetCurrentCategoryIndex() > -1 && CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_ON && songOptions.Selection.CategoryChangeAllowed) { - ShowCategories(); - KeyEvent.Handled = true; + _ShowCategories(); + keyEvent.Handled = true; } //else if (CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_OFF) //{ @@ -213,85 +213,85 @@ namespace VocaluxeLib.Menu.SongMenu break; case Keys.PageUp: - if (CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_ON && SongOptions.Selection.CategoryChangeAllowed) - PrevCategory(); + if (CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_ON && songOptions.Selection.CategoryChangeAllowed) + _PrevCategory(); break; case Keys.PageDown: - if (CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_ON && SongOptions.Selection.CategoryChangeAllowed) - NextCategory(); + if (CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_ON && songOptions.Selection.CategoryChangeAllowed) + _NextCategory(); break; case Keys.Left: - if (_Locked > 0 && (!SongOptions.Selection.RandomOnly || SongOptions.Selection.CategoryChangeAllowed && CBase.Songs.GetCurrentCategoryIndex() < 0)) + if (_Locked > 0 && (!songOptions.Selection.RandomOnly || songOptions.Selection.CategoryChangeAllowed && CBase.Songs.GetCurrentCategoryIndex() < 0)) { _Locked--; - UpdateList(); + _UpdateList(); } break; case Keys.Right: - if (CBase.Songs.GetCurrentCategoryIndex() < 0 && SongOptions.Selection.CategoryChangeAllowed) + if (CBase.Songs.GetCurrentCategoryIndex() < 0 && songOptions.Selection.CategoryChangeAllowed) { if (_Locked < CBase.Songs.GetNumCategories() - 1) { _Locked++; - UpdateList(); + _UpdateList(); } } else { - if (CBase.Songs.GetCurrentCategoryIndex() != -1 && _Locked < CBase.Songs.GetNumVisibleSongs() - 1 && !SongOptions.Selection.RandomOnly) + if (CBase.Songs.GetCurrentCategoryIndex() != -1 && _Locked < CBase.Songs.GetNumVisibleSongs() - 1 && !songOptions.Selection.RandomOnly) { _Locked++; - UpdateList(); + _UpdateList(); } } break; case Keys.Up: - if (KeyEvent.ModSHIFT && CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_ON && SongOptions.Selection.CategoryChangeAllowed) + if (keyEvent.ModShift && CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_ON && songOptions.Selection.CategoryChangeAllowed) { - PrevCategory(); + _PrevCategory(); break; } if (_Locked > _NumW - 1 && - (!SongOptions.Selection.RandomOnly || SongOptions.Selection.CategoryChangeAllowed && CBase.Songs.GetCurrentCategoryIndex() < 0)) + (!songOptions.Selection.RandomOnly || songOptions.Selection.CategoryChangeAllowed && CBase.Songs.GetCurrentCategoryIndex() < 0)) { _Locked -= _NumW; - UpdateList(); + _UpdateList(); } break; case Keys.Down: - if (KeyEvent.ModSHIFT && CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_ON && SongOptions.Selection.CategoryChangeAllowed) + if (keyEvent.ModShift && CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_ON && songOptions.Selection.CategoryChangeAllowed) { - NextCategory(); + _NextCategory(); break; } - if (CBase.Songs.GetCurrentCategoryIndex() < 0 && SongOptions.Selection.CategoryChangeAllowed) + if (CBase.Songs.GetCurrentCategoryIndex() < 0 && songOptions.Selection.CategoryChangeAllowed) { if (_Locked < CBase.Songs.GetNumCategories() - _NumW) { _Locked += _NumW; - UpdateList(); + _UpdateList(); } } - else if (_Locked < CBase.Songs.GetNumVisibleSongs() - _NumW && !SongOptions.Selection.RandomOnly) + else if (_Locked < CBase.Songs.GetNumVisibleSongs() - _NumW && !songOptions.Selection.RandomOnly) { _Locked += _NumW; - UpdateList(); + _UpdateList(); } break; } } - if (!KeyEvent.Handled) + if (!keyEvent.Handled) { _PreviewSelected = _Locked; - _actualSelection = _Locked; + _ActualSelection = _Locked; for (int i = 0; i < _Tiles.Count; i++) _Tiles[i].Selected = _Locked == i + _Offset; @@ -299,21 +299,21 @@ namespace VocaluxeLib.Menu.SongMenu } } - public override void HandleMouse(ref MouseEvent MouseEvent, ScreenSongOptions SongOptions) + public override void HandleMouse(ref SMouseEvent mouseEvent, SScreenSongOptions songOptions) { - base.HandleMouse(ref MouseEvent, SongOptions); + base.HandleMouse(ref mouseEvent, songOptions); int i = 0; bool sel = false; - int lastselection = _actualSelection; + int lastselection = _ActualSelection; - if (!SongOptions.Selection.RandomOnly || CBase.Songs.GetCurrentCategoryIndex() < 0 && SongOptions.Selection.CategoryChangeAllowed) + if (!songOptions.Selection.RandomOnly || CBase.Songs.GetCurrentCategoryIndex() < 0 && songOptions.Selection.CategoryChangeAllowed) { foreach (CStatic tile in _Tiles) { - if ((tile.Texture.index != _CoverTexture.index) && CHelper.IsInBounds(tile.Rect, MouseEvent) && !sel) + if ((tile.Texture.Index != _CoverTexture.Index) && CHelper.IsInBounds(tile.Rect, mouseEvent) && !sel) { - if (MouseEvent.LB || CBase.Songs.GetCurrentCategoryIndex() == -1) + if (mouseEvent.LB || CBase.Songs.GetCurrentCategoryIndex() == -1) { if (_PreviewSelected == i + _Offset) _Locked = _PreviewSelected; @@ -324,7 +324,7 @@ namespace VocaluxeLib.Menu.SongMenu } } tile.Selected = true; - _actualSelection = i + _Offset; + _ActualSelection = i + _Offset; sel = true; } else @@ -335,42 +335,42 @@ namespace VocaluxeLib.Menu.SongMenu else sel = true; - if (MouseEvent.Sender == ESender.WiiMote && _actualSelection != lastselection && _actualSelection != -1) + if (mouseEvent.Sender == ESender.WiiMote && _ActualSelection != lastselection && _ActualSelection != -1) CBase.Input.SetRumble(0.050f); if (!sel) - _actualSelection = -1; + _ActualSelection = -1; - if (MouseEvent.RB && (CBase.Songs.GetNumCategories() > 0) && CBase.Songs.GetCurrentCategoryIndex() >= 0 && CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_ON && - SongOptions.Selection.CategoryChangeAllowed) + if (mouseEvent.RB && (CBase.Songs.GetNumCategories() > 0) && CBase.Songs.GetCurrentCategoryIndex() >= 0 && CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_ON && + songOptions.Selection.CategoryChangeAllowed) { - ShowCategories(); - MouseEvent.Handled = true; + _ShowCategories(); + mouseEvent.Handled = true; return; } - else if (MouseEvent.RB && CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_OFF && !SongOptions.Selection.PartyMode) + else if (mouseEvent.RB && CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_OFF && !songOptions.Selection.PartyMode) CBase.Graphics.FadeTo(EScreens.ScreenMain); - else if (_PreviewSelected != -1 && MouseEvent.LB && CBase.Songs.GetCurrentCategoryIndex() != -1 && !SongOptions.Selection.PartyMode) + else if (_PreviewSelected != -1 && mouseEvent.LB && CBase.Songs.GetCurrentCategoryIndex() != -1 && !songOptions.Selection.PartyMode) { - if (CHelper.IsInBounds(_CoverBig.Rect, MouseEvent) || CHelper.IsInBounds(_TextBG.Rect, MouseEvent)) + if (CHelper.IsInBounds(_CoverBig.Rect, mouseEvent) || CHelper.IsInBounds(_TextBG.Rect, mouseEvent)) _Locked = _PreviewSelected; } - else if (MouseEvent.LB && (CBase.Songs.GetCurrentCategoryIndex() == -1)) + else if (mouseEvent.LB && (CBase.Songs.GetCurrentCategoryIndex() == -1)) { foreach (CStatic tile in _Tiles) { - if ((tile.Texture.index != _CoverTexture.index) && CHelper.IsInBounds(tile.Rect, MouseEvent)) + if ((tile.Texture.Index != _CoverTexture.Index) && CHelper.IsInBounds(tile.Rect, mouseEvent)) { - EnterCategory(_PreviewSelected); - MouseEvent.Handled = true; + _EnterCategory(_PreviewSelected); + mouseEvent.Handled = true; return; } } } - if (MouseEvent.Wheel != 0 && CHelper.IsInBounds(_ScrollRect, MouseEvent) && - (!SongOptions.Selection.RandomOnly || CBase.Songs.GetCurrentCategoryIndex() < 0 && SongOptions.Selection.CategoryChangeAllowed)) - UpdateList(_Offset + _NumW * MouseEvent.Wheel); + if (mouseEvent.Wheel != 0 && CHelper.IsInBounds(_ScrollRect, mouseEvent) && + (!songOptions.Selection.RandomOnly || CBase.Songs.GetCurrentCategoryIndex() < 0 && songOptions.Selection.CategoryChangeAllowed)) + _UpdateList(_Offset + _NumW * mouseEvent.Wheel); } public override void Draw() @@ -381,7 +381,7 @@ namespace VocaluxeLib.Menu.SongMenu tile.Draw(1.2f, tile.Rect.Z - 0.1f, EAspect.Crop, false); else { - if (tile.Texture.index != _CoverTexture.index) + if (tile.Texture.Index != _CoverTexture.Index) tile.Draw(1f, tile.Rect.Z, EAspect.Crop, false); else tile.Draw(1f, tile.Rect.Z, EAspect.Stretch, false); @@ -403,13 +403,13 @@ namespace VocaluxeLib.Menu.SongMenu _MedleyCalcIcon.Visible = song.Medley.Source == EMedleySource.Calculated; _MedleyTagIcon.Visible = song.Medley.Source == EMedleySource.Tag; - float Time = CBase.Sound.GetLength(_SongStream); + float time = CBase.Sound.GetLength(_SongStream); if (song.Finish != 0) - Time = song.Finish; + time = song.Finish; - Time -= song.Start; - int min = (int)Math.Floor(Time / 60f); - int sec = (int)(Time - min * 60f); + time -= song.Start; + int min = (int)Math.Floor(time / 60f); + int sec = (int)(time - min * 60f); _SongLength.Text = min.ToString("00") + ":" + sec.ToString("00"); } } @@ -438,18 +438,18 @@ namespace VocaluxeLib.Menu.SongMenu _TextBG.Draw(); - if (_vidtex.index != -1 && _Video != -1) + if (_Vidtex.Index != -1 && _Video != -1) { - if (_vidtex.color.A < 1) + if (_Vidtex.Color.A < 1) _CoverBig.Draw(1f, EAspect.Crop); RectangleF bounds = new RectangleF(_CoverBig.Rect.X, _CoverBig.Rect.Y, _CoverBig.Rect.W, _CoverBig.Rect.H); - RectangleF rect = new RectangleF(0f, 0f, _vidtex.width, _vidtex.height); + RectangleF rect = new RectangleF(0f, 0f, _Vidtex.Width, _Vidtex.Height); CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, EAspect.Crop); SRectF vidRect = new SRectF(rect.X, rect.Y, rect.Width, rect.Height, _CoverBig.Rect.Z); SRectF vidRectBounds = new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f); - CBase.Drawing.DrawTexture(_vidtex, vidRect, _vidtex.color, vidRectBounds, false); - CBase.Drawing.DrawTextureReflection(_vidtex, vidRect, _vidtex.color, vidRectBounds, _CoverBig.ReflectionSpace, _CoverBig.ReflectionHeight); + CBase.Drawing.DrawTexture(_Vidtex, vidRect, _Vidtex.Color, vidRectBounds, false); + CBase.Drawing.DrawTextureReflection(_Vidtex, vidRect, _Vidtex.Color, vidRectBounds, _CoverBig.ReflectionSpace, _CoverBig.ReflectionHeight); } else _CoverBig.Draw(1f, EAspect.Crop); @@ -479,7 +479,7 @@ namespace VocaluxeLib.Menu.SongMenu return new CStatic(_PartyModeID); } - protected void SetSelectedTile(int itemNr) + protected void _SetSelectedTile(int itemNr) { bool sel = false; foreach (CStatic tile in _Tiles) @@ -498,10 +498,10 @@ namespace VocaluxeLib.Menu.SongMenu else { _Locked = 0; - _actualSelection = 0; + _ActualSelection = 0; _PreviewSelected = 0; - SetSelectedNow(); - UpdateList(0, true); + _SetSelectedNow(); + _UpdateList(0, true); } } @@ -509,100 +509,100 @@ namespace VocaluxeLib.Menu.SongMenu tile.Selected = false; _PreviewSelected = itemNr; - SetSelectedNow(); + _SetSelectedNow(); _Locked = itemNr; - UpdateList(true); + _UpdateList(true); _PreviewSelected = _Locked; - _actualSelection = _Locked; + _ActualSelection = _Locked; if (_Locked - _Offset >= 0) _Tiles[_Locked - _Offset].Selected = true; } - public override void SetSelectedSong(int VisibleSongNr) + public override void SetSelectedSong(int visibleSongNr) { - base.SetSelectedSong(VisibleSongNr); + base.SetSelectedSong(visibleSongNr); - if (VisibleSongNr >= 0 && VisibleSongNr < CBase.Songs.GetNumVisibleSongs()) - SetSelectedTile(VisibleSongNr); + if (visibleSongNr >= 0 && visibleSongNr < CBase.Songs.GetNumVisibleSongs()) + _SetSelectedTile(visibleSongNr); } - public override void SetSelectedCategory(int CategoryNr) + public override void SetSelectedCategory(int categoryNr) { - base.SetSelectedCategory(CategoryNr); + base.SetSelectedCategory(categoryNr); - if (CategoryNr >= 0 && CategoryNr < CBase.Songs.GetNumCategories()) - SetSelectedTile(CategoryNr); + if (categoryNr >= 0 && categoryNr < CBase.Songs.GetNumCategories()) + _SetSelectedTile(categoryNr); } - protected override void EnterCategory(int cat) + protected override void _EnterCategory(int cat) { - base.EnterCategory(cat); + base._EnterCategory(cat); _PreviewSelected = 0; _Locked = -1; - _actualSelection = 0; - AfterCategoryChange(); + _ActualSelection = 0; + _AfterCategoryChange(); _Locked = 0; } - protected override void ShowCategories() + protected override void _ShowCategories() { - base.ShowCategories(); + base._ShowCategories(); _PreviewSelected = 0; _Locked = -1; - _actualSelection = 0; - AfterCategoryChange(); + _ActualSelection = 0; + _AfterCategoryChange(); _Locked = 0; } - private void NextCategory() + private void _NextCategory() { if (CBase.Songs.GetCurrentCategoryIndex() > -1) { CBase.Songs.NextCategory(); - EnterCategory(CBase.Songs.GetCurrentCategoryIndex()); + _EnterCategory(CBase.Songs.GetCurrentCategoryIndex()); } } - private void PrevCategory() + private void _PrevCategory() { if (CBase.Songs.GetCurrentCategoryIndex() > -1) { CBase.Songs.PrevCategory(); - EnterCategory(CBase.Songs.GetCurrentCategoryIndex()); + _EnterCategory(CBase.Songs.GetCurrentCategoryIndex()); } } - private void AfterCategoryChange() + private void _AfterCategoryChange() { - SetSelectedNow(); - SelectSong(_PreviewSelected); + _SetSelectedNow(); + _SelectSong(_PreviewSelected); foreach (CStatic tile in _Tiles) tile.Selected = false; - if (_actualSelection >= 0 && _actualSelection < _Tiles.Count) - _Tiles[_actualSelection].Selected = true; + if (_ActualSelection >= 0 && _ActualSelection < _Tiles.Count) + _Tiles[_ActualSelection].Selected = true; if ((_LastKnownNumSongs == CBase.Songs.GetNumVisibleSongs()) && (_LastKnownCategory == CBase.Songs.GetCurrentCategoryIndex())) return; _LastKnownCategory = CBase.Songs.GetCurrentCategoryIndex(); _LastKnownNumSongs = CBase.Songs.GetNumVisibleSongs(); - UpdateList(0, true); + _UpdateList(0, true); CBase.Songs.UpdateRandomSongList(); } - private void UpdateList(bool force = false) + private void _UpdateList(bool force = false) { - UpdateList((_Locked / _NumW) * _NumW - (_NumW * (_NumH - 2)), force); + _UpdateList((_Locked / _NumW) * _NumW - (_NumW * (_NumH - 2)), force); } - private void UpdateList(int offset, bool force = false) + private void _UpdateList(int offset, bool force = false) { bool isInCategory = CBase.Songs.GetCurrentCategoryIndex() >= 0; int itemCount = isInCategory ? CBase.Songs.GetNumVisibleSongs() : CBase.Songs.GetNumCategories(); @@ -635,23 +635,23 @@ namespace VocaluxeLib.Menu.SongMenu _Offset = offset; } - public override void SetSmallView(bool SmallView) + public override void SetSmallView(bool smallView) { - base.SetSmallView(SmallView); + base.SetSmallView(smallView); - _SmallView = SmallView; + _SmallView = smallView; if (_SmallView) { - _NumH = _Theme.songMenuTileBoard.numHsmall; - _NumW = _Theme.songMenuTileBoard.numWsmall; - _Rect = _Theme.songMenuTileBoard.TileRectSmall; + _NumH = _Theme.SongMenuTileBoard.NumHsmall; + _NumW = _Theme.SongMenuTileBoard.NumWsmall; + _Rect = _Theme.SongMenuTileBoard.TileRectSmall; } else { - _NumH = _Theme.songMenuTileBoard.numH; - _NumW = _Theme.songMenuTileBoard.numW; - _Rect = _Theme.songMenuTileBoard.TileRect; + _NumH = _Theme.SongMenuTileBoard.NumH; + _NumW = _Theme.SongMenuTileBoard.NumW; + _Rect = _Theme.SongMenuTileBoard.TileRect; } _TileW = (int)((_Rect.W - _SpaceW * (_NumW - 1)) / _NumW); @@ -672,7 +672,7 @@ namespace VocaluxeLib.Menu.SongMenu } _ScrollRect = new SRectF(0, 0, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH(), _Rect.Z); - UpdateList(true); + _UpdateList(true); } public override bool IsSmallView() @@ -684,16 +684,16 @@ namespace VocaluxeLib.Menu.SongMenu { base.LoadTextures(); - _Theme.songMenuTileBoard.StaticCoverBig.ReloadTextures(); - _Theme.songMenuTileBoard.StaticTextBG.ReloadTextures(); - _Theme.songMenuTileBoard.StaticDuetIcon.ReloadTextures(); - _Theme.songMenuTileBoard.StaticVideoIcon.ReloadTextures(); - _Theme.songMenuTileBoard.StaticMedleyCalcIcon.ReloadTextures(); - _Theme.songMenuTileBoard.StaticMedleyTagIcon.ReloadTextures(); + _Theme.SongMenuTileBoard.StaticCoverBig.ReloadTextures(); + _Theme.SongMenuTileBoard.StaticTextBG.ReloadTextures(); + _Theme.SongMenuTileBoard.StaticDuetIcon.ReloadTextures(); + _Theme.SongMenuTileBoard.StaticVideoIcon.ReloadTextures(); + _Theme.SongMenuTileBoard.StaticMedleyCalcIcon.ReloadTextures(); + _Theme.SongMenuTileBoard.StaticMedleyTagIcon.ReloadTextures(); - _Theme.songMenuTileBoard.TextArtist.ReloadTextures(); - _Theme.songMenuTileBoard.TextTitle.ReloadTextures(); - _Theme.songMenuTileBoard.TextSongLength.ReloadTextures(); + _Theme.SongMenuTileBoard.TextArtist.ReloadTextures(); + _Theme.SongMenuTileBoard.TextTitle.ReloadTextures(); + _Theme.SongMenuTileBoard.TextSongLength.ReloadTextures(); } } } \ No newline at end of file diff --git a/VocaluxeLib/Menu/SongMenu/ISongMenu.cs b/VocaluxeLib/Menu/SongMenu/ISongMenu.cs index a08a24e0..c24c8d51 100644 --- a/VocaluxeLib/Menu/SongMenu/ISongMenu.cs +++ b/VocaluxeLib/Menu/SongMenu/ISongMenu.cs @@ -4,37 +4,37 @@ namespace VocaluxeLib.Menu.SongMenu { interface ISongMenu : IMenuElement { - void Update(ScreenSongOptions SongOptions); + void Update(SScreenSongOptions songOptions); void OnShow(); void OnHide(); - void HandleInput(ref KeyEvent KeyEvent, ScreenSongOptions SongOptions); - void HandleMouse(ref MouseEvent MouseEvent, ScreenSongOptions SongOptions); + void HandleInput(ref SKeyEvent keyEvent, SScreenSongOptions songOptions); + void HandleMouse(ref SMouseEvent mouseEvent, SScreenSongOptions songOptions); void Draw(); - void ApplyVolume(float VolumeMax); + void ApplyVolume(float volumeMax); int GetSelectedSong(); CStatic GetSelectedSongCover(); - void SetSelectedSong(int VisibleSongNr); + void SetSelectedSong(int visibleSongNr); bool IsActive(); - void SetActive(bool Active); + void SetActive(bool active); int GetSelectedCategory(); - void SetSelectedCategory(int CategoryNr); + void SetSelectedCategory(int categoryNr); int GetActualSelection(); bool EnterCurrentCategory(); bool IsSelected(); - void SetSelected(bool Selected); + void SetSelected(bool selected); bool IsVisible(); - void SetVisible(bool Visible); + void SetVisible(bool visible); bool IsSmallView(); - void SetSmallView(bool SmallView); + void SetSmallView(bool smallView); SRectF GetRect(); } diff --git a/VocaluxeLib/Menu/Structs.cs b/VocaluxeLib/Menu/Structs.cs index 41938220..fc792831 100644 --- a/VocaluxeLib/Menu/Structs.cs +++ b/VocaluxeLib/Menu/Structs.cs @@ -22,12 +22,12 @@ namespace VocaluxeLib.Menu A = a; } - public SColorF(SColorF Color) + public SColorF(SColorF color) { - R = Color.R; - G = Color.G; - B = Color.B; - A = Color.A; + R = color.R; + G = color.G; + B = color.B; + A = color.A; } } @@ -61,7 +61,7 @@ namespace VocaluxeLib.Menu } } - public struct SPoint3f + public struct SPoint3F { public float X; public float Y; @@ -77,63 +77,63 @@ namespace VocaluxeLib.Menu public struct STexture { - public int index; + public int Index; public int PBO; public int ID; public string TexturePath; - public float width; - public float height; - public SRectF rect; + public float Width; + public float Height; + public SRectF Rect; - public float w2; //power of 2 width - public float h2; //power of 2 height - public float width_ratio; - public float height_ratio; + public float W2; //power of 2 width + public float H2; //power of 2 height + public float WidthRatio; + public float HeightRatio; - public SColorF color; + public SColorF Color; - public STexture(int Index) + public STexture(int index) { - index = Index; + Index = index; PBO = 0; ID = -1; TexturePath = String.Empty; - width = 1f; - height = 1f; - rect = new SRectF(0f, 0f, 1f, 1f, 0f); + Width = 1f; + Height = 1f; + Rect = new SRectF(0f, 0f, 1f, 1f, 0f); - w2 = 2f; - h2 = 2f; - width_ratio = 0.5f; - height_ratio = 0.5f; + W2 = 2f; + H2 = 2f; + WidthRatio = 0.5f; + HeightRatio = 0.5f; - color = new SColorF(1f, 1f, 1f, 1f); + Color = new SColorF(1f, 1f, 1f, 1f); } } #endregion Drawing #region Inputs - public struct KeyEvent + public struct SKeyEvent { public ESender Sender; - public bool ModALT; - public bool ModSHIFT; - public bool ModCTRL; + public bool ModAlt; + public bool ModShift; + public bool ModCtrl; public bool KeyPressed; public bool Handled; public Keys Key; public Char Unicode; public EModifier Mod; - public KeyEvent(ESender sender, bool alt, bool shift, bool ctrl, bool pressed, char unicode, Keys key) + public SKeyEvent(ESender sender, bool alt, bool shift, bool ctrl, bool pressed, char unicode, Keys key) { Sender = sender; - ModALT = alt; - ModSHIFT = shift; - ModCTRL = ctrl; + ModAlt = alt; + ModShift = shift; + ModCtrl = ctrl; KeyPressed = pressed; Unicode = unicode; Key = key; @@ -150,7 +150,7 @@ namespace VocaluxeLib.Menu } } - public struct MouseEvent + public struct SMouseEvent { public ESender Sender; public bool Handled; @@ -165,14 +165,14 @@ namespace VocaluxeLib.Menu public bool RBH; //right button hold (when moving) public bool MBH; //middle button hold (when moving) - public bool ModALT; - public bool ModSHIFT; - public bool ModCTRL; + public bool ModAlt; + public bool ModShift; + public bool ModCtrl; public EModifier Mod; public int Wheel; - public MouseEvent(ESender sender, bool alt, bool shift, bool ctrl, int x, int y, bool lb, bool ld, bool rb, int wheel, bool lbh, bool rbh, bool mb, bool mbh) + public SMouseEvent(ESender sender, bool alt, bool shift, bool ctrl, int x, int y, bool lb, bool ld, bool rb, int wheel, bool lbh, bool rbh, bool mb, bool mbh) { Sender = sender; Handled = false; @@ -187,27 +187,27 @@ namespace VocaluxeLib.Menu RBH = rbh; MBH = mbh; - ModALT = alt; - ModSHIFT = shift; - ModCTRL = ctrl; + ModAlt = alt; + ModShift = shift; + ModCtrl = ctrl; - EModifier mALT = EModifier.None; - EModifier mSHIFT = EModifier.None; - EModifier mCTRL = EModifier.None; + EModifier mAlt = EModifier.None; + EModifier mShift = EModifier.None; + EModifier mCtrl = EModifier.None; if (alt) - mALT = EModifier.Alt; + mAlt = EModifier.Alt; if (shift) - mSHIFT = EModifier.Shift; + mShift = EModifier.Shift; if (ctrl) - mCTRL = EModifier.Ctrl; + mCtrl = EModifier.Ctrl; if (!alt && !shift && !ctrl) Mod = EModifier.None; else - Mod = mALT | mSHIFT | mCTRL; + Mod = mAlt | mShift | mCtrl; Wheel = wheel; } diff --git a/VocaluxeLib/PartyModes/CPartyMode.cs b/VocaluxeLib/PartyModes/CPartyMode.cs index e8da0e3e..32c425f9 100644 --- a/VocaluxeLib/PartyModes/CPartyMode.cs +++ b/VocaluxeLib/PartyModes/CPartyMode.cs @@ -6,7 +6,7 @@ namespace VocaluxeLib.PartyModes { public abstract class CPartyMode : IPartyMode { - protected ScreenSongOptions _ScreenSongOptions; + protected SScreenSongOptions _ScreenSongOptions; protected Dictionary _Screens; protected string _Folder; @@ -14,9 +14,9 @@ namespace VocaluxeLib.PartyModes { _Screens = new Dictionary(); _Folder = String.Empty; - _ScreenSongOptions = new ScreenSongOptions(); - _ScreenSongOptions.Selection = new SelectionOptions(); - _ScreenSongOptions.Sorting = new SortingOptions(); + _ScreenSongOptions = new SScreenSongOptions(); + _ScreenSongOptions.Selection = new SSelectionOptions(); + _ScreenSongOptions.Sorting = new SSortingOptions(); } #region Implementation @@ -27,18 +27,18 @@ namespace VocaluxeLib.PartyModes public void Initialize() {} - public void AddScreen(CMenuParty Screen, string ScreenName) + public void AddScreen(CMenuParty screen, string screenName) { - _Screens.Add(ScreenName, Screen); + _Screens.Add(screenName, screen); } - public virtual void DataFromScreen(string ScreenName, Object Data) {} + public virtual void DataFromScreen(string screenName, Object data) {} public virtual void UpdateGame() {} - public virtual CMenuParty GetNextPartyScreen(out EScreens AlternativeScreen) + public virtual CMenuParty GetNextPartyScreen(out EScreens alternativeScreen) { - AlternativeScreen = EScreens.ScreenMain; + alternativeScreen = EScreens.ScreenMain; return null; } @@ -52,14 +52,14 @@ namespace VocaluxeLib.PartyModes return EScreens.ScreenSong; } - public virtual ScreenSongOptions GetScreenSongOptions() + public virtual SScreenSongOptions GetScreenSongOptions() { - return new ScreenSongOptions(); + return new SScreenSongOptions(); } - public virtual void OnSongChange(int SongIndex, ref ScreenSongOptions ScreenSongOptions) {} + public virtual void OnSongChange(int songIndex, ref SScreenSongOptions screenSongOptions) {} - public virtual void OnCategoryChange(int CategoryIndex, ref ScreenSongOptions ScreenSongOptions) {} + public virtual void OnCategoryChange(int categoryIndex, ref SScreenSongOptions screenSongOptions) {} public virtual int GetMaxPlayer() { @@ -86,21 +86,21 @@ namespace VocaluxeLib.PartyModes return 1; } - public virtual void SetSearchString(string SearchString, bool Visible) {} + public virtual void SetSearchString(string searchString, bool visible) {} - public virtual void JokerUsed(int TeamNr) + public virtual void JokerUsed(int teamNr) { if (_ScreenSongOptions.Selection.NumJokers == null) return; - if (_ScreenSongOptions.Selection.NumJokers.Length < TeamNr) + if (_ScreenSongOptions.Selection.NumJokers.Length < teamNr) return; - if (_ScreenSongOptions.Selection.NumJokers[TeamNr] > 0) - _ScreenSongOptions.Selection.NumJokers[TeamNr]--; + if (_ScreenSongOptions.Selection.NumJokers[teamNr] > 0) + _ScreenSongOptions.Selection.NumJokers[teamNr]--; } - public virtual void SongSelected(int SongID) {} + public virtual void SongSelected(int songID) {} public virtual void FinishedSinging() { diff --git a/VocaluxeLib/PartyModes/CPartyModeNone.cs b/VocaluxeLib/PartyModes/CPartyModeNone.cs index 50f4003d..00422ab8 100644 --- a/VocaluxeLib/PartyModes/CPartyModeNone.cs +++ b/VocaluxeLib/PartyModes/CPartyModeNone.cs @@ -20,7 +20,7 @@ namespace VocaluxeLib.PartyModes _ScreenSongOptions.Sorting.DuetOptions = EDuetOptions.All; } - public override ScreenSongOptions GetScreenSongOptions() + public override SScreenSongOptions GetScreenSongOptions() { _ScreenSongOptions.Sorting.SongSorting = CBase.Config.GetSongSorting(); _ScreenSongOptions.Sorting.Tabs = CBase.Config.GetTabs(); @@ -33,10 +33,10 @@ namespace VocaluxeLib.PartyModes return _ScreenSongOptions; } - public override void SetSearchString(string SearchString, bool Visible) + public override void SetSearchString(string searchString, bool visible) { - _ScreenSongOptions.Sorting.SearchString = SearchString; - _ScreenSongOptions.Sorting.SearchActive = Visible; + _ScreenSongOptions.Sorting.SearchString = searchString; + _ScreenSongOptions.Sorting.SearchActive = visible; } } } \ No newline at end of file diff --git a/VocaluxeLib/PartyModes/CScreenPartyDummy.cs b/VocaluxeLib/PartyModes/CScreenPartyDummy.cs index 042991d2..b67deb71 100644 --- a/VocaluxeLib/PartyModes/CScreenPartyDummy.cs +++ b/VocaluxeLib/PartyModes/CScreenPartyDummy.cs @@ -10,23 +10,23 @@ namespace VocaluxeLib.PartyModes { get { return 1; } } - private CText Warning; + private CText _Warning; - public override void LoadTheme(string XmlPath) + public override void LoadTheme(string xmlPath) { - Warning = GetNewText(); - Warning.Height = 100f; - Warning.X = 150; - Warning.Y = 300; - Warning.Font = "Normal"; - Warning.Style = EStyle.Normal; - Warning.Color = new SColorF(1f, 0f, 0f, 1f); - Warning.SelColor = new SColorF(1f, 0f, 0f, 1f); - Warning.Text = "SOMETHING WENT WRONG!"; - AddText(Warning); + _Warning = GetNewText(); + _Warning.Height = 100f; + _Warning.X = 150; + _Warning.Y = 300; + _Warning.Font = "Normal"; + _Warning.Style = EStyle.Normal; + _Warning.Color = new SColorF(1f, 0f, 0f, 1f); + _Warning.SelColor = new SColorF(1f, 0f, 0f, 1f); + _Warning.Text = "SOMETHING WENT WRONG!"; + AddText(_Warning); } - public override void ReloadTheme(string XmlPath) {} + public override void ReloadTheme(string xmlPath) {} public override void ReloadTextures() {} @@ -34,7 +34,7 @@ namespace VocaluxeLib.PartyModes public override void UnloadTextures() {} - public override bool HandleInput(KeyEvent keyEvent) + public override bool HandleInput(SKeyEvent keyEvent) { base.HandleInput(keyEvent); @@ -45,21 +45,21 @@ namespace VocaluxeLib.PartyModes { case Keys.Back: case Keys.Escape: - FadeTo(EScreens.ScreenParty); + _FadeTo(EScreens.ScreenParty); break; } } return true; } - public override bool HandleMouse(MouseEvent mouseEvent) + public override bool HandleMouse(SMouseEvent mouseEvent) { base.HandleMouse(mouseEvent); if (mouseEvent.LB && IsMouseOver(mouseEvent)) {} if (mouseEvent.RB) - FadeTo(EScreens.ScreenParty); + _FadeTo(EScreens.ScreenParty); return true; } diff --git a/VocaluxeLib/PartyModes/IPartyMode.cs b/VocaluxeLib/PartyModes/IPartyMode.cs index faa03c8b..5d2fa8bb 100644 --- a/VocaluxeLib/PartyModes/IPartyMode.cs +++ b/VocaluxeLib/PartyModes/IPartyMode.cs @@ -5,13 +5,13 @@ namespace VocaluxeLib.PartyModes { #region Structs - public struct ScreenSongOptions + public struct SScreenSongOptions { - public SortingOptions Sorting; - public SelectionOptions Selection; + public SSortingOptions Sorting; + public SSelectionOptions Selection; } - public struct SortingOptions + public struct SSortingOptions { public ESongSorting SongSorting; public EOffOn Tabs; @@ -24,7 +24,7 @@ namespace VocaluxeLib.PartyModes /// /// Configuration of song selection options /// - public struct SelectionOptions + public struct SSelectionOptions { /// /// If != -1, the SongMenu should set the song selection on the provided song index (visible index) if possible @@ -67,18 +67,18 @@ namespace VocaluxeLib.PartyModes { bool Init(); void Initialize(); - void AddScreen(CMenuParty Screen, string ScreenName); - void DataFromScreen(string ScreenName, Object Data); + void AddScreen(CMenuParty screen, string screenName); + void DataFromScreen(string screenName, Object data); void UpdateGame(); - CMenuParty GetNextPartyScreen(out EScreens AlternativeScreen); + CMenuParty GetNextPartyScreen(out EScreens alternativeScreen); EScreens GetStartScreen(); EScreens GetMainScreen(); - ScreenSongOptions GetScreenSongOptions(); + SScreenSongOptions GetScreenSongOptions(); - void OnSongChange(int SongIndex, ref ScreenSongOptions ScreenSongOptions); - void OnCategoryChange(int CategoryIndex, ref ScreenSongOptions ScreenSongOptions); + void OnSongChange(int songIndex, ref SScreenSongOptions screenSongOptions); + void OnCategoryChange(int categoryIndex, ref SScreenSongOptions screenSongOptions); int GetMaxPlayer(); int GetMinPlayer(); @@ -86,10 +86,10 @@ namespace VocaluxeLib.PartyModes int GetMinTeams(); int GetMaxNumRounds(); - void SetSearchString(string SearchString, bool Visible); + void SetSearchString(string searchString, bool visible); - void JokerUsed(int TeamNr); - void SongSelected(int SongID); + void JokerUsed(int teamNr); + void SongSelected(int songID); void FinishedSinging(); void LeavingScore(); void LeavingHighscore();