More refactoring (mainly LINQ)
This commit is contained in:
1 parent
181490fa87
commit
b1e28ae7bc
43 files changed
+488
-662
No files matched your search
@@ -452,7 +452,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
|
||||
public override void SongSelected(int songID)
|
||||
{
|
||||
EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL;
|
||||
const EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL;
|
||||
|
||||
CBase.Game.Reset();
|
||||
CBase.Game.ClearSongs();
|
||||
|
||||
@@ -93,7 +93,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
private SRectF _PlayerTableScrollArea;
|
||||
private int _RoundsTableOffset;
|
||||
private int _PlayerTableOffset;
|
||||
private int _NumPlayerVisible = 10;
|
||||
private const int _NumPlayerVisible = 10;
|
||||
private int _NumRoundsVisible = 3;
|
||||
|
||||
public CPartyScreenChallengeMain()
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
{
|
||||
@@ -27,7 +28,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
private readonly Random _Rand;
|
||||
private readonly int _NumPlayer;
|
||||
|
||||
public List<CCombination> Rounds;
|
||||
public readonly List<CCombination> Rounds;
|
||||
|
||||
public CChallengeRounds(int numRounds, int numPlayer, int numPlayerAtOnce)
|
||||
{
|
||||
@@ -72,12 +73,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
numPlayed[playerIndex]++;
|
||||
}
|
||||
|
||||
int max = 0;
|
||||
foreach (int p in numPlayed)
|
||||
{
|
||||
if (p > max)
|
||||
max = p;
|
||||
}
|
||||
int max = numPlayed.Max();
|
||||
|
||||
int num = Rounds[0].Player.Count;
|
||||
List<int> result = new List<int>();
|
||||
@@ -162,28 +158,19 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
List<CCombination> combsFiltered = new List<CCombination>();
|
||||
if (playerNrDemand != null)
|
||||
{
|
||||
for (int i = 0; i < _Combs.Count; i++)
|
||||
{
|
||||
if (_Combs[i].IsAvailableAll(playerNrDemand))
|
||||
combsFiltered.Add(_Combs[i]);
|
||||
}
|
||||
combsFiltered.AddRange(_Combs.Where(t => t.IsAvailableAll(playerNrDemand)));
|
||||
}
|
||||
|
||||
//1st fallback
|
||||
if (playerNrDemand != null && combsFiltered.Count == 0)
|
||||
{
|
||||
for (int i = 0; i < _Combs.Count; i++)
|
||||
{
|
||||
if (_Combs[i].IsAvailableSomeone(playerNrDemand))
|
||||
combsFiltered.Add(_Combs[i]);
|
||||
}
|
||||
combsFiltered.AddRange(_Combs.Where(t => t.IsAvailableSomeone(playerNrDemand)));
|
||||
}
|
||||
|
||||
//2nd fallback
|
||||
if (combsFiltered.Count == 0)
|
||||
{
|
||||
for (int i = 0; i < _Combs.Count; i++)
|
||||
combsFiltered.Add(_Combs[i]);
|
||||
combsFiltered.AddRange(_Combs);
|
||||
}
|
||||
|
||||
int num = combsFiltered.Count;
|
||||
@@ -220,7 +207,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
|
||||
public class CCombination
|
||||
{
|
||||
public List<int> Player;
|
||||
public readonly List<int> Player;
|
||||
|
||||
public CCombination()
|
||||
{
|
||||
@@ -229,28 +216,17 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
|
||||
public bool IsAvailable(int playerIndex)
|
||||
{
|
||||
foreach (int p in Player)
|
||||
{
|
||||
if (p == playerIndex)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return Player.Any(p => p == playerIndex);
|
||||
}
|
||||
|
||||
public bool IsAvailableAll(IEnumerable<int> playerIndices)
|
||||
{
|
||||
bool result = true;
|
||||
foreach (int p in playerIndices)
|
||||
result &= IsAvailable(p);
|
||||
return result;
|
||||
return playerIndices.All(IsAvailable);
|
||||
}
|
||||
|
||||
public bool IsAvailableSomeone(IEnumerable<int> playerIndices)
|
||||
{
|
||||
bool result = false;
|
||||
foreach (int p in playerIndices)
|
||||
result |= IsAvailable(p);
|
||||
return result;
|
||||
return playerIndices.Any(IsAvailable);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -59,7 +59,6 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
public int Position;
|
||||
public int PlayerID;
|
||||
public int NumPlayed;
|
||||
public int NumRounds;
|
||||
public int NumWon;
|
||||
public int NumSingPoints;
|
||||
public int NumGamePoints;
|
||||
@@ -102,7 +101,6 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
public struct SFromScreenNames
|
||||
{
|
||||
public bool FadeToConfig;
|
||||
public bool FadeToMain;
|
||||
public List<int> ProfileIDs;
|
||||
}
|
||||
|
||||
@@ -518,8 +516,8 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
if (CBase.Songs.GetNumVisibleSongs() < _NumSongs)
|
||||
CBase.Songs.ResetPartySongSung();
|
||||
|
||||
EGameMode gm = EGameMode.TR_GAMEMODE_MEDLEY;
|
||||
List<int> iDs = new List<int>();
|
||||
const EGameMode gm = EGameMode.TR_GAMEMODE_MEDLEY;
|
||||
List<int> ids = new List<int>();
|
||||
|
||||
CSong[] visSongs = CBase.Songs.GetSongsNotSung();
|
||||
if (visSongs == null)
|
||||
@@ -534,11 +532,11 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
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("CPartyChallengeMedleyMode Error: There are no medley songs!");
|
||||
CBase.Graphics.FadeTo(EScreens.ScreenParty);
|
||||
@@ -546,12 +544,12 @@ 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)];
|
||||
int songID = ids[CBase.Game.GetRandom(ids.Count)];
|
||||
CBase.Game.AddSong(songID, gm);
|
||||
CBase.Songs.AddPartySongSung(songID);
|
||||
iDs.Remove(songID);
|
||||
ids.Remove(songID);
|
||||
s++;
|
||||
}
|
||||
return true;
|
||||
@@ -630,7 +628,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
{
|
||||
for (int i = 0; i < _GameData.NumPlayer; i++)
|
||||
{
|
||||
CResultTableRow row = new CResultTableRow {PlayerID = _GameData.ProfileIDs[i], NumPlayed = 0, NumRounds = 0, NumWon = 0, NumSingPoints = 0, NumGamePoints = 0};
|
||||
CResultTableRow row = new CResultTableRow {PlayerID = _GameData.ProfileIDs[i], NumPlayed = 0, NumWon = 0, NumSingPoints = 0, NumGamePoints = 0};
|
||||
_GameData.ResultTable.Add(row);
|
||||
}
|
||||
|
||||
@@ -690,7 +688,6 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
|
||||
row.NumPlayed++;
|
||||
row.NumWon += points[i].Won;
|
||||
row.NumRounds += 1;
|
||||
row.NumSingPoints += points[i].SingPoints;
|
||||
row.NumGamePoints += points[i].GamePoints;
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
private SRectF _PlayerTableScrollArea;
|
||||
private int _RoundsTableOffset;
|
||||
private int _PlayerTableOffset;
|
||||
private int _NumPlayerVisible = 10;
|
||||
private const int _NumPlayerVisible = 10;
|
||||
private int _NumRoundsVisible = 3;
|
||||
|
||||
public CPartyScreenChallengeMedleyMain()
|
||||
@@ -598,7 +598,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
|
||||
row.Pos.Text = _GameState.ResultTable[i + _PlayerTableOffset].Position + ".";
|
||||
row.Name.Text = profiles[_GameState.ResultTable[i + _PlayerTableOffset].PlayerID].PlayerName;
|
||||
row.Rounds.Text = _GameState.ResultTable[i + _PlayerTableOffset].NumRounds.ToString();
|
||||
row.Rounds.Text = _GameState.ResultTable[i + _PlayerTableOffset].NumPlayed.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();
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
private const int _PlayerChooseButtonsFirstY = 105;
|
||||
private const int _PlayerChooseButtonsSpaceH = 15;
|
||||
private const int _PlayerChooseButtonsSpaceW = 25;
|
||||
private int _PlayerChooseButtonsOffset = 0;
|
||||
private const int _PlayerChooseButtonsOffset = 0;
|
||||
|
||||
private CStatic _ChooseAvatarStatic;
|
||||
private bool _SelectingMouseActive;
|
||||
@@ -88,7 +88,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
_ThemeButtons = new string[] {_ButtonBack, _ButtonNext, _ButtonPlayerDestination, _ButtonPlayerChoose};
|
||||
|
||||
_Data = new SDataFromScreen();
|
||||
SFromScreenNames names = new SFromScreenNames {FadeToConfig = false, FadeToMain = false, ProfileIDs = new List<int>()};
|
||||
SFromScreenNames names = new SFromScreenNames {FadeToConfig = false, ProfileIDs = new List<int>()};
|
||||
_Data.ScreenNames = names;
|
||||
}
|
||||
|
||||
@@ -339,7 +339,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
|
||||
private void _UpdateButtonPlayerChoose(int offset)
|
||||
{
|
||||
int numButtonPlayerChoose = _PlayerChooseButtonsNumW * _PlayerChooseButtonsNumH;
|
||||
const int numButtonPlayerChoose = _PlayerChooseButtonsNumW * _PlayerChooseButtonsNumH;
|
||||
if (offset < 0)
|
||||
offset = 0;
|
||||
|
||||
@@ -501,14 +501,12 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
private void _Back()
|
||||
{
|
||||
_Data.ScreenNames.FadeToConfig = true;
|
||||
_Data.ScreenNames.FadeToMain = false;
|
||||
_PartyMode.DataFromScreen(ThemeName, _Data);
|
||||
}
|
||||
|
||||
private void _Next()
|
||||
{
|
||||
_Data.ScreenNames.FadeToConfig = false;
|
||||
_Data.ScreenNames.FadeToMain = true;
|
||||
_PartyMode.DataFromScreen(ThemeName, _Data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,8 +81,6 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
{
|
||||
public int CurrentRoundNr;
|
||||
public int Team;
|
||||
public int NumPlayerTeam1;
|
||||
public int NumPlayerTeam2;
|
||||
public int NumFields;
|
||||
public List<CRound> Rounds;
|
||||
public List<int> Songs;
|
||||
@@ -115,7 +113,6 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
public struct SFromScreenNames
|
||||
{
|
||||
public bool FadeToConfig;
|
||||
public bool FadeToMain;
|
||||
public List<int> ProfileIDsTeam1;
|
||||
public List<int> ProfileIDsTeam2;
|
||||
}
|
||||
@@ -380,8 +377,6 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
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;
|
||||
@@ -410,8 +405,6 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
_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;
|
||||
@@ -588,23 +581,23 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
case 1:
|
||||
{
|
||||
//Prepare Player-IDs
|
||||
List<int> iDs = new List<int>();
|
||||
List<int> ids = new List<int>();
|
||||
//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);
|
||||
ids.Add(i);
|
||||
}
|
||||
if (_GameData.PlayerTeam1.Count < _GameData.NumFields + _GameData.NumJokerRetry[0])
|
||||
{
|
||||
int random = CBase.Game.GetRandom((iDs.Count - 1) * 10);
|
||||
int random = CBase.Game.GetRandom((ids.Count - 1) * 10);
|
||||
int 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
private List<CField> _Fields;
|
||||
private float _FieldFirstX = 25;
|
||||
private float _FieldFirstY = 25;
|
||||
private int _FieldSpace = 10;
|
||||
private const int _FieldSpace = 10;
|
||||
private float _FieldSize = 100;
|
||||
|
||||
private int _PreviewStream = -1;
|
||||
|
||||
@@ -93,7 +93,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
_ThemeButtons = new string[] {_ButtonBack, _ButtonNext, _ButtonPlayerDestination, _ButtonPlayerChoose, _ButtonPlayerChooseScrollUp, _ButtonPlayerChooseScrollDown};
|
||||
|
||||
_Data = new SDataFromScreen();
|
||||
SFromScreenNames names = new SFromScreenNames {FadeToConfig = false, FadeToMain = false, ProfileIDsTeam1 = new List<int>(), ProfileIDsTeam2 = new List<int>()};
|
||||
SFromScreenNames names = new SFromScreenNames {FadeToConfig = false, ProfileIDsTeam1 = new List<int>(), ProfileIDsTeam2 = new List<int>()};
|
||||
_Data.ScreenNames = names;
|
||||
}
|
||||
|
||||
@@ -403,7 +403,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
|
||||
private void _UpdateButtonPlayerChoose(int offset)
|
||||
{
|
||||
int numButtonPlayerChoose = _PlayerChooseButtonsNumW * _PlayerChooseButtonsNumH;
|
||||
const int numButtonPlayerChoose = _PlayerChooseButtonsNumW * _PlayerChooseButtonsNumH;
|
||||
if (offset < 0)
|
||||
offset = 0;
|
||||
|
||||
@@ -446,27 +446,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
//Show profile only if active
|
||||
if (CBase.Profiles.GetProfiles()[i].Active == EOffOn.TR_CONFIG_ON)
|
||||
{
|
||||
visible = true;
|
||||
|
||||
for (int p = 0; p < _Data.ScreenNames.ProfileIDsTeam1.Count; p++)
|
||||
{
|
||||
//Don't show profile if is selected
|
||||
if (_Data.ScreenNames.ProfileIDsTeam1[p] == i)
|
||||
{
|
||||
visible = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (int p = 0; p < _Data.ScreenNames.ProfileIDsTeam2.Count; p++)
|
||||
{
|
||||
//Don't show profile if is selected
|
||||
if (_Data.ScreenNames.ProfileIDsTeam2[p] == i)
|
||||
{
|
||||
visible = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
visible = _Data.ScreenNames.ProfileIDsTeam1.All(t => t != i) && _Data.ScreenNames.ProfileIDsTeam2.All(t => t != i);
|
||||
}
|
||||
if (visible)
|
||||
_PlayerChooseButtonsVisibleProfiles.Add(i);
|
||||
@@ -642,14 +622,12 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
private void _Back()
|
||||
{
|
||||
_Data.ScreenNames.FadeToConfig = true;
|
||||
_Data.ScreenNames.FadeToMain = false;
|
||||
_PartyMode.DataFromScreen(ThemeName, _Data);
|
||||
}
|
||||
|
||||
private void _Next()
|
||||
{
|
||||
_Data.ScreenNames.FadeToConfig = false;
|
||||
_Data.ScreenNames.FadeToMain = true;
|
||||
_PartyMode.DataFromScreen(ThemeName, _Data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Vocaluxe.Base;
|
||||
using VocaluxeLib.Menu;
|
||||
using VocaluxeLib.Menu.SongMenu;
|
||||
@@ -477,12 +478,7 @@ namespace Vocaluxe.Base
|
||||
|
||||
private static bool _IsBackgroundFile(CPlaylistElement element)
|
||||
{
|
||||
foreach (CPlaylistElement elements in _BGMusicFileNames)
|
||||
{
|
||||
if (elements.MusicFilePath == element.MusicFilePath)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return _BGMusicFileNames.Any(elements => elements.MusicFilePath == element.MusicFilePath);
|
||||
}
|
||||
|
||||
private static void _LoadVideo()
|
||||
|
||||
@@ -283,26 +283,6 @@ namespace Vocaluxe.Base
|
||||
return _GetDataBaseSongID(song.Artist, song.Title, 0, command);
|
||||
}
|
||||
|
||||
private static int _GetDataBaseSongID(string artist, string title, string filePath, int defNumPlayed)
|
||||
{
|
||||
using (SQLiteConnection connection = new SQLiteConnection())
|
||||
{
|
||||
connection.ConnectionString = "Data Source=" + filePath;
|
||||
|
||||
try
|
||||
{
|
||||
connection.Open();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
using (SQLiteCommand command = new SQLiteCommand(connection))
|
||||
return _GetDataBaseSongID(artist, title, defNumPlayed, 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";
|
||||
|
||||
+6
-17
@@ -23,6 +23,7 @@ using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Text;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml;
|
||||
@@ -39,8 +40,7 @@ namespace Vocaluxe.Base
|
||||
}
|
||||
|
||||
public STexture Texture;
|
||||
public char Chr;
|
||||
public int Width;
|
||||
public readonly int Width;
|
||||
|
||||
public CGlyph(char chr, float maxHigh)
|
||||
{
|
||||
@@ -110,7 +110,6 @@ 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);
|
||||
g.Dispose();
|
||||
}
|
||||
@@ -158,7 +157,7 @@ namespace Vocaluxe.Base
|
||||
private FontFamily _Family;
|
||||
private readonly float _Sizeh;
|
||||
|
||||
public string FilePath;
|
||||
public readonly string FilePath;
|
||||
|
||||
public CFont(string file)
|
||||
{
|
||||
@@ -550,25 +549,15 @@ namespace Vocaluxe.Base
|
||||
|
||||
public static float GetTextWidth(string text)
|
||||
{
|
||||
float dx = 0;
|
||||
CFont font = _GetCurrentFont();
|
||||
foreach (char chr in text)
|
||||
dx += font.GetWidth(chr);
|
||||
return dx;
|
||||
return text.Sum(chr => font.GetWidth(chr));
|
||||
}
|
||||
|
||||
public static float GetTextHeight(string text)
|
||||
{
|
||||
//return TextRenderer.MeasureText(text, GetFont()).Height;
|
||||
float h = 0f;
|
||||
CFont font = _GetCurrentFont();
|
||||
foreach (char chr in text)
|
||||
{
|
||||
float hh = font.GetHeight(chr);
|
||||
if (hh > h)
|
||||
h = hh;
|
||||
}
|
||||
return h;
|
||||
return text==""?0:text.Select(font.GetHeight).Max();
|
||||
}
|
||||
|
||||
private static void _LoadFontFiles(CXMLReader xmlReader, string fontFolder, string themeName = "", int partyModeId = -1)
|
||||
@@ -769,7 +758,7 @@ namespace Vocaluxe.Base
|
||||
|
||||
private static void _BuildGlyphs()
|
||||
{
|
||||
string text = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPGRSTUVWGXZ1234567890";
|
||||
const string text = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPGRSTUVWGXZ1234567890";
|
||||
|
||||
for (int i = 0; i < _Fonts.Count; i++)
|
||||
{
|
||||
|
||||
@@ -28,14 +28,6 @@ using VocaluxeLib.PartyModes;
|
||||
|
||||
namespace Vocaluxe.Base
|
||||
{
|
||||
enum EPopupScreens
|
||||
{
|
||||
PopupPlayerControl = 0,
|
||||
PopupVolumeControl = 1,
|
||||
|
||||
NoPopup = -1
|
||||
}
|
||||
|
||||
class CCursor
|
||||
{
|
||||
private readonly Stopwatch _CursorFadingTimer;
|
||||
|
||||
+7
-20
@@ -19,7 +19,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using VocaluxeLib.Menu;
|
||||
using VocaluxeLib.Menu.SongMenu;
|
||||
@@ -28,7 +28,7 @@ namespace Vocaluxe.Base
|
||||
{
|
||||
public struct SSongPointer
|
||||
{
|
||||
public int SongID;
|
||||
public readonly int SongID;
|
||||
public string SortString;
|
||||
|
||||
public int CatIndex;
|
||||
@@ -56,11 +56,9 @@ namespace Vocaluxe.Base
|
||||
private static int _CatIndex = -1;
|
||||
private static readonly List<CCategory> _CategoriesForRandom = new List<CCategory>();
|
||||
|
||||
private static readonly Stopwatch _CoverLoadTimer = new Stopwatch();
|
||||
|
||||
public static CSongFilter Filter = new CSongFilter();
|
||||
public static CSongSorter Sorter = new CSongSorter();
|
||||
public static CSongCategorizer Categorizer = new CSongCategorizer();
|
||||
public static readonly CSongFilter Filter = new CSongFilter();
|
||||
public static readonly CSongSorter Sorter = new CSongSorter();
|
||||
public static readonly CSongCategorizer Categorizer = new CSongCategorizer();
|
||||
|
||||
private static Thread _CoverLoaderThread;
|
||||
|
||||
@@ -93,13 +91,7 @@ namespace Vocaluxe.Base
|
||||
{
|
||||
get
|
||||
{
|
||||
int result = 0;
|
||||
foreach (SSongPointer sp in Sorter.SortedSongs)
|
||||
{
|
||||
if (sp.Visible)
|
||||
result++;
|
||||
}
|
||||
return result;
|
||||
return Sorter.SortedSongs.Count(sp => sp.Visible);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -210,12 +202,7 @@ namespace Vocaluxe.Base
|
||||
|
||||
public static CSong GetSong(int songID)
|
||||
{
|
||||
foreach (CSong song in _Songs)
|
||||
{
|
||||
if (song.ID == songID)
|
||||
return song;
|
||||
}
|
||||
return null;
|
||||
return _Songs.FirstOrDefault(song => song.ID == songID);
|
||||
}
|
||||
|
||||
public static void AddPartySongSung(int songID)
|
||||
|
||||
+18
-21
@@ -171,7 +171,9 @@ namespace Vocaluxe.Base
|
||||
_KeyPressed = true;
|
||||
}
|
||||
|
||||
// ReSharper disable UnusedParameter.Global
|
||||
public void KeyUp(KeyEventArgs e)
|
||||
// ReSharper restore UnusedParameter.Global
|
||||
{
|
||||
_CheckModifiers();
|
||||
_KeyPressed = false;
|
||||
@@ -206,9 +208,7 @@ namespace Vocaluxe.Base
|
||||
|
||||
private readonly Object _CopyLock = new Object();
|
||||
|
||||
private bool _ModAlt;
|
||||
private bool _ModCtrl;
|
||||
private bool _ModShift;
|
||||
private EModifier _Mod;
|
||||
|
||||
private readonly Stopwatch _Timer;
|
||||
|
||||
@@ -216,22 +216,19 @@ namespace Vocaluxe.Base
|
||||
|
||||
public CMouse()
|
||||
{
|
||||
_ModAlt = false;
|
||||
_ModCtrl = false;
|
||||
_ModShift = false;
|
||||
|
||||
_EventsPool = new List<SMouseEvent>();
|
||||
_CurrentPool = new List<SMouseEvent>();
|
||||
|
||||
_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(int x, int y, bool lb, bool ld, bool rb, int wheel, bool lbh, bool rbh, bool mb, bool mbh)
|
||||
{
|
||||
_CheckModifiers();
|
||||
x = (int)(x * (float)CSettings.RenderW / CDraw.GetScreenWidth());
|
||||
y = (int)(y * (float)CSettings.RenderH / CDraw.GetScreenHeight());
|
||||
|
||||
SMouseEvent pool = new SMouseEvent(ESender.Mouse, alt, shift, ctrl, x, y, lb, ld, rb, -wheel / 120, lbh, rbh, mb, mbh);
|
||||
SMouseEvent pool = new SMouseEvent(ESender.Mouse, _Mod, x, y, lb, ld, rb, -wheel / 120, lbh, rbh, mb, mbh);
|
||||
|
||||
lock (_CopyLock)
|
||||
{
|
||||
@@ -247,30 +244,28 @@ namespace Vocaluxe.Base
|
||||
private void _CheckModifiers()
|
||||
{
|
||||
Keys keys = Control.ModifierKeys;
|
||||
_Mod = EModifier.None;
|
||||
|
||||
_ModShift = (keys & Keys.Shift) == Keys.Shift;
|
||||
_ModAlt = (keys & Keys.Alt) == Keys.Alt;
|
||||
_ModCtrl = (keys & Keys.Control) == Keys.Control;
|
||||
if ((keys & Keys.Shift) != 0)
|
||||
_Mod |= EModifier.Shift;
|
||||
if ((keys & Keys.Alt) != 0)
|
||||
_Mod |= EModifier.Alt;
|
||||
if ((keys & Keys.Control) != 0)
|
||||
_Mod |= EModifier.Ctrl;
|
||||
}
|
||||
|
||||
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,
|
||||
false, e.Button == MouseButtons.Middle);
|
||||
_Add(e.X, e.Y, false, false, false, 0, 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,
|
||||
false, e.Button == MouseButtons.Middle);
|
||||
_Add(e.X, e.Y, false, false, false, e.Delta, false, false, false, false);
|
||||
}
|
||||
|
||||
public void MouseDown(MouseEventArgs e)
|
||||
{
|
||||
_CheckModifiers();
|
||||
|
||||
bool lb = e.Button == MouseButtons.Left;
|
||||
bool ld = false;
|
||||
if (lb)
|
||||
@@ -289,11 +284,13 @@ namespace Vocaluxe.Base
|
||||
else
|
||||
_Timer.Reset();
|
||||
|
||||
_Add(_ModAlt, _ModShift, _ModCtrl, e.X, e.Y, lb, ld, e.Button == MouseButtons.Right, e.Delta, false, false,
|
||||
_Add(e.X, e.Y, lb, ld, e.Button == MouseButtons.Right, e.Delta, false, false,
|
||||
e.Button == MouseButtons.Middle, false);
|
||||
}
|
||||
|
||||
// ReSharper disable UnusedParameter.Global
|
||||
public void MouseUp(MouseEventArgs e)
|
||||
// ReSharper restore UnusedParameter.Global
|
||||
{
|
||||
//CheckModifiers();
|
||||
//Add(_ModALT, _ModSHIFT, _ModCTRL, e.X, e.Y, e.Button == MouseButtons.Left, e.Button == MouseButtons.Right, e.Delta);
|
||||
|
||||
@@ -330,7 +330,7 @@ namespace Vocaluxe.Lib.Draw
|
||||
|
||||
public void MakeScreenShot()
|
||||
{
|
||||
string file = "Screenshot_";
|
||||
const string file = "Screenshot_";
|
||||
string path = Path.Combine(Environment.CurrentDirectory, CSettings.FolderScreenshots);
|
||||
|
||||
int i = 0;
|
||||
|
||||
@@ -26,17 +26,19 @@ namespace Vocaluxe.Lib.Input
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
|
||||
public struct SHIDDeviceInfo
|
||||
{
|
||||
[MarshalAs(UnmanagedType.LPTStr)] public String Path;
|
||||
public ushort VendorString;
|
||||
public ushort ProductID;
|
||||
public String SerialNumber;
|
||||
public ushort ReleaseNumber;
|
||||
public String ManufacturerString;
|
||||
public String ProductString;
|
||||
public ushort UsagePage;
|
||||
public ushort Usage;
|
||||
public int InterfaceNumber;
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
[MarshalAs(UnmanagedType.LPTStr)] public readonly String Path;
|
||||
public readonly ushort VendorString;
|
||||
public readonly ushort ProductID;
|
||||
public readonly String SerialNumber;
|
||||
public readonly ushort ReleaseNumber;
|
||||
public readonly String ManufacturerString;
|
||||
public readonly String ProductString;
|
||||
public readonly ushort UsagePage;
|
||||
public readonly ushort Usage;
|
||||
public readonly int InterfaceNumber;
|
||||
internal IntPtr Next;
|
||||
// ReSharper restore MemberCanBePrivate.Global
|
||||
}
|
||||
|
||||
public static class CHIDApi
|
||||
|
||||
@@ -277,12 +277,12 @@ namespace Vocaluxe.Lib.Input.WiiMote
|
||||
|
||||
if (!lb && !rb && (p.X != _OldPosition.X || p.Y != _OldPosition.Y))
|
||||
{
|
||||
mpool = new SMouseEvent(ESender.WiiMote, false, false, false, x, y, false, false, false, wheel, lbh, false, false, false);
|
||||
mpool = new SMouseEvent(ESender.WiiMote, EModifier.None, x, y, false, false, false, wheel, lbh, false, false, false);
|
||||
trigger = true;
|
||||
}
|
||||
else if (lb || rb)
|
||||
{
|
||||
mpool = new SMouseEvent(ESender.WiiMote, false, false, false, x, y, lb, false, rb, wheel, false, false, false, false);
|
||||
mpool = new SMouseEvent(ESender.WiiMote, EModifier.None, x, y, lb, false, rb, wheel, false, false, false, false);
|
||||
trigger = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
// */
|
||||
#endregion
|
||||
|
||||
using System.Linq;
|
||||
using OpenTK.Audio;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -312,12 +313,7 @@ namespace Vocaluxe.Lib.Sound
|
||||
|
||||
private bool _AlreadyAdded(int stream)
|
||||
{
|
||||
foreach (SAudioStreams st in _Streams)
|
||||
{
|
||||
if (st.Handle == stream)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return _Streams.Any(st => st.Handle == stream);
|
||||
}
|
||||
|
||||
private int _GetStreamIndex(int stream)
|
||||
|
||||
@@ -46,7 +46,9 @@ namespace Vocaluxe.Lib.Sound
|
||||
public string InputName;
|
||||
public int Channel;
|
||||
|
||||
// ReSharper disable UnusedParameter.Local
|
||||
public SMicConfig(int dummy)
|
||||
// ReSharper restore UnusedParameter.Local
|
||||
{
|
||||
DeviceName = String.Empty;
|
||||
DeviceDriver = String.Empty;
|
||||
|
||||
@@ -28,7 +28,9 @@ namespace Vocaluxe.Lib.Sound.PortAudio
|
||||
</summary>
|
||||
*/
|
||||
// ReSharper disable UnusedMember.Global
|
||||
|
||||
// ReSharper disable FieldCanBeMadeReadOnly.Global
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
|
||||
public static class CPortAudio
|
||||
{
|
||||
#region **** PORTAUDIO CALLBACKS ****
|
||||
@@ -50,7 +52,8 @@ namespace Vocaluxe.Lib.Sound.PortAudio
|
||||
public struct SPaDeviceInfo
|
||||
{
|
||||
public int StructVersion;
|
||||
[MarshalAs(UnmanagedType.LPStr)] public string Name;
|
||||
[MarshalAs(UnmanagedType.LPStr)]
|
||||
public string Name;
|
||||
public int HostApi;
|
||||
public int MaxInputChannels;
|
||||
public int MaxOutputChannels;
|
||||
@@ -552,5 +555,7 @@ namespace Vocaluxe.Lib.Sound.PortAudio
|
||||
#endregion
|
||||
}
|
||||
// ReSharper restore UnusedMember.Global
|
||||
// ReSharper restore FieldCanBeMadeReadOnly.Global
|
||||
// ReSharper restore MemberCanBePrivate.Global
|
||||
|
||||
}
|
||||
@@ -18,6 +18,7 @@
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using VocaluxeLib.Menu;
|
||||
|
||||
namespace Vocaluxe.Lib.Video
|
||||
@@ -79,12 +80,7 @@ namespace Vocaluxe.Lib.Video
|
||||
|
||||
protected bool _AlreadyAdded(int streamID)
|
||||
{
|
||||
foreach (SVideoStreams st in _Streams)
|
||||
{
|
||||
if (st.Handle == streamID)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return _Streams.Any(st => st.Handle == streamID);
|
||||
}
|
||||
|
||||
protected int _GetStreamIndex(int streamID)
|
||||
|
||||
@@ -36,7 +36,6 @@ namespace Vocaluxe.Lib.Video.Gstreamer
|
||||
public struct SManagedFrame
|
||||
{
|
||||
public byte[] Buffer;
|
||||
public int Size;
|
||||
public int Width;
|
||||
public int Height;
|
||||
public float Videotime;
|
||||
@@ -102,7 +101,6 @@ namespace Vocaluxe.Lib.Video.Gstreamer
|
||||
SManagedFrame m;
|
||||
m.Buffer = buffer;
|
||||
m.Height = f.Height;
|
||||
m.Size = f.Size;
|
||||
m.Videotime = f.Videotime;
|
||||
m.Width = f.Width;
|
||||
return m;
|
||||
|
||||
@@ -87,17 +87,14 @@ namespace Vocaluxe.Lib.Webcam
|
||||
public bool Init()
|
||||
{
|
||||
_WebcamDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
|
||||
int num = 0;
|
||||
foreach (FilterInfo info in _WebcamDevices)
|
||||
{
|
||||
SWebcamDevice device = new SWebcamDevice
|
||||
{
|
||||
ID = num,
|
||||
Name = info.Name,
|
||||
MonikerString = info.MonikerString,
|
||||
Capabilities = new List<SCapabilities>()
|
||||
};
|
||||
num++;
|
||||
VideoCaptureDevice tmpdev = new VideoCaptureDevice(info.MonikerString);
|
||||
|
||||
foreach (VideoCapabilities capabilities in tmpdev.VideoCapabilities)
|
||||
|
||||
@@ -25,7 +25,6 @@ namespace Vocaluxe.Lib.Webcam
|
||||
{
|
||||
struct SWebcamDevice
|
||||
{
|
||||
public int ID;
|
||||
public string Name;
|
||||
public string MonikerString;
|
||||
public List<SCapabilities> Capabilities;
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using Vocaluxe.Base;
|
||||
using VocaluxeLib.Menu;
|
||||
@@ -207,13 +208,7 @@ namespace Vocaluxe.Screens
|
||||
|
||||
private bool _IsNewEntry(int id)
|
||||
{
|
||||
for (int i = 0; i < _NewEntryIDs.Count; i++)
|
||||
{
|
||||
if (_NewEntryIDs[i] == id)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return _NewEntryIDs.Any(t => t == id);
|
||||
}
|
||||
|
||||
private void _AddScoresToDB()
|
||||
|
||||
@@ -40,7 +40,6 @@ namespace Vocaluxe.Screens
|
||||
private const string _ButtonExit = "ButtonExit";
|
||||
|
||||
private int _BackgroundMusicVolume;
|
||||
private EOffOn _BackgroundMusic;
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
@@ -142,7 +141,6 @@ namespace Vocaluxe.Screens
|
||||
public override void OnShow()
|
||||
{
|
||||
base.OnShow();
|
||||
_BackgroundMusic = CConfig.BackgroundMusic;
|
||||
_BackgroundMusicVolume = CConfig.BackgroundMusicVolume;
|
||||
|
||||
_SelectSlides[_SelectSlideGameMusicVolume].Selection = CConfig.GameMusicVolume / 5;
|
||||
|
||||
@@ -242,10 +242,5 @@ namespace Vocaluxe.Screens
|
||||
_ResumeBG();
|
||||
}
|
||||
}
|
||||
|
||||
private void _AfterSkinReload()
|
||||
{
|
||||
_Active = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -259,7 +259,7 @@ namespace Vocaluxe.Screens
|
||||
|
||||
private void _OnSaveSnapshot()
|
||||
{
|
||||
string filename = "snapshot";
|
||||
const string filename = "snapshot";
|
||||
int i = 0;
|
||||
while (File.Exists(Path.Combine(CSettings.FolderProfiles, filename + i + ".png")))
|
||||
i++;
|
||||
|
||||
@@ -90,7 +90,7 @@ namespace Vocaluxe.Screens
|
||||
private int _CurrentBeat;
|
||||
private int _CurrentStream = -1;
|
||||
//private int _NextStream = -1;
|
||||
private float _Volume = 100f;
|
||||
private const float _Volume = 100f;
|
||||
private int _CurrentVideo = -1;
|
||||
private EAspect _VideoAspect = EAspect.Crop;
|
||||
private STexture _CurrentVideoTexture = new STexture(-1);
|
||||
@@ -769,7 +769,7 @@ namespace Vocaluxe.Screens
|
||||
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);
|
||||
}
|
||||
|
||||
if (i == 0 && !song.IsDuet || i == 1 && song.IsDuet)
|
||||
|
||||
@@ -853,13 +853,13 @@ namespace Vocaluxe.Screens
|
||||
CGame.Reset();
|
||||
CGame.ClearSongs();
|
||||
|
||||
List<int> iDs = new List<int>();
|
||||
List<int> ids = new List<int>();
|
||||
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)
|
||||
@@ -867,7 +867,7 @@ namespace Vocaluxe.Screens
|
||||
|
||||
CGame.AddSong(songNr, gm);
|
||||
|
||||
iDs.Remove(songNr);
|
||||
ids.Remove(songNr);
|
||||
}
|
||||
|
||||
if (CGame.GetNumSongs() > 0)
|
||||
@@ -879,13 +879,13 @@ namespace Vocaluxe.Screens
|
||||
CGame.Reset();
|
||||
CGame.ClearSongs();
|
||||
|
||||
List<int> iDs = new List<int>();
|
||||
List<int> ids = new List<int>();
|
||||
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)
|
||||
@@ -893,7 +893,7 @@ namespace Vocaluxe.Screens
|
||||
|
||||
CGame.AddSong(songNr, gm);
|
||||
|
||||
iDs.Remove(songNr);
|
||||
ids.Remove(songNr);
|
||||
}
|
||||
|
||||
if (CGame.GetNumSongs() > 0)
|
||||
@@ -905,21 +905,21 @@ namespace Vocaluxe.Screens
|
||||
CGame.Reset();
|
||||
CGame.ClearSongs();
|
||||
|
||||
List<int> iDs = new List<int>();
|
||||
List<int> ids = new List<int>();
|
||||
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)
|
||||
{
|
||||
@@ -931,7 +931,7 @@ namespace Vocaluxe.Screens
|
||||
}
|
||||
}
|
||||
|
||||
iDs.Remove(songNr);
|
||||
ids.Remove(songNr);
|
||||
}
|
||||
|
||||
if (CGame.GetNumSongs() > 0)
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using Vocaluxe.Base;
|
||||
using VocaluxeLib.Menu;
|
||||
@@ -33,7 +32,9 @@ namespace Vocaluxe.Screens
|
||||
get { return 1; }
|
||||
}
|
||||
|
||||
/*
|
||||
private int _TestMusic = -1;
|
||||
*/
|
||||
|
||||
public override bool HandleInput(SKeyEvent keyEvent)
|
||||
{
|
||||
@@ -85,23 +86,25 @@ namespace Vocaluxe.Screens
|
||||
return true;
|
||||
}
|
||||
|
||||
private void _PlayFile()
|
||||
{
|
||||
if (_TestMusic == -1)
|
||||
_TestMusic = CSound.Load(Path.Combine(Environment.CurrentDirectory, "Test.mp3"));
|
||||
/*
|
||||
private void _PlayFile()
|
||||
{
|
||||
if (_TestMusic == -1)
|
||||
_TestMusic = CSound.Load(Path.Combine(Environment.CurrentDirectory, "Test.mp3"));
|
||||
|
||||
CSound.Play(_TestMusic);
|
||||
CSound.Fade(_TestMusic, 100f, 2f);
|
||||
}
|
||||
CSound.Play(_TestMusic);
|
||||
CSound.Fade(_TestMusic, 100f, 2f);
|
||||
}
|
||||
|
||||
private void _PauseFile()
|
||||
{
|
||||
CSound.Pause(_TestMusic);
|
||||
}
|
||||
|
||||
private void _FadeAndPause()
|
||||
{
|
||||
CSound.FadeAndPause(_TestMusic, 0f, 2f);
|
||||
}
|
||||
private void _PauseFile()
|
||||
{
|
||||
CSound.Pause(_TestMusic);
|
||||
}
|
||||
|
||||
private void _FadeAndPause()
|
||||
{
|
||||
CSound.FadeAndPause(_TestMusic, 0f, 2f);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
+57
-57
@@ -45,17 +45,17 @@ namespace VocaluxeLib.Menu
|
||||
public SColorF Color;
|
||||
public SColorF SelColor;
|
||||
|
||||
public bool IsSelText;
|
||||
public CText Text;
|
||||
public CText SelText;
|
||||
private bool _IsSelText;
|
||||
public readonly CText Text;
|
||||
private readonly CText _SelText;
|
||||
|
||||
public bool Reflection;
|
||||
public float ReflectionSpace;
|
||||
public float ReflectionHeight;
|
||||
private bool _Reflection;
|
||||
private float _ReflectionSpace;
|
||||
private float _ReflectionHeight;
|
||||
|
||||
public bool SelReflection;
|
||||
public float SelReflectionSpace;
|
||||
public float SelReflectionHeight;
|
||||
private bool _SelReflection;
|
||||
private float _SelReflectionSpace;
|
||||
private float _SelReflectionHeight;
|
||||
|
||||
public bool Pressed;
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace VocaluxeLib.Menu
|
||||
set
|
||||
{
|
||||
Text.EditMode = value;
|
||||
SelText.EditMode = value;
|
||||
_SelText.EditMode = value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,21 +97,21 @@ namespace VocaluxeLib.Menu
|
||||
Texture = new STexture(-1);
|
||||
SelTexture = new STexture(-1);
|
||||
|
||||
IsSelText = false;
|
||||
_IsSelText = false;
|
||||
Text = new CText(_PartyModeID);
|
||||
SelText = new CText(_PartyModeID);
|
||||
_SelText = new CText(_PartyModeID);
|
||||
Selected = false;
|
||||
Visible = true;
|
||||
EditMode = false;
|
||||
Enabled = true;
|
||||
|
||||
Reflection = false;
|
||||
ReflectionSpace = 0f;
|
||||
ReflectionHeight = 0f;
|
||||
_Reflection = false;
|
||||
_ReflectionSpace = 0f;
|
||||
_ReflectionHeight = 0f;
|
||||
|
||||
SelReflection = false;
|
||||
SelReflectionSpace = 0f;
|
||||
SelReflectionHeight = 0f;
|
||||
_SelReflection = false;
|
||||
_SelReflectionSpace = 0f;
|
||||
_SelReflectionHeight = 0f;
|
||||
}
|
||||
|
||||
public CButton(CButton button)
|
||||
@@ -131,22 +131,22 @@ namespace VocaluxeLib.Menu
|
||||
Texture = button.Texture;
|
||||
SelTexture = button.SelTexture;
|
||||
|
||||
IsSelText = false;
|
||||
_IsSelText = false;
|
||||
Text = new CText(button.Text);
|
||||
SelText = new CText(button.SelText);
|
||||
_SelText = new CText(button._SelText);
|
||||
Selected = false;
|
||||
Visible = true;
|
||||
EditMode = false;
|
||||
_ThemeLoaded = false;
|
||||
Enabled = button.Enabled;
|
||||
|
||||
Reflection = button.Reflection;
|
||||
ReflectionHeight = button.ReflectionHeight;
|
||||
ReflectionSpace = button.ReflectionSpace;
|
||||
_Reflection = button._Reflection;
|
||||
_ReflectionHeight = button._ReflectionHeight;
|
||||
_ReflectionSpace = button._ReflectionSpace;
|
||||
|
||||
SelReflection = button.SelReflection;
|
||||
SelReflectionHeight = button.SelReflectionHeight;
|
||||
SelReflectionSpace = button.SelReflectionSpace;
|
||||
_SelReflection = button._SelReflection;
|
||||
_SelReflectionHeight = button._SelReflectionHeight;
|
||||
_SelReflectionSpace = button._SelReflectionSpace;
|
||||
}
|
||||
|
||||
public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex)
|
||||
@@ -187,30 +187,30 @@ namespace VocaluxeLib.Menu
|
||||
Text.Z = Rect.Z;
|
||||
if (xmlReader.ItemExists(item + "/SText"))
|
||||
{
|
||||
IsSelText = true;
|
||||
_ThemeLoaded &= SelText.LoadTheme(item, "SText", xmlReader, skinIndex, true);
|
||||
SelText.Z = Rect.Z;
|
||||
_IsSelText = true;
|
||||
_ThemeLoaded &= _SelText.LoadTheme(item, "SText", xmlReader, skinIndex, true);
|
||||
_SelText.Z = Rect.Z;
|
||||
}
|
||||
|
||||
|
||||
//Reflections
|
||||
if (xmlReader.ItemExists(item + "/Reflection"))
|
||||
{
|
||||
Reflection = true;
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Reflection/Space", ref ReflectionSpace);
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Reflection/Height", ref ReflectionHeight);
|
||||
_Reflection = true;
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Reflection/Space", ref _ReflectionSpace);
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Reflection/Height", ref _ReflectionHeight);
|
||||
}
|
||||
else
|
||||
Reflection = false;
|
||||
_Reflection = false;
|
||||
|
||||
if (xmlReader.ItemExists(item + "/SReflection"))
|
||||
{
|
||||
SelReflection = true;
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SReflection/Space", ref SelReflectionSpace);
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SReflection/Height", ref SelReflectionHeight);
|
||||
_SelReflection = true;
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SReflection/Space", ref _SelReflectionSpace);
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SReflection/Height", ref _SelReflectionHeight);
|
||||
}
|
||||
else
|
||||
SelReflection = false;
|
||||
_SelReflection = false;
|
||||
|
||||
if (_ThemeLoaded)
|
||||
{
|
||||
@@ -264,28 +264,28 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
|
||||
Text.SaveTheme(writer);
|
||||
if (IsSelText)
|
||||
SelText.SaveTheme(writer);
|
||||
if (_IsSelText)
|
||||
_SelText.SaveTheme(writer);
|
||||
|
||||
writer.WriteComment("<Reflection> If exists:");
|
||||
writer.WriteComment(" <Space>: Reflection Space");
|
||||
writer.WriteComment(" <Height>: Reflection Height");
|
||||
if (Reflection)
|
||||
if (_Reflection)
|
||||
{
|
||||
writer.WriteStartElement("Reflection");
|
||||
writer.WriteElementString("Space", ReflectionSpace.ToString("#0"));
|
||||
writer.WriteElementString("Height", ReflectionHeight.ToString("#0"));
|
||||
writer.WriteElementString("Space", _ReflectionSpace.ToString("#0"));
|
||||
writer.WriteElementString("Height", _ReflectionHeight.ToString("#0"));
|
||||
writer.WriteEndElement();
|
||||
}
|
||||
|
||||
writer.WriteComment("<SReflection> If exists:");
|
||||
writer.WriteComment(" <Space>: Reflection Space of selected button");
|
||||
writer.WriteComment(" <Height>: Reflection Height of selected button");
|
||||
if (SelReflection)
|
||||
if (_SelReflection)
|
||||
{
|
||||
writer.WriteStartElement("SReflection");
|
||||
writer.WriteElementString("Space", ReflectionSpace.ToString("#0"));
|
||||
writer.WriteElementString("Height", ReflectionHeight.ToString("#0"));
|
||||
writer.WriteElementString("Space", _ReflectionSpace.ToString("#0"));
|
||||
writer.WriteElementString("Height", _ReflectionHeight.ToString("#0"));
|
||||
writer.WriteEndElement();
|
||||
}
|
||||
|
||||
@@ -309,41 +309,41 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
CBase.Drawing.DrawTexture(texture, Rect, Color);
|
||||
|
||||
if (Reflection)
|
||||
if (_Reflection)
|
||||
{
|
||||
CBase.Drawing.DrawTextureReflection(texture, Rect, Color, Rect, ReflectionSpace, ReflectionHeight);
|
||||
Text.DrawRelative(Rect.X, Rect.Y, ReflectionSpace, ReflectionHeight, Rect.H);
|
||||
CBase.Drawing.DrawTextureReflection(texture, Rect, Color, Rect, _ReflectionSpace, _ReflectionHeight);
|
||||
Text.DrawRelative(Rect.X, Rect.Y, _ReflectionSpace, _ReflectionHeight, Rect.H);
|
||||
}
|
||||
else
|
||||
Text.DrawRelative(Rect.X, Rect.Y);
|
||||
}
|
||||
else if (!IsSelText)
|
||||
else if (!_IsSelText)
|
||||
{
|
||||
texture = Texture.Index != -1 ? Texture : CBase.Theme.GetSkinTexture(_Theme.SelTextureName, _PartyModeID);
|
||||
|
||||
CBase.Drawing.DrawTexture(texture, Rect, SelColor);
|
||||
|
||||
if (Reflection)
|
||||
if (_Reflection)
|
||||
{
|
||||
CBase.Drawing.DrawTextureReflection(texture, Rect, SelColor, Rect, ReflectionSpace, ReflectionHeight);
|
||||
Text.DrawRelative(Rect.X, Rect.Y, ReflectionSpace, ReflectionHeight, Rect.H);
|
||||
CBase.Drawing.DrawTextureReflection(texture, Rect, SelColor, Rect, _ReflectionSpace, _ReflectionHeight);
|
||||
Text.DrawRelative(Rect.X, Rect.Y, _ReflectionSpace, _ReflectionHeight, Rect.H);
|
||||
}
|
||||
else
|
||||
Text.DrawRelative(Rect.X, Rect.Y);
|
||||
}
|
||||
else if (IsSelText)
|
||||
else if (_IsSelText)
|
||||
{
|
||||
texture = SelTexture.Index != -1 ? SelTexture : CBase.Theme.GetSkinTexture(_Theme.SelTextureName, _PartyModeID);
|
||||
|
||||
CBase.Drawing.DrawTexture(texture, Rect, SelColor);
|
||||
|
||||
if (Reflection)
|
||||
if (_Reflection)
|
||||
{
|
||||
CBase.Drawing.DrawTextureReflection(texture, Rect, SelColor, Rect, ReflectionSpace, ReflectionHeight);
|
||||
SelText.DrawRelative(Rect.X, Rect.Y, ReflectionSpace, ReflectionHeight, Rect.H);
|
||||
CBase.Drawing.DrawTextureReflection(texture, Rect, SelColor, Rect, _ReflectionSpace, _ReflectionHeight);
|
||||
_SelText.DrawRelative(Rect.X, Rect.Y, _ReflectionSpace, _ReflectionHeight, Rect.H);
|
||||
}
|
||||
else
|
||||
SelText.DrawRelative(Rect.X, Rect.Y);
|
||||
_SelText.DrawRelative(Rect.X, Rect.Y);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+225
-220
@@ -500,56 +500,141 @@ namespace VocaluxeLib.Menu
|
||||
{
|
||||
if (keyEvent.KeyPressed && !Char.IsControl(keyEvent.Unicode))
|
||||
_Theme.ButtonPlaylistName.Text.Text = _Theme.ButtonPlaylistName.Text.Text + keyEvent.Unicode;
|
||||
else if (keyEvent.Key == Keys.Enter)
|
||||
else switch (keyEvent.Key)
|
||||
{
|
||||
CBase.Playlist.SetPlaylistName(ActivePlaylistID, _Theme.ButtonPlaylistName.Text.Text);
|
||||
CBase.Playlist.SavePlaylist(ActivePlaylistID);
|
||||
EditMode = EEditMode.None;
|
||||
_Theme.ButtonPlaylistName.EditMode = false;
|
||||
}
|
||||
else if (keyEvent.Key == Keys.Escape)
|
||||
{
|
||||
_Theme.ButtonPlaylistName.Text.Text = CBase.Playlist.GetPlaylistName(ActivePlaylistID);
|
||||
EditMode = EEditMode.None;
|
||||
_Theme.ButtonPlaylistName.EditMode = false;
|
||||
}
|
||||
else if (keyEvent.Key == Keys.Back || keyEvent.Key == Keys.Delete)
|
||||
{
|
||||
if (_Theme.ButtonPlaylistName.Text.Text != "")
|
||||
_Theme.ButtonPlaylistName.Text.Text = _Theme.ButtonPlaylistName.Text.Text.Remove(_Theme.ButtonPlaylistName.Text.Text.Length - 1);
|
||||
case Keys.Enter:
|
||||
CBase.Playlist.SetPlaylistName(ActivePlaylistID, _Theme.ButtonPlaylistName.Text.Text);
|
||||
CBase.Playlist.SavePlaylist(ActivePlaylistID);
|
||||
EditMode = EEditMode.None;
|
||||
_Theme.ButtonPlaylistName.EditMode = false;
|
||||
break;
|
||||
case Keys.Escape:
|
||||
_Theme.ButtonPlaylistName.Text.Text = CBase.Playlist.GetPlaylistName(ActivePlaylistID);
|
||||
EditMode = EEditMode.None;
|
||||
_Theme.ButtonPlaylistName.EditMode = false;
|
||||
break;
|
||||
case Keys.Delete:
|
||||
case Keys.Back:
|
||||
if (_Theme.ButtonPlaylistName.Text.Text != "")
|
||||
_Theme.ButtonPlaylistName.Text.Text = _Theme.ButtonPlaylistName.Text.Text.Remove(_Theme.ButtonPlaylistName.Text.Text.Length - 1);
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
if (CurrentPlaylistElement == -1 || _PlaylistElementContents.Count == 0)
|
||||
{
|
||||
if (CurrentPlaylistElement == -1 || _PlaylistElementContents.Count == 0)
|
||||
{
|
||||
//no song is selected
|
||||
_Interactions.HandleInput(keyEvent);
|
||||
CurrentPlaylistElement = _GetSelectedSelectionNr();
|
||||
//no song is selected
|
||||
_Interactions.HandleInput(keyEvent);
|
||||
CurrentPlaylistElement = _GetSelectedSelectionNr();
|
||||
|
||||
if (CurrentPlaylistElement != -1)
|
||||
return true;
|
||||
}
|
||||
else if (CurrentPlaylistElement != -1)
|
||||
{
|
||||
//a song is selected
|
||||
int scrollLimit = _PlaylistElements.Count / 2;
|
||||
if (CurrentPlaylistElement != -1)
|
||||
return true;
|
||||
}
|
||||
else if (CurrentPlaylistElement != -1)
|
||||
{
|
||||
//a song is selected
|
||||
int scrollLimit = _PlaylistElements.Count / 2;
|
||||
|
||||
//special actions if a song is selected
|
||||
switch (keyEvent.Key)
|
||||
{
|
||||
case Keys.Up:
|
||||
if (keyEvent.ModShift)
|
||||
//special actions if a song is selected
|
||||
switch (keyEvent.Key)
|
||||
{
|
||||
case Keys.Up:
|
||||
if (keyEvent.ModShift)
|
||||
{
|
||||
_Interactions.SetInteractionToSelectSlide(_PlaylistElements[0].SelectSlide);
|
||||
_Interactions.HandleInput(keyEvent);
|
||||
CurrentPlaylistElement = _GetSelectedSelectionNr();
|
||||
}
|
||||
else if (CurrentPlaylistElement > scrollLimit || _PlaylistElementContents.Count == 0)
|
||||
{
|
||||
_Interactions.HandleInput(keyEvent);
|
||||
CurrentPlaylistElement = _GetSelectedSelectionNr();
|
||||
}
|
||||
else if (CurrentPlaylistElement <= scrollLimit)
|
||||
{
|
||||
if (Offset > 0)
|
||||
{
|
||||
Offset--;
|
||||
Update();
|
||||
}
|
||||
else
|
||||
{
|
||||
_Interactions.SetInteractionToSelectSlide(_PlaylistElements[0].SelectSlide);
|
||||
_Interactions.HandleInput(keyEvent);
|
||||
CurrentPlaylistElement = _GetSelectedSelectionNr();
|
||||
}
|
||||
else if (CurrentPlaylistElement > scrollLimit || _PlaylistElementContents.Count == 0)
|
||||
}
|
||||
break;
|
||||
|
||||
case Keys.Down:
|
||||
if (keyEvent.ModShift)
|
||||
{
|
||||
for (int i = _PlaylistElements.Count - 1; i >= 0; i--)
|
||||
{
|
||||
if (_PlaylistElements[i].SelectSlide.Visible)
|
||||
{
|
||||
_Interactions.SetInteractionToSelectSlide(_PlaylistElements[0].SelectSlide);
|
||||
_Interactions.HandleInput(keyEvent);
|
||||
CurrentPlaylistElement = _GetSelectedSelectionNr();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (CurrentPlaylistElement >= scrollLimit)
|
||||
{
|
||||
if (Offset < _PlaylistElementContents.Count - _PlaylistElements.Count)
|
||||
{
|
||||
Offset++;
|
||||
Update();
|
||||
}
|
||||
else
|
||||
{
|
||||
_Interactions.HandleInput(keyEvent);
|
||||
CurrentPlaylistElement = _GetSelectedSelectionNr();
|
||||
}
|
||||
}
|
||||
else if (CurrentPlaylistElement < scrollLimit)
|
||||
{
|
||||
_Interactions.HandleInput(keyEvent);
|
||||
CurrentPlaylistElement = _GetSelectedSelectionNr();
|
||||
}
|
||||
break;
|
||||
|
||||
case Keys.Delete:
|
||||
CBase.Playlist.DeletePlaylistSong(ActivePlaylistID, _PlaylistElements[CurrentPlaylistElement].Content);
|
||||
UpdatePlaylist();
|
||||
|
||||
if (Offset > 0)
|
||||
Offset--;
|
||||
|
||||
Update();
|
||||
|
||||
if (_PlaylistElementContents.Count - 1 < CurrentPlaylistElement)
|
||||
CurrentPlaylistElement = _PlaylistElementContents.Count - 1;
|
||||
|
||||
if (CurrentPlaylistElement != -1)
|
||||
_Interactions.SetInteractionToSelectSlide(_PlaylistElements[CurrentPlaylistElement].SelectSlide);
|
||||
break;
|
||||
|
||||
case Keys.Back:
|
||||
ClosePlaylist(); //really? or better global?
|
||||
break;
|
||||
|
||||
case Keys.Enter:
|
||||
_StartPlaylistSong(CurrentPlaylistElement);
|
||||
break;
|
||||
|
||||
case Keys.Add: //move the selected song up
|
||||
if (_PlaylistElementContents.Count > 1 && (CurrentPlaylistElement > 0 || Offset > 0))
|
||||
{
|
||||
CBase.Playlist.MovePlaylistSongUp(ActivePlaylistID, CurrentPlaylistElement + Offset);
|
||||
UpdatePlaylist();
|
||||
|
||||
SKeyEvent key = new SKeyEvent {Key = Keys.Up};
|
||||
|
||||
if (CurrentPlaylistElement > scrollLimit)
|
||||
{
|
||||
_Interactions.HandleInput(key);
|
||||
CurrentPlaylistElement = _GetSelectedSelectionNr();
|
||||
}
|
||||
else if (CurrentPlaylistElement <= scrollLimit)
|
||||
{
|
||||
if (Offset > 0)
|
||||
@@ -559,26 +644,22 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
else
|
||||
{
|
||||
_Interactions.HandleInput(keyEvent);
|
||||
_Interactions.HandleInput(key);
|
||||
CurrentPlaylistElement = _GetSelectedSelectionNr();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case Keys.Down:
|
||||
if (keyEvent.ModShift)
|
||||
{
|
||||
for (int i = _PlaylistElements.Count - 1; i >= 0; i--)
|
||||
{
|
||||
if (_PlaylistElements[i].SelectSlide.Visible)
|
||||
{
|
||||
_Interactions.SetInteractionToSelectSlide(_PlaylistElements[0].SelectSlide);
|
||||
_Interactions.HandleInput(keyEvent);
|
||||
CurrentPlaylistElement = _GetSelectedSelectionNr();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (CurrentPlaylistElement >= scrollLimit)
|
||||
case Keys.Subtract: //move the selected song down
|
||||
if (_PlaylistElementContents.Count > 1 && CurrentPlaylistElement + Offset < _PlaylistElementContents.Count - 1)
|
||||
{
|
||||
CBase.Playlist.MovePlaylistSongDown(ActivePlaylistID, CurrentPlaylistElement + Offset);
|
||||
UpdatePlaylist();
|
||||
|
||||
SKeyEvent key = new SKeyEvent {Key = Keys.Down};
|
||||
|
||||
if (CurrentPlaylistElement >= scrollLimit)
|
||||
{
|
||||
if (Offset < _PlaylistElementContents.Count - _PlaylistElements.Count)
|
||||
{
|
||||
@@ -587,203 +668,127 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
else
|
||||
{
|
||||
_Interactions.HandleInput(keyEvent);
|
||||
_Interactions.HandleInput(key);
|
||||
CurrentPlaylistElement = _GetSelectedSelectionNr();
|
||||
}
|
||||
}
|
||||
else if (CurrentPlaylistElement < scrollLimit)
|
||||
{
|
||||
_Interactions.HandleInput(keyEvent);
|
||||
_Interactions.HandleInput(key);
|
||||
CurrentPlaylistElement = _GetSelectedSelectionNr();
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case Keys.Delete:
|
||||
CBase.Playlist.DeletePlaylistSong(ActivePlaylistID, _PlaylistElements[CurrentPlaylistElement].Content);
|
||||
UpdatePlaylist();
|
||||
case Keys.PageUp: //scroll up
|
||||
if (_PlaylistElementContents.Count > 0)
|
||||
{
|
||||
Offset -= _PlaylistElements.Count;
|
||||
|
||||
if (Offset > 0)
|
||||
Offset--;
|
||||
if (Offset < 0)
|
||||
Offset = 0;
|
||||
|
||||
Update();
|
||||
CurrentPlaylistElement = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case Keys.PageDown: //scroll down
|
||||
if (_PlaylistElementContents.Count > 0)
|
||||
{
|
||||
Offset += _PlaylistElements.Count;
|
||||
|
||||
if (Offset > _PlaylistElementContents.Count - _PlaylistElements.Count)
|
||||
Offset = _PlaylistElementContents.Count - _PlaylistElements.Count;
|
||||
|
||||
if (Offset < 0)
|
||||
Offset = 0;
|
||||
|
||||
Update();
|
||||
|
||||
if (_PlaylistElementContents.Count - 1 < CurrentPlaylistElement)
|
||||
CurrentPlaylistElement = _PlaylistElementContents.Count - 1;
|
||||
|
||||
if (CurrentPlaylistElement != -1)
|
||||
_Interactions.SetInteractionToSelectSlide(_PlaylistElements[CurrentPlaylistElement].SelectSlide);
|
||||
break;
|
||||
|
||||
case Keys.Back:
|
||||
ClosePlaylist(); //really? or better global?
|
||||
break;
|
||||
|
||||
case Keys.Enter:
|
||||
_StartPlaylistSong(CurrentPlaylistElement);
|
||||
break;
|
||||
|
||||
case Keys.Add: //move the selected song up
|
||||
if (_PlaylistElementContents.Count > 1 && (CurrentPlaylistElement > 0 || Offset > 0))
|
||||
for (int i = _PlaylistElements.Count - 1; i >= 0; i--)
|
||||
{
|
||||
CBase.Playlist.MovePlaylistSongUp(ActivePlaylistID, CurrentPlaylistElement + Offset);
|
||||
UpdatePlaylist();
|
||||
|
||||
SKeyEvent key = new SKeyEvent {Key = Keys.Up};
|
||||
|
||||
if (CurrentPlaylistElement > scrollLimit)
|
||||
if (_PlaylistElements[i].SelectSlide.Visible)
|
||||
{
|
||||
_Interactions.HandleInput(key);
|
||||
CurrentPlaylistElement = _GetSelectedSelectionNr();
|
||||
}
|
||||
else if (CurrentPlaylistElement <= scrollLimit)
|
||||
{
|
||||
if (Offset > 0)
|
||||
{
|
||||
Offset--;
|
||||
Update();
|
||||
}
|
||||
else
|
||||
{
|
||||
_Interactions.HandleInput(key);
|
||||
CurrentPlaylistElement = _GetSelectedSelectionNr();
|
||||
}
|
||||
CurrentPlaylistElement = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case Keys.Subtract: //move the selected song down
|
||||
if (_PlaylistElementContents.Count > 1 && CurrentPlaylistElement + Offset < _PlaylistElementContents.Count - 1)
|
||||
{
|
||||
CBase.Playlist.MovePlaylistSongDown(ActivePlaylistID, CurrentPlaylistElement + Offset);
|
||||
UpdatePlaylist();
|
||||
case Keys.Left:
|
||||
_Interactions.HandleInput(keyEvent);
|
||||
CurrentPlaylistElement = _GetSelectedSelectionNr();
|
||||
|
||||
SKeyEvent key = new SKeyEvent {Key = Keys.Down};
|
||||
if (CurrentPlaylistElement != -1)
|
||||
{
|
||||
CBase.Playlist.GetPlaylistSong(ActivePlaylistID, CurrentPlaylistElement + Offset).GameMode =
|
||||
_PlaylistElementContents[CurrentPlaylistElement + Offset].Modes[_PlaylistElements[CurrentPlaylistElement].SelectSlide.Selection];
|
||||
UpdatePlaylist();
|
||||
}
|
||||
break;
|
||||
|
||||
if (CurrentPlaylistElement >= scrollLimit)
|
||||
{
|
||||
if (Offset < _PlaylistElementContents.Count - _PlaylistElements.Count)
|
||||
{
|
||||
Offset++;
|
||||
Update();
|
||||
}
|
||||
else
|
||||
{
|
||||
_Interactions.HandleInput(key);
|
||||
CurrentPlaylistElement = _GetSelectedSelectionNr();
|
||||
}
|
||||
}
|
||||
else if (CurrentPlaylistElement < scrollLimit)
|
||||
{
|
||||
_Interactions.HandleInput(key);
|
||||
CurrentPlaylistElement = _GetSelectedSelectionNr();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Keys.Right:
|
||||
_Interactions.HandleInput(keyEvent);
|
||||
CurrentPlaylistElement = _GetSelectedSelectionNr();
|
||||
|
||||
case Keys.PageUp: //scroll up
|
||||
if (_PlaylistElementContents.Count > 0)
|
||||
{
|
||||
Offset -= _PlaylistElements.Count;
|
||||
|
||||
if (Offset < 0)
|
||||
Offset = 0;
|
||||
|
||||
Update();
|
||||
CurrentPlaylistElement = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case Keys.PageDown: //scroll down
|
||||
if (_PlaylistElementContents.Count > 0)
|
||||
{
|
||||
Offset += _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--)
|
||||
{
|
||||
if (_PlaylistElements[i].SelectSlide.Visible)
|
||||
{
|
||||
CurrentPlaylistElement = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case Keys.Left:
|
||||
_Interactions.HandleInput(keyEvent);
|
||||
CurrentPlaylistElement = _GetSelectedSelectionNr();
|
||||
|
||||
if (CurrentPlaylistElement != -1)
|
||||
{
|
||||
CBase.Playlist.GetPlaylistSong(ActivePlaylistID, CurrentPlaylistElement + Offset).GameMode =
|
||||
_PlaylistElementContents[CurrentPlaylistElement + Offset].Modes[_PlaylistElements[CurrentPlaylistElement].SelectSlide.Selection];
|
||||
UpdatePlaylist();
|
||||
}
|
||||
break;
|
||||
|
||||
case Keys.Right:
|
||||
_Interactions.HandleInput(keyEvent);
|
||||
CurrentPlaylistElement = _GetSelectedSelectionNr();
|
||||
|
||||
if (CurrentPlaylistElement != -1)
|
||||
{
|
||||
CBase.Playlist.GetPlaylistSong(ActivePlaylistID, CurrentPlaylistElement + Offset).GameMode =
|
||||
_PlaylistElementContents[CurrentPlaylistElement + Offset].Modes[_PlaylistElements[CurrentPlaylistElement].SelectSlide.Selection];
|
||||
UpdatePlaylist();
|
||||
}
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
if (CurrentPlaylistElement != -1)
|
||||
{
|
||||
CBase.Playlist.GetPlaylistSong(ActivePlaylistID, CurrentPlaylistElement + Offset).GameMode =
|
||||
_PlaylistElementContents[CurrentPlaylistElement + Offset].Modes[_PlaylistElements[CurrentPlaylistElement].SelectSlide.Selection];
|
||||
UpdatePlaylist();
|
||||
}
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//default actions
|
||||
switch (keyEvent.Key)
|
||||
{
|
||||
case Keys.Back:
|
||||
if (_Theme.ButtonPlaylistName.Selected)
|
||||
//default actions
|
||||
switch (keyEvent.Key)
|
||||
{
|
||||
case Keys.Back:
|
||||
if (_Theme.ButtonPlaylistName.Selected)
|
||||
{
|
||||
EditMode = EEditMode.PlaylistName;
|
||||
_Theme.ButtonPlaylistName.EditMode = true;
|
||||
}
|
||||
else
|
||||
ClosePlaylist();
|
||||
break;
|
||||
|
||||
case Keys.Enter:
|
||||
if (_Theme.ButtonPlaylistClose.Selected)
|
||||
ClosePlaylist();
|
||||
else if (_Theme.ButtonPlaylistSing.Selected)
|
||||
_StartPlaylistSongs();
|
||||
else if (_Theme.ButtonPlaylistSave.Selected)
|
||||
CBase.Playlist.SavePlaylist(ActivePlaylistID);
|
||||
else if (_Theme.ButtonPlaylistDelete.Selected)
|
||||
{
|
||||
CBase.Playlist.DeletePlaylist(ActivePlaylistID);
|
||||
ClosePlaylist();
|
||||
}
|
||||
else if (_Theme.ButtonPlaylistName.Selected)
|
||||
{
|
||||
if (EditMode != EEditMode.PlaylistName)
|
||||
{
|
||||
EditMode = EEditMode.PlaylistName;
|
||||
_Theme.ButtonPlaylistName.EditMode = true;
|
||||
}
|
||||
else
|
||||
ClosePlaylist();
|
||||
break;
|
||||
|
||||
case Keys.Enter:
|
||||
if (_Theme.ButtonPlaylistClose.Selected)
|
||||
ClosePlaylist();
|
||||
else if (_Theme.ButtonPlaylistSing.Selected)
|
||||
_StartPlaylistSongs();
|
||||
else if (_Theme.ButtonPlaylistSave.Selected)
|
||||
CBase.Playlist.SavePlaylist(ActivePlaylistID);
|
||||
else if (_Theme.ButtonPlaylistDelete.Selected)
|
||||
{
|
||||
CBase.Playlist.DeletePlaylist(ActivePlaylistID);
|
||||
ClosePlaylist();
|
||||
EditMode = EEditMode.None;
|
||||
_Theme.ButtonPlaylistName.EditMode = false;
|
||||
}
|
||||
else if (_Theme.ButtonPlaylistName.Selected)
|
||||
{
|
||||
if (EditMode != EEditMode.PlaylistName)
|
||||
{
|
||||
EditMode = EEditMode.PlaylistName;
|
||||
_Theme.ButtonPlaylistName.EditMode = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
EditMode = EEditMode.None;
|
||||
_Theme.ButtonPlaylistName.EditMode = false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Keys.PageDown:
|
||||
_SetSelectionToLastEntry();
|
||||
break;
|
||||
case Keys.PageUp:
|
||||
_SetSelectionToFirstEntry();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -115,7 +115,7 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
private readonly List<SRectF> _ValueBounds = new List<SRectF>();
|
||||
|
||||
public bool WithTextures;
|
||||
public readonly bool WithTextures;
|
||||
|
||||
private int _Selection = -1;
|
||||
public int Selection
|
||||
|
||||
@@ -40,13 +40,13 @@ namespace VocaluxeLib.Menu
|
||||
public float Width;
|
||||
public float Height;
|
||||
|
||||
public STextPosition(int dummy)
|
||||
public STextPosition(float initVal)
|
||||
{
|
||||
X = 0f;
|
||||
Y = 0f;
|
||||
TextHeight = 0f;
|
||||
Width = 0f;
|
||||
Height = 0f;
|
||||
X = initVal;
|
||||
Y = initVal;
|
||||
TextHeight = initVal;
|
||||
Width = initVal;
|
||||
Height = initVal;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -95,10 +95,12 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
public enum EColorDepth
|
||||
{
|
||||
// ReSharper disable UnusedMember.Global
|
||||
Bit8 = 8,
|
||||
Bit16 = 16,
|
||||
Bit24 = 24,
|
||||
Bit32 = 32
|
||||
// ReSharper restore UnusedMember.Global
|
||||
}
|
||||
|
||||
public enum ETextureQuality
|
||||
@@ -339,4 +341,12 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
ScreenNull = -1
|
||||
}
|
||||
|
||||
public enum EPopupScreens
|
||||
{
|
||||
PopupPlayerControl = 0,
|
||||
PopupVolumeControl = 1,
|
||||
|
||||
NoPopup = -1
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace VocaluxeLib.Menu.SingNotes
|
||||
{
|
||||
@@ -572,19 +573,8 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
if (_Lines.Count == 0)
|
||||
return 0;
|
||||
|
||||
int startbeat = int.MaxValue;
|
||||
for (int i = 0; i < _Lines.Count; i++)
|
||||
{
|
||||
if (_Lines[i].FirstNoteBeat < startbeat)
|
||||
startbeat = _Lines[i].FirstNoteBeat;
|
||||
}
|
||||
|
||||
int endbeat = int.MinValue;
|
||||
for (int i = 0; i < _Lines.Count; i++)
|
||||
{
|
||||
if (_Lines[i].LastNoteBeat < endbeat)
|
||||
endbeat = _Lines[i].LastNoteBeat;
|
||||
}
|
||||
int startbeat = _Lines.Max(line => line.FirstNoteBeat);
|
||||
int endbeat = _Lines.Min(line => line.LastNoteBeat);
|
||||
|
||||
int result = endbeat - startbeat;
|
||||
if (result > 0)
|
||||
@@ -609,13 +599,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
{
|
||||
get
|
||||
{
|
||||
int num = 0;
|
||||
foreach (CLine line in _Lines)
|
||||
{
|
||||
if (line.Points > 0f)
|
||||
num++;
|
||||
}
|
||||
return num;
|
||||
return _Lines.Count(line => line.Points > 0f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -195,13 +195,13 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual void Reset()
|
||||
public void Reset()
|
||||
{
|
||||
_PlayerNotes.Clear();
|
||||
_ActID = 0;
|
||||
}
|
||||
|
||||
public virtual int AddPlayer(SRectF rect, SColorF color, int playerNr)
|
||||
public int AddPlayer(SRectF rect, SColorF color, int playerNr)
|
||||
{
|
||||
SPlayerNotes notes = new SPlayerNotes
|
||||
{
|
||||
@@ -224,9 +224,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
return notes.ID;
|
||||
}
|
||||
|
||||
public virtual void RemovePlayer(int id) {}
|
||||
|
||||
public virtual void AddLine(int id, CLine[] line, int lineNr, int player)
|
||||
public void AddLine(int id, CLine[] line, int lineNr)
|
||||
{
|
||||
if (line == null)
|
||||
return;
|
||||
@@ -238,11 +236,11 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
if (lineNr == _PlayerNotes[n].LineNr)
|
||||
return;
|
||||
|
||||
SPlayerNotes notes = _PlayerNotes[n];
|
||||
|
||||
if (line.Length <= lineNr)
|
||||
return;
|
||||
|
||||
SPlayerNotes notes = _PlayerNotes[n];
|
||||
|
||||
notes.Lines = line;
|
||||
notes.LineNr = lineNr;
|
||||
notes.GoldenStars.Clear();
|
||||
@@ -253,11 +251,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
_PlayerNotes.Add(notes);
|
||||
}
|
||||
|
||||
public virtual void RemoveLine(int id) {}
|
||||
|
||||
public virtual void AddNote(int id, CNote note) {}
|
||||
|
||||
public virtual void SetAlpha(int id, float alpha)
|
||||
public void SetAlpha(int id, float alpha)
|
||||
{
|
||||
int n = _FindPlayerLine(id);
|
||||
if (n == -1)
|
||||
@@ -268,7 +262,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
_PlayerNotes[n] = pn;
|
||||
}
|
||||
|
||||
public virtual float GetAlpha(int id)
|
||||
public float GetAlpha(int id)
|
||||
{
|
||||
int n = _FindPlayerLine(id);
|
||||
if (n == -1)
|
||||
@@ -277,12 +271,12 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
return _PlayerNotes[n].Alpha;
|
||||
}
|
||||
|
||||
public virtual void Draw(int id, int player)
|
||||
public void Draw(int id, int player)
|
||||
{
|
||||
Draw(id, null, player);
|
||||
}
|
||||
|
||||
public virtual void Draw(int id, List<CLine> singLine, int player)
|
||||
public void Draw(int id, List<CLine> singLine, int player)
|
||||
{
|
||||
int n = _FindPlayerLine(id);
|
||||
if (n == -1)
|
||||
@@ -463,9 +457,6 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
|
||||
private int _FindPlayerLine(int id)
|
||||
{
|
||||
if (id < 0 || id > _PlayerNotes.Count)
|
||||
return -1;
|
||||
|
||||
for (int i = 0; i < _PlayerNotes.Count; i++)
|
||||
{
|
||||
if (_PlayerNotes[i].ID == id)
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
|
||||
public class CCategory
|
||||
{
|
||||
public string Name = String.Empty;
|
||||
public readonly string Name;
|
||||
private STexture _CoverTextureSmall = new STexture(-1);
|
||||
private STexture _CoverTextureBig = new STexture(-1);
|
||||
private bool _CoverBigLoaded;
|
||||
@@ -100,7 +100,9 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
public float FadeInTime;
|
||||
public float FadeOutTime;
|
||||
|
||||
// ReSharper disable UnusedParameter.Local
|
||||
public SMedley(int dummy)
|
||||
// ReSharper restore UnusedParameter.Local
|
||||
{
|
||||
Source = EMedleySource.None;
|
||||
StartBeat = 0;
|
||||
@@ -210,11 +212,11 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
get { return Notes.Lines.Length > 1; }
|
||||
}
|
||||
|
||||
public List<string> Edition = new List<string>();
|
||||
public List<string> Genre = new List<string>();
|
||||
public readonly List<string> Edition = new List<string>();
|
||||
public readonly List<string> Genre = new List<string>();
|
||||
public string Year = "";
|
||||
|
||||
public List<string> Language = new List<string>();
|
||||
public readonly List<string> Language = new List<string>();
|
||||
|
||||
// Notes
|
||||
public readonly CNotes Notes = new CNotes();
|
||||
|
||||
@@ -95,7 +95,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
|
||||
abstract class CSongMenuFramework : ISongMenu
|
||||
{
|
||||
protected int _PartyModeID;
|
||||
protected readonly int _PartyModeID;
|
||||
protected SThemeSongMenu _Theme;
|
||||
private bool _ThemeLoaded;
|
||||
|
||||
@@ -164,7 +164,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void _SetSelectedNow()
|
||||
protected void _SetSelectedNow()
|
||||
{
|
||||
_Timer.Stop();
|
||||
_Timer.Reset();
|
||||
@@ -425,7 +425,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
_Initialized = true;
|
||||
}
|
||||
|
||||
public virtual void UpdateRect(SRectF rect)
|
||||
public void UpdateRect(SRectF rect)
|
||||
{
|
||||
_Rect = rect;
|
||||
Init();
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using VocaluxeLib.PartyModes;
|
||||
|
||||
@@ -180,15 +181,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
keyEvent.Key == Keys.PageDown || keyEvent.Key == Keys.PageUp))
|
||||
return;
|
||||
|
||||
bool sel = false;
|
||||
foreach (CStatic tile in _Tiles)
|
||||
{
|
||||
if (tile.Selected)
|
||||
{
|
||||
sel = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
bool sel = _Tiles.Any(tile => tile.Selected);
|
||||
|
||||
if ((_Locked == -1 || !sel) &&
|
||||
(keyEvent.Key != Keys.Escape && keyEvent.Key != Keys.Back && keyEvent.Key != Keys.PageUp && keyEvent.Key != Keys.PageDown))
|
||||
@@ -500,15 +493,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
|
||||
protected void _SetSelectedTile(int itemNr)
|
||||
{
|
||||
bool sel = false;
|
||||
foreach (CStatic tile in _Tiles)
|
||||
{
|
||||
if (tile.Selected)
|
||||
{
|
||||
sel = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
bool sel = _Tiles.Any(tile => tile.Selected);
|
||||
|
||||
if (_Locked == -1 || !sel)
|
||||
{
|
||||
|
||||
+25
-45
@@ -137,15 +137,15 @@ namespace VocaluxeLib.Menu
|
||||
#region Inputs
|
||||
public struct SKeyEvent
|
||||
{
|
||||
public ESender Sender;
|
||||
public bool ModAlt;
|
||||
public bool ModShift;
|
||||
public bool ModCtrl;
|
||||
public bool KeyPressed;
|
||||
public readonly ESender Sender;
|
||||
public readonly bool ModAlt;
|
||||
public readonly bool ModShift;
|
||||
public readonly bool ModCtrl;
|
||||
public readonly bool KeyPressed;
|
||||
public bool Handled;
|
||||
public Keys Key;
|
||||
public Char Unicode;
|
||||
public EModifier Mod;
|
||||
public readonly Char Unicode;
|
||||
public readonly EModifier Mod;
|
||||
|
||||
public SKeyEvent(ESender sender, bool alt, bool shift, bool ctrl, bool pressed, char unicode, Keys key)
|
||||
{
|
||||
@@ -171,27 +171,25 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
public struct SMouseEvent
|
||||
{
|
||||
public ESender Sender;
|
||||
public readonly ESender Sender;
|
||||
public bool Handled;
|
||||
public int X;
|
||||
public int Y;
|
||||
public bool LB; //left button click
|
||||
public bool LD; //left button double click
|
||||
public bool RB; //right button click
|
||||
public bool MB; //middle button click
|
||||
public readonly int X;
|
||||
public readonly int Y;
|
||||
public readonly bool LB; //left button click
|
||||
public readonly bool LD; //left button double click
|
||||
public readonly bool RB; //right button click
|
||||
public readonly bool MB; //middle button click
|
||||
|
||||
public bool LBH; //left button hold (when moving)
|
||||
public bool RBH; //right button hold (when moving)
|
||||
public bool MBH; //middle button hold (when moving)
|
||||
public readonly bool LBH; //left button hold (when moving)
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
public readonly bool RBH; //right button hold (when moving)
|
||||
public readonly bool MBH; //middle button hold (when moving)
|
||||
// ReSharper restore MemberCanBePrivate.Global
|
||||
|
||||
public bool ModAlt;
|
||||
public bool ModShift;
|
||||
public bool ModCtrl;
|
||||
public readonly EModifier Mod;
|
||||
public readonly int Wheel;
|
||||
|
||||
public EModifier Mod;
|
||||
public int Wheel;
|
||||
|
||||
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)
|
||||
public SMouseEvent(ESender sender, EModifier mod, int x, int y, bool lb, bool ld, bool rb, int wheel, bool lbh, bool rbh, bool mb, bool mbh)
|
||||
{
|
||||
Sender = sender;
|
||||
Handled = false;
|
||||
@@ -206,27 +204,7 @@ namespace VocaluxeLib.Menu
|
||||
RBH = rbh;
|
||||
MBH = mbh;
|
||||
|
||||
ModAlt = alt;
|
||||
ModShift = shift;
|
||||
ModCtrl = ctrl;
|
||||
|
||||
EModifier mAlt = EModifier.None;
|
||||
EModifier mShift = EModifier.None;
|
||||
EModifier mCtrl = EModifier.None;
|
||||
|
||||
if (alt)
|
||||
mAlt = EModifier.Alt;
|
||||
|
||||
if (shift)
|
||||
mShift = EModifier.Shift;
|
||||
|
||||
if (ctrl)
|
||||
mCtrl = EModifier.Ctrl;
|
||||
|
||||
if (!alt && !shift && !ctrl)
|
||||
Mod = EModifier.None;
|
||||
else
|
||||
Mod = mAlt | mShift | mCtrl;
|
||||
Mod = mod;
|
||||
|
||||
Wheel = wheel;
|
||||
}
|
||||
@@ -250,7 +228,9 @@ namespace VocaluxeLib.Menu
|
||||
public string FileName;
|
||||
public STexture Texture;
|
||||
|
||||
// ReSharper disable UnusedParameter.Local
|
||||
public SAvatar(int dummy)
|
||||
// ReSharper restore UnusedParameter.Local
|
||||
{
|
||||
FileName = String.Empty;
|
||||
Texture = new STexture(-1);
|
||||
|
||||
Reference in new issue
Block a user