Merge branch 'develop' of https://github.com/Vocaluxe/Vocaluxe into develop
This commit is contained in:
commit
51dc4391bd
88 files changed
+2095
-1869
No files matched your search
+114
-165
@@ -18,7 +18,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using VocaluxeLib;
|
||||
using VocaluxeLib.Songs;
|
||||
using VocaluxeLib.Draw;
|
||||
@@ -30,12 +29,12 @@ namespace Vocaluxe.Base
|
||||
{
|
||||
private static bool _Initialized;
|
||||
|
||||
private static CSongPlayer _SongPlayer;
|
||||
private static CSongPlayer _PreviewPlayer;
|
||||
private static readonly CSongPlayer _BGPlayer = new CSongPlayer();
|
||||
private static readonly CSongPlayer _PreviewPlayer = new CSongPlayer(true);
|
||||
private static CSongPlayer _CurPlayer;
|
||||
|
||||
private static bool _OwnSongsAvailable;
|
||||
private static EBackgroundMusicSource _MusicSource;
|
||||
private static bool _VideoEnabled;
|
||||
|
||||
private static CPlaylistElement _CurrentPlaylistElement; //Currently played music
|
||||
private static int _PreviousMusicIndex = -1;
|
||||
@@ -47,29 +46,20 @@ namespace Vocaluxe.Base
|
||||
private static bool _OwnMusicAdded;
|
||||
private static bool _BackgroundMusicAdded;
|
||||
private static bool _Disabled;
|
||||
private static bool _PlaysPreview;
|
||||
|
||||
public static bool VideoEnabled
|
||||
{
|
||||
get { return _PlaysPreview ? _PreviewPlayer.VideoEnabled : _SongPlayer.VideoEnabled; }
|
||||
set
|
||||
{
|
||||
if (_PlaysPreview)
|
||||
_PreviewPlayer.VideoEnabled = value;
|
||||
else
|
||||
_SongPlayer.VideoEnabled = value;
|
||||
}
|
||||
get { return _CurPlayer.VideoEnabled; }
|
||||
set { _CurPlayer.VideoEnabled = value; }
|
||||
}
|
||||
|
||||
public static bool CanSing
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_PlaysPreview)
|
||||
if (IsPlayingPreview)
|
||||
return false;
|
||||
if (_BGMusicFiles.Contains(_CurrentPlaylistElement))
|
||||
return false;
|
||||
return true;
|
||||
return !_BGMusicFiles.Contains(_CurrentPlaylistElement);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,54 +71,63 @@ namespace Vocaluxe.Base
|
||||
if (Disabled == value)
|
||||
return;
|
||||
_Disabled = value;
|
||||
Pause();
|
||||
if (_Disabled)
|
||||
Pause();
|
||||
else
|
||||
Play();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Repeat the background song (preview songs are always repeating!)
|
||||
/// </summary>
|
||||
public static bool RepeatSong
|
||||
{
|
||||
get { return _SongPlayer.RepeatSong; }
|
||||
set { _SongPlayer.RepeatSong = value; }
|
||||
get { return _BGPlayer.Loop; }
|
||||
set { _BGPlayer.Loop = value; }
|
||||
}
|
||||
|
||||
public static int SongID
|
||||
{
|
||||
get { return _SongPlayer.SongID; }
|
||||
get { return _CurPlayer.SongID; }
|
||||
}
|
||||
|
||||
public static bool SongHasVideo
|
||||
{
|
||||
get { return _SongPlayer.SongHasVideo; }
|
||||
get { return _CurPlayer.SongHasVideo; }
|
||||
}
|
||||
|
||||
public static bool IsPlaying
|
||||
{
|
||||
get { return _PlaysPreview ? _PreviewPlayer.IsPlaying : _SongPlayer.IsPlaying; }
|
||||
get { return _CurPlayer.IsPlaying; }
|
||||
}
|
||||
|
||||
public static bool IsPlayingPreview
|
||||
{
|
||||
get { return _PlaysPreview; }
|
||||
get { return _CurPlayer == _PreviewPlayer; }
|
||||
set
|
||||
{
|
||||
if (IsPlayingPreview == value)
|
||||
return;
|
||||
Pause();
|
||||
_CurPlayer = value ? _PreviewPlayer : _BGPlayer;
|
||||
Play();
|
||||
}
|
||||
}
|
||||
|
||||
public static string ArtistAndTitle
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_PlaysPreview)
|
||||
return _PreviewPlayer.ArtistAndTitle;
|
||||
return _BGMusicFiles.Contains(_CurrentPlaylistElement) ? Path.GetFileNameWithoutExtension(_CurrentPlaylistElement.MusicFilePath) : _SongPlayer.ArtistAndTitle;
|
||||
}
|
||||
get { return _CurPlayer.ArtistAndTitle; }
|
||||
}
|
||||
|
||||
public static float Length
|
||||
{
|
||||
get { return _PlaysPreview ? _PreviewPlayer.Length : _SongPlayer.Length; }
|
||||
get { return _CurPlayer.Length; }
|
||||
}
|
||||
|
||||
public static CTextureRef Cover
|
||||
{
|
||||
get { return _PlaysPreview ? _PreviewPlayer.Cover : _SongPlayer.Cover; }
|
||||
get { return _CurPlayer.Cover; }
|
||||
}
|
||||
|
||||
//Use this to set whether own songs are available for access
|
||||
@@ -160,21 +159,15 @@ namespace Vocaluxe.Base
|
||||
_MusicSource = EBackgroundMusicSource.TR_CONFIG_NO_OWN_MUSIC;
|
||||
_AddBackgroundMusic();
|
||||
|
||||
_SongPlayer = new CSongPlayer();
|
||||
|
||||
_PreviewPlayer = new CSongPlayer {RepeatSong = true};
|
||||
|
||||
_VideoEnabled = (CConfig.Config.Video.VideoBackgrounds == EOffOn.TR_CONFIG_ON && CConfig.Config.Video.VideosToBackground == EOffOn.TR_CONFIG_ON);
|
||||
SetMusicSource(CConfig.Config.Sound.BackgroundMusicSource);
|
||||
_CurPlayer = _BGPlayer;
|
||||
_Initialized = true;
|
||||
}
|
||||
|
||||
public static void Close()
|
||||
{
|
||||
if (_SongPlayer != null)
|
||||
_SongPlayer.Stop();
|
||||
if (_PreviewPlayer != null)
|
||||
_PreviewPlayer.Stop();
|
||||
_BGPlayer.Close();
|
||||
_PreviewPlayer.Close();
|
||||
|
||||
_BGMusicFiles.Clear();
|
||||
_NotPlayedFiles.Clear();
|
||||
@@ -185,124 +178,88 @@ namespace Vocaluxe.Base
|
||||
|
||||
public static void Play()
|
||||
{
|
||||
if (IsPlaying || (CConfig.Config.Sound.BackgroundMusic != EBackgroundMusicOffOn.TR_CONFIG_ON && !_PlaysPreview))
|
||||
if (!IsPlayingPreview && CConfig.Config.Sound.BackgroundMusic == EBackgroundMusicOffOn.TR_CONFIG_OFF)
|
||||
return;
|
||||
|
||||
if (_PlaysPreview)
|
||||
_PreviewPlayer.Play();
|
||||
else if (CConfig.Config.Sound.BackgroundMusic == EBackgroundMusicOffOn.TR_CONFIG_ON)
|
||||
{
|
||||
if (_SongPlayer.SongLoaded)
|
||||
//Resume
|
||||
_SongPlayer.TogglePause();
|
||||
else
|
||||
Next();
|
||||
}
|
||||
if (IsPlayingPreview || _BGPlayer.SoundLoaded)
|
||||
_CurPlayer.Play();
|
||||
else
|
||||
Next();
|
||||
}
|
||||
|
||||
public static void Stop()
|
||||
{
|
||||
if (!IsPlaying)
|
||||
return;
|
||||
|
||||
if (_PlaysPreview)
|
||||
{
|
||||
_PreviewPlayer.Stop();
|
||||
_PlaysPreview = false;
|
||||
Pause();
|
||||
CSound.SetGlobalVolume(CConfig.BackgroundMusicVolume);
|
||||
}
|
||||
else
|
||||
{
|
||||
_SongPlayer.Stop();
|
||||
_CurPlayer.Stop();
|
||||
if (!IsPlayingPreview)
|
||||
_CurrentPlaylistElement = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void Pause()
|
||||
{
|
||||
if (_PlaysPreview)
|
||||
{
|
||||
if (!_PreviewPlayer.SongLoaded)
|
||||
return;
|
||||
_PreviewPlayer.TogglePause();
|
||||
}
|
||||
else if (CConfig.Config.Sound.BackgroundMusic == EBackgroundMusicOffOn.TR_CONFIG_ON)
|
||||
{
|
||||
if (!_SongPlayer.SongLoaded)
|
||||
Next();
|
||||
else
|
||||
_SongPlayer.TogglePause();
|
||||
}
|
||||
_CurPlayer.Pause();
|
||||
}
|
||||
|
||||
public static void Next()
|
||||
{
|
||||
if (!_PlaysPreview)
|
||||
if (IsPlayingPreview)
|
||||
return;
|
||||
|
||||
Stop(); //stop last song if any
|
||||
if (_PreviousMusicIndex < _PreviousFiles.Count - 2)
|
||||
{
|
||||
Stop(); //stop last song if any
|
||||
if (_PreviousMusicIndex < _PreviousFiles.Count - 2)
|
||||
{
|
||||
//We are in the previous list and next element exists
|
||||
_PreviousMusicIndex++;
|
||||
_CurrentPlaylistElement = _PreviousFiles[_PreviousMusicIndex];
|
||||
}
|
||||
else
|
||||
{
|
||||
//We are not in the previous list (anymore)
|
||||
if (_NotPlayedFiles.Count == 0)
|
||||
{
|
||||
if (_PreviousFiles.Count == 0)
|
||||
return; //No songs to play
|
||||
_NotPlayedFiles.AddRange(_PreviousFiles);
|
||||
}
|
||||
|
||||
_CurrentPlaylistElement = _NotPlayedFiles[CGame.Rand.Next(_NotPlayedFiles.Count)];
|
||||
_NotPlayedFiles.Remove(_CurrentPlaylistElement);
|
||||
|
||||
_PreviousFiles.Add(_CurrentPlaylistElement);
|
||||
_PreviousMusicIndex = _PreviousFiles.Count - 1;
|
||||
}
|
||||
_StartSong();
|
||||
//We are in the previous list and next element exists
|
||||
_PreviousMusicIndex++;
|
||||
_CurrentPlaylistElement = _PreviousFiles[_PreviousMusicIndex];
|
||||
}
|
||||
else
|
||||
{
|
||||
//We are not in the previous list (anymore)
|
||||
if (_NotPlayedFiles.Count == 0)
|
||||
{
|
||||
if (_PreviousFiles.Count == 0)
|
||||
return; //No songs to play
|
||||
_NotPlayedFiles.AddRange(_PreviousFiles);
|
||||
}
|
||||
|
||||
_CurrentPlaylistElement = _NotPlayedFiles[CGame.Rand.Next(_NotPlayedFiles.Count)];
|
||||
_NotPlayedFiles.Remove(_CurrentPlaylistElement);
|
||||
|
||||
_PreviousFiles.Add(_CurrentPlaylistElement);
|
||||
_PreviousMusicIndex = _PreviousFiles.Count - 1;
|
||||
}
|
||||
_StartSong();
|
||||
}
|
||||
|
||||
public static void Previous()
|
||||
{
|
||||
if (!_PlaysPreview)
|
||||
{
|
||||
if (_PreviousMusicIndex < 0)
|
||||
return;
|
||||
Debug.Assert(_CurrentPlaylistElement != null);
|
||||
if (_SongPlayer.Position <= 1.5f && _PreviousMusicIndex > 0)
|
||||
{
|
||||
Stop(); //stop last song
|
||||
_PreviousMusicIndex--;
|
||||
if (IsPlayingPreview)
|
||||
return;
|
||||
if (_PreviousMusicIndex < 0)
|
||||
return;
|
||||
|
||||
_CurrentPlaylistElement = _PreviousFiles[_PreviousMusicIndex];
|
||||
}
|
||||
_StartSong();
|
||||
if (_CurrentPlaylistElement == null || (_BGPlayer.Position <= 1.5f && _PreviousMusicIndex > 0))
|
||||
{
|
||||
Stop(); //stop last song
|
||||
_PreviousMusicIndex--;
|
||||
|
||||
_CurrentPlaylistElement = _PreviousFiles[_PreviousMusicIndex];
|
||||
}
|
||||
_StartSong();
|
||||
}
|
||||
|
||||
public static void Update()
|
||||
{
|
||||
if (!IsPlaying && (!_SongPlayer.SongLoaded || !_PreviewPlayer.SongLoaded))
|
||||
if (!IsPlaying)
|
||||
return;
|
||||
|
||||
if (_PlaysPreview)
|
||||
_PreviewPlayer.Update();
|
||||
else
|
||||
{
|
||||
_SongPlayer.Update();
|
||||
if (_SongPlayer.IsFinished)
|
||||
Next();
|
||||
}
|
||||
_CurPlayer.Update();
|
||||
if (!IsPlayingPreview && _BGPlayer.IsFinished)
|
||||
Next();
|
||||
}
|
||||
|
||||
public static CTextureRef GetVideoTexture()
|
||||
{
|
||||
return _PlaysPreview ? _PreviewPlayer.GetVideoTexture() : _SongPlayer.GetVideoTexture();
|
||||
return _CurPlayer.GetVideoTexture();
|
||||
}
|
||||
|
||||
public static void SetMusicSource(EBackgroundMusicSource source)
|
||||
@@ -328,54 +285,42 @@ namespace Vocaluxe.Base
|
||||
}
|
||||
}
|
||||
|
||||
public static void LoadPreview(CSong song, float start = 0f)
|
||||
public static void LoadPreview(CSong song, float start = -1f)
|
||||
{
|
||||
if (!_PlaysPreview)
|
||||
Pause();
|
||||
else
|
||||
StopPreview();
|
||||
|
||||
if (song == null)
|
||||
return;
|
||||
throw new ArgumentNullException("song");
|
||||
|
||||
// ReSharper disable CompareOfFloatsByEqualityOperator
|
||||
if (start == 0f)
|
||||
start = song.Preview.StartTime;
|
||||
// ReSharper restore CompareOfFloatsByEqualityOperator
|
||||
if (!IsPlayingPreview)
|
||||
{
|
||||
Pause();
|
||||
_CurPlayer = _PreviewPlayer;
|
||||
CSound.SetGlobalVolume(CConfig.PreviewMusicVolume);
|
||||
}
|
||||
|
||||
_PlaysPreview = true;
|
||||
CSound.SetGlobalVolume(CConfig.PreviewMusicVolume);
|
||||
_PreviewPlayer.Load(song, start);
|
||||
|
||||
float startposition = song.Preview.StartTime;
|
||||
_PreviewPlayer.Load(song);
|
||||
|
||||
float length = _PreviewPlayer.Length;
|
||||
if (length < 1)
|
||||
length = 30; // If length is unknow or invalid assume a length of 30s
|
||||
|
||||
if (song.Preview.Source == EDataSource.None)
|
||||
startposition = length / 4f;
|
||||
else if (startposition > length - 5f)
|
||||
startposition = Math.Max(0f, Math.Min(length / 4f, length - 5f));
|
||||
if (start < 0)
|
||||
start = (song.Preview.Source == EDataSource.None) ? length / 4f : song.Preview.StartTime;
|
||||
if (start > length - 5f)
|
||||
start = Math.Max(0f, Math.Min(length / 4f, length - 5f));
|
||||
if (start >= 0.5f)
|
||||
start -= 0.5f;
|
||||
|
||||
if (startposition >= 0.5f)
|
||||
startposition -= 0.5f;
|
||||
|
||||
_PreviewPlayer.Position = startposition;
|
||||
|
||||
Play();
|
||||
}
|
||||
|
||||
public static void PlayPreview(float start = -1f)
|
||||
{
|
||||
if (start > -1f)
|
||||
_PreviewPlayer.Position = start;
|
||||
_PreviewPlayer.Position = start;
|
||||
|
||||
Play();
|
||||
}
|
||||
|
||||
public static void StopPreview()
|
||||
{
|
||||
_PreviewPlayer.Stop();
|
||||
_PlaysPreview = false;
|
||||
if (!IsPlayingPreview)
|
||||
return;
|
||||
Stop();
|
||||
_CurPlayer = _BGPlayer;
|
||||
CSound.SetGlobalVolume(CConfig.BackgroundMusicVolume);
|
||||
}
|
||||
|
||||
@@ -387,19 +332,23 @@ namespace Vocaluxe.Base
|
||||
Debug.Assert(_CurrentPlaylistElement != null);
|
||||
|
||||
//If current song same as loaded restart only
|
||||
if (_CurrentPlaylistElement.SongID == _SongPlayer.SongID && _SongPlayer.SongLoaded)
|
||||
_SongPlayer.Play();
|
||||
if (_BGPlayer.SoundLoaded && _CurrentPlaylistElement.MusicFilePath == _BGPlayer.FilePath)
|
||||
{
|
||||
_BGPlayer.Stop();
|
||||
_BGPlayer.Play();
|
||||
return;
|
||||
}
|
||||
|
||||
//otherwhise load
|
||||
if (_BGMusicFiles.Contains(_CurrentPlaylistElement))
|
||||
_SongPlayer.LoadFile(_CurrentPlaylistElement.MusicFilePath, 0f, true);
|
||||
if (!_CurrentPlaylistElement.HasMetaData)
|
||||
_BGPlayer.Load(_CurrentPlaylistElement.MusicFilePath, 0f, true);
|
||||
else
|
||||
{
|
||||
//Seek to #Start-Tag, if found
|
||||
float start = 0f;
|
||||
if (_CurrentPlaylistElement.Start > 0.001 && CConfig.Config.Sound.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON)
|
||||
start = _CurrentPlaylistElement.Start;
|
||||
_SongPlayer.Load(CBase.Songs.GetSongByID(_CurrentPlaylistElement.SongID), start, true);
|
||||
_BGPlayer.Load(_CurrentPlaylistElement.Song, start, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -145,7 +145,7 @@ namespace Vocaluxe.Base
|
||||
[DefaultValue(EOffOn.TR_CONFIG_ON)] public EOffOn VideoPreview;
|
||||
[DefaultValue(EOffOn.TR_CONFIG_ON)] public EOffOn VideosInSongs;
|
||||
[DefaultValue(EOffOn.TR_CONFIG_OFF)] public EOffOn VideosToBackground;
|
||||
[DefaultValue(EWebcamLib.OpenCV)] public EWebcamLib WebcamLib;
|
||||
[DefaultValue(EWebcamLib.AForgeNet)] public EWebcamLib WebcamLib;
|
||||
public SWebcamConfig? WebcamConfig;
|
||||
}
|
||||
|
||||
@@ -348,8 +348,14 @@ namespace Vocaluxe.Base
|
||||
};
|
||||
}
|
||||
|
||||
private static readonly List<string> _CommentsGot = new List<string>();
|
||||
|
||||
private static string _GetComment(string elName)
|
||||
{
|
||||
// Avoid multiple comments (e.g. for array entries)
|
||||
if (_CommentsGot.Contains(elName))
|
||||
return null;
|
||||
_CommentsGot.Add(elName);
|
||||
switch (elName)
|
||||
{
|
||||
case "DebugLevel":
|
||||
@@ -419,7 +425,7 @@ namespace Vocaluxe.Base
|
||||
case "Language":
|
||||
return "Game-Language";
|
||||
case "SongFolder":
|
||||
return "SongFolder: SongFolder1, SongFolder2, SongFolder3, ...";
|
||||
return "SongFolder: Add each song folder in a seperate SongFolder entry";
|
||||
case "SongMenu":
|
||||
return "SongMenu: " + CHelper.ListStrings(Enum.GetNames(typeof(ESongMenu)));
|
||||
case "SongSorting":
|
||||
@@ -467,6 +473,7 @@ namespace Vocaluxe.Base
|
||||
|
||||
public static void SaveConfig()
|
||||
{
|
||||
_CommentsGot.Clear();
|
||||
var xml = new CXmlSerializer(true, _GetComment);
|
||||
xml.Serialize(_FileConfig, Config);
|
||||
}
|
||||
|
||||
+26
-15
@@ -17,6 +17,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
@@ -40,10 +41,10 @@ namespace Vocaluxe.Base
|
||||
|
||||
public static CTextureRef NoCover { get; private set; }
|
||||
|
||||
public static void Init()
|
||||
public static bool Init()
|
||||
{
|
||||
_LoadCoverThemes();
|
||||
_LoadCovers(CConfig.Config.Theme.CoverTheme);
|
||||
return _CoverThemes.Count != 0 && _LoadCovers();
|
||||
}
|
||||
|
||||
public static void Close()
|
||||
@@ -91,7 +92,10 @@ namespace Vocaluxe.Base
|
||||
|
||||
public static CTextureRef GenerateCover(string text, ECoverGeneratorType type, CSong firstSong)
|
||||
{
|
||||
CTextureRef texture = CDraw.CopyTexture(NoCover);
|
||||
CTextureRef texture = Cover(text);
|
||||
if (texture != NoCover)
|
||||
return texture;
|
||||
texture = CDraw.CopyTexture(NoCover);
|
||||
Task.Factory.StartNew(() =>
|
||||
{
|
||||
_CancelToken.Token.ThrowIfCancellationRequested();
|
||||
@@ -127,7 +131,7 @@ namespace Vocaluxe.Base
|
||||
public static void ReloadCovers()
|
||||
{
|
||||
_UnloadCovers();
|
||||
_LoadCovers(CConfig.Config.Theme.CoverTheme);
|
||||
_LoadCovers();
|
||||
}
|
||||
|
||||
private static void _UnloadCovers()
|
||||
@@ -150,14 +154,15 @@ namespace Vocaluxe.Base
|
||||
/// <summary>
|
||||
/// Returns a SCoverTheme by cover-theme-name
|
||||
/// </summary>
|
||||
private static SThemeCover _CoverTheme(string coverThemeName)
|
||||
private static SThemeCover _GetCoverTheme()
|
||||
{
|
||||
for (int i = 0; i < _CoverThemes.Count; i++)
|
||||
int index = GetCoverThemeIndex();
|
||||
if (index < 0)
|
||||
{
|
||||
if (_CoverThemes[i].Info.Name == coverThemeName)
|
||||
return _CoverThemes[i];
|
||||
index = 0;
|
||||
CConfig.Config.Theme.CoverTheme = _CoverThemes[0].Info.Name;
|
||||
}
|
||||
return new SThemeCover();
|
||||
return _CoverThemes[index];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -184,7 +189,7 @@ namespace Vocaluxe.Base
|
||||
continue;
|
||||
}
|
||||
|
||||
if (theme.Info.Folder != "" && theme.Info.Name != "")
|
||||
if (!String.IsNullOrEmpty(theme.Info.Folder) && !String.IsNullOrEmpty(theme.Info.Name))
|
||||
{
|
||||
theme.FolderPath = Path.Combine(folderPath, theme.Info.Folder);
|
||||
_CoverThemes.Add(theme);
|
||||
@@ -195,12 +200,11 @@ namespace Vocaluxe.Base
|
||||
/// <summary>
|
||||
/// Loads all covers from the theme
|
||||
/// </summary>
|
||||
private static void _LoadCovers(string coverThemeName)
|
||||
private static bool _LoadCovers()
|
||||
{
|
||||
SThemeCover coverTheme = _CoverTheme(coverThemeName);
|
||||
SThemeCover coverTheme = _GetCoverTheme();
|
||||
|
||||
if (String.IsNullOrEmpty(coverTheme.Info.Name))
|
||||
return;
|
||||
Debug.Assert(!String.IsNullOrEmpty(coverTheme.Info.Name));
|
||||
|
||||
List<string> files = CHelper.ListImageFiles(coverTheme.FolderPath, true, true);
|
||||
|
||||
@@ -213,9 +217,16 @@ namespace Vocaluxe.Base
|
||||
else if (_CoverExists(_NoCoverNameAlt))
|
||||
NoCover = _Covers[_NoCoverNameAlt];
|
||||
else
|
||||
CBase.Log.LogError("Covertheme \"" + coverThemeName + "\" does not include a cover file named \"" + _NoCoverName + "\" and cannot be used!", true, true);
|
||||
{
|
||||
CBase.Log.LogError("Covertheme \"" + coverTheme.Info.Name + "\" does not include a cover file named \"" + _NoCoverName + "\" and cannot be used!", true, true);
|
||||
_UnloadCovers();
|
||||
// Remove current theme and recursively try the other themes
|
||||
_CoverThemes.Remove(coverTheme);
|
||||
return _CoverThemes.Count > 0 && _LoadCovers();
|
||||
}
|
||||
}
|
||||
_LoadCoverGenerators(coverTheme);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static ECoverGeneratorType _SongSortingToType(ESongSorting sorting)
|
||||
|
||||
@@ -75,37 +75,46 @@ namespace Vocaluxe.Base
|
||||
|
||||
public static bool GetDataBaseSongInfos(string artist, string title, out int numPlayed, out DateTime dateAdded, out int highscoreID)
|
||||
{
|
||||
if (_HighscoreDB == null)
|
||||
{
|
||||
numPlayed = 0;
|
||||
dateAdded = new DateTime();
|
||||
highscoreID = 0;
|
||||
return false;
|
||||
}
|
||||
return _HighscoreDB.GetDataBaseSongInfos(artist, title, out numPlayed, out dateAdded, out highscoreID);
|
||||
}
|
||||
|
||||
public static List<SDBScoreEntry> LoadScore(int songID, EGameMode gameMode)
|
||||
{
|
||||
return _HighscoreDB.LoadScore(songID, gameMode);
|
||||
return _HighscoreDB == null ? null : _HighscoreDB.LoadScore(songID, gameMode);
|
||||
}
|
||||
|
||||
public static int AddScore(SPlayer player)
|
||||
{
|
||||
return _HighscoreDB.AddScore(player);
|
||||
return _HighscoreDB == null ? -1 : _HighscoreDB.AddScore(player);
|
||||
}
|
||||
|
||||
public static void IncreaseSongCounter(int dataBaseSongID)
|
||||
{
|
||||
_HighscoreDB.IncreaseSongCounter(dataBaseSongID);
|
||||
if (_HighscoreDB != null)
|
||||
_HighscoreDB.IncreaseSongCounter(dataBaseSongID);
|
||||
}
|
||||
|
||||
public static bool GetCover(string fileName, ref CTextureRef tex, int maxSize)
|
||||
{
|
||||
return _CoverDB.GetCover(fileName, ref tex, maxSize);
|
||||
return _CoverDB != null && _CoverDB.GetCover(fileName, ref tex, maxSize);
|
||||
}
|
||||
|
||||
public static void CommitCovers()
|
||||
{
|
||||
_CoverDB.CommitCovers();
|
||||
if (_CoverDB != null)
|
||||
_CoverDB.CommitCovers();
|
||||
}
|
||||
|
||||
public static bool GetCreditsRessource(string fileName, ref CTextureRef tex)
|
||||
{
|
||||
return _ResourceDB.GetCreditsRessource(fileName, ref tex);
|
||||
return _ResourceDB != null && _ResourceDB.GetCreditsRessource(fileName, ref tex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -224,16 +224,18 @@ namespace Vocaluxe.Base
|
||||
NextScreen.ProcessMouseMove(_Cursor.X, _Cursor.Y);
|
||||
|
||||
HidePopup(EPopupScreens.PopupPlayerControl);
|
||||
if (NextScreen.CurrentMusicType != EMusicType.Background && NextScreen.CurrentMusicType != EMusicType.Preview)
|
||||
CBackgroundMusic.Disabled = true;
|
||||
}
|
||||
|
||||
if (_Fading != null)
|
||||
{
|
||||
Debug.Assert(NextScreen != null);
|
||||
bool finished;
|
||||
float newAlpha = _Fading.GetValue(out finished);
|
||||
|
||||
if (!finished)
|
||||
{
|
||||
GlobalAlpha = 1f;
|
||||
ZOffset = CSettings.ZFar / 2;
|
||||
_DrawScreen(CurrentScreen);
|
||||
|
||||
@@ -242,6 +244,9 @@ namespace Vocaluxe.Base
|
||||
_DrawScreen(NextScreen);
|
||||
|
||||
GlobalAlpha = 1f;
|
||||
int oldVol = CConfig.GetVolumeByType(CurrentScreen.CurrentMusicType);
|
||||
int newVol = CConfig.GetVolumeByType(NextScreen.CurrentMusicType);
|
||||
CSound.SetGlobalVolume((int)((newVol - oldVol) * newAlpha + oldVol));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -274,6 +279,11 @@ namespace Vocaluxe.Base
|
||||
NextScreen = null;
|
||||
CurrentScreen.OnShowFinish();
|
||||
CSound.SetGlobalVolume(CConfig.GetVolumeByType(CurrentScreen.CurrentMusicType));
|
||||
if (CurrentScreen.CurrentMusicType == EMusicType.Background || CurrentScreen.CurrentMusicType == EMusicType.Preview)
|
||||
{
|
||||
CBackgroundMusic.Disabled = false;
|
||||
CBackgroundMusic.IsPlayingPreview = CurrentScreen.CurrentMusicType == EMusicType.Preview;
|
||||
}
|
||||
_Fading = null;
|
||||
}
|
||||
|
||||
@@ -305,8 +315,8 @@ namespace Vocaluxe.Base
|
||||
{
|
||||
if (screen == null)
|
||||
throw new ArgumentNullException("screen");
|
||||
Debug.Assert(NextScreen==null || NextScreen!=screen, "Don't fade to currently fading screen!");
|
||||
if(screen==NextScreen)
|
||||
Debug.Assert(NextScreen == null || NextScreen != screen, "Don't fade to currently fading screen!");
|
||||
if (screen == NextScreen)
|
||||
return;
|
||||
// Make sure the last screen change is done
|
||||
_FinishScreenFading();
|
||||
@@ -348,7 +358,7 @@ namespace Vocaluxe.Base
|
||||
SKeyEvent inputKeyEvent = new SKeyEvent();
|
||||
SMouseEvent inputMouseEvent = new SMouseEvent();
|
||||
|
||||
bool popupPlayerControlAllowed = CurrentScreen.CurrentMusicType == EMusicType.Background && !CBackgroundMusic.Disabled;
|
||||
bool popupPlayerControlAllowed = CurrentScreen.CurrentMusicType == EMusicType.Background;
|
||||
bool popupVolumeControlAllowed = CurrentScreen.CurrentMusicType != EMusicType.None;
|
||||
//Hide volume control for bg-music if bg-music is disabled
|
||||
if (popupVolumeControlAllowed && CurrentScreen.CurrentMusicType == EMusicType.Background && CConfig.Config.Sound.BackgroundMusic == EBackgroundMusicOffOn.TR_CONFIG_OFF)
|
||||
|
||||
+11
-6
@@ -355,21 +355,21 @@ namespace Vocaluxe.Base
|
||||
CBackgroundMusic.Stop();
|
||||
}
|
||||
|
||||
public void LoadPreview(CSong song, float start = 0f)
|
||||
public void LoadPreview(CSong song, float start = -1f)
|
||||
{
|
||||
CBackgroundMusic.LoadPreview(song, start);
|
||||
}
|
||||
|
||||
public void PlayPreview(float start = -1f)
|
||||
{
|
||||
CBackgroundMusic.PlayPreview(start);
|
||||
}
|
||||
|
||||
public void StopPreview()
|
||||
{
|
||||
CBackgroundMusic.StopPreview();
|
||||
}
|
||||
|
||||
public void SetPlayingPreview(bool playPreview)
|
||||
{
|
||||
CBackgroundMusic.IsPlayingPreview = playPreview;
|
||||
}
|
||||
|
||||
public CTextureRef GetVideoTexture()
|
||||
{
|
||||
return CBackgroundMusic.GetVideoTexture();
|
||||
@@ -877,6 +877,11 @@ namespace Vocaluxe.Base
|
||||
{
|
||||
CSound.SetGlobalVolume(volume);
|
||||
}
|
||||
|
||||
public bool IsPaused(int streamID)
|
||||
{
|
||||
return CSound.IsPaused(streamID);
|
||||
}
|
||||
}
|
||||
|
||||
class CBcover : ICover
|
||||
|
||||
+53
-43
@@ -18,6 +18,7 @@
|
||||
using System;
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using Vocaluxe.Base.ThemeSystem;
|
||||
@@ -32,40 +33,52 @@ namespace Vocaluxe.Base
|
||||
{
|
||||
private const int _PartyModeSystemVersion = 1;
|
||||
|
||||
private static Dictionary<int, SPartyMode> _PartyModes;
|
||||
private static readonly Dictionary<int, SPartyMode> _PartyModes = new Dictionary<int, SPartyMode>();
|
||||
private static int _NextID;
|
||||
|
||||
private static int _NormalGameModeID;
|
||||
private static SPartyMode _CurrentPartyMode;
|
||||
private static IPartyMode _CurrentPartyMode;
|
||||
|
||||
#region public stuff
|
||||
public static void Init()
|
||||
public static bool Init()
|
||||
{
|
||||
_PartyModes = new Dictionary<int, SPartyMode>();
|
||||
_NextID = 0;
|
||||
|
||||
//add dummy normal game mode and set it as default
|
||||
var pm = new SPartyMode {ScreenFiles = new List<string>(), PartyMode = new CPartyModeNone(_NextID++, null)};
|
||||
_NormalGameModeID = pm.PartyMode.ID;
|
||||
_PartyModes.Add(pm.PartyMode.ID, pm);
|
||||
_CurrentPartyMode = pm;
|
||||
if (_PartyModes.Count > 0)
|
||||
return false; //Already initialized
|
||||
SPartyMode pm = new SPartyMode
|
||||
{
|
||||
Info = new SPartyModeInfos {Author = "Vocaluxe Team", Description = "Normal game", Name = "Normal", TargetAudience = "Just a normal game for everyone"},
|
||||
PartyMode = new CPartyModeNormal(-1),
|
||||
PartyModeSystemVersion = _PartyModeSystemVersion,
|
||||
ScreenFiles = new List<string>()
|
||||
};
|
||||
_PartyModes.Add(-1, pm);
|
||||
_CurrentPartyMode = pm.PartyMode;
|
||||
Debug.Assert(_CurrentPartyMode != null && _CurrentPartyMode.ID == -1);
|
||||
|
||||
//load other party modes
|
||||
_LoadPartyModes();
|
||||
return _CurrentPartyMode.Init();
|
||||
}
|
||||
|
||||
public static int CurrentPartyModeID
|
||||
{
|
||||
get
|
||||
get { return _CurrentPartyMode.ID; }
|
||||
set
|
||||
{
|
||||
if (_CurrentPartyMode.PartyMode.ID != _NormalGameModeID)
|
||||
return _CurrentPartyMode.PartyMode.ID;
|
||||
|
||||
return -1;
|
||||
if (_CurrentPartyMode.ID == value)
|
||||
return;
|
||||
if (value != -1 && !_PartyModes.ContainsKey(value))
|
||||
throw new ArgumentException("Partymode with ID=" + value + " does not exist!");
|
||||
IPartyMode pm = _PartyModes[value].PartyMode;
|
||||
if (pm.Init())
|
||||
_CurrentPartyMode = pm;
|
||||
else
|
||||
{
|
||||
CLog.LogError("Could not init PartyMode \"" + _PartyModes[value].Info.Name + "\"! Removing...", true);
|
||||
_PartyModes.Remove(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static int NumModes
|
||||
public static int Count
|
||||
{
|
||||
get { return _PartyModes.Count; }
|
||||
}
|
||||
@@ -90,85 +103,81 @@ namespace Vocaluxe.Base
|
||||
|
||||
public static List<SPartyModeInfos> GetPartyModeInfos()
|
||||
{
|
||||
var infos = new List<SPartyModeInfos>();
|
||||
|
||||
foreach (KeyValuePair<int, SPartyMode> kvp in _PartyModes)
|
||||
List<SPartyModeInfos> list = new List<SPartyModeInfos>();
|
||||
foreach (SPartyMode pm in _PartyModes.Values)
|
||||
{
|
||||
if (kvp.Key != _NormalGameModeID)
|
||||
infos.Add(kvp.Value.Info);
|
||||
if (pm.PartyMode.ID >= 0)
|
||||
list.Add(pm.Info);
|
||||
}
|
||||
return infos;
|
||||
return list;
|
||||
}
|
||||
|
||||
public static void SetNormalGameMode()
|
||||
{
|
||||
CSongs.ResetPartySongSung();
|
||||
SetPartyMode(_NormalGameModeID);
|
||||
CurrentPartyModeID = -1;
|
||||
}
|
||||
|
||||
public static void SetPartyMode(int partyModeID)
|
||||
{
|
||||
if (!_PartyModes.TryGetValue(partyModeID, out _CurrentPartyMode))
|
||||
CLog.LogError("CParty: Can't find party mode ID: " + partyModeID);
|
||||
|
||||
_CurrentPartyMode.PartyMode.Init();
|
||||
CurrentPartyModeID = partyModeID;
|
||||
}
|
||||
#endregion public stuff
|
||||
|
||||
#region Interface
|
||||
public static void UpdateGame()
|
||||
{
|
||||
_CurrentPartyMode.PartyMode.UpdateGame();
|
||||
_CurrentPartyMode.UpdateGame();
|
||||
}
|
||||
|
||||
public static IMenu GetStartScreen()
|
||||
{
|
||||
return _CurrentPartyMode.PartyMode.GetStartScreen();
|
||||
return _CurrentPartyMode.GetStartScreen();
|
||||
}
|
||||
|
||||
public static SScreenSongOptions GetSongSelectionOptions()
|
||||
{
|
||||
return _CurrentPartyMode.PartyMode.GetScreenSongOptions();
|
||||
return _CurrentPartyMode.GetScreenSongOptions();
|
||||
}
|
||||
|
||||
public static void OnSongChange(int songIndex, ref SScreenSongOptions screenSongOptions)
|
||||
{
|
||||
_CurrentPartyMode.PartyMode.OnSongChange(songIndex, ref screenSongOptions);
|
||||
_CurrentPartyMode.OnSongChange(songIndex, ref screenSongOptions);
|
||||
}
|
||||
|
||||
public static void OnCategoryChange(int categoryIndex, ref SScreenSongOptions screenSongOptions)
|
||||
{
|
||||
_CurrentPartyMode.PartyMode.OnCategoryChange(categoryIndex, ref screenSongOptions);
|
||||
_CurrentPartyMode.OnCategoryChange(categoryIndex, ref screenSongOptions);
|
||||
}
|
||||
|
||||
public static void SetSearchString(string searchString, bool visible)
|
||||
{
|
||||
_CurrentPartyMode.PartyMode.SetSearchString(searchString, visible);
|
||||
_CurrentPartyMode.SetSearchString(searchString, visible);
|
||||
}
|
||||
|
||||
public static void JokerUsed(int teamNr)
|
||||
{
|
||||
_CurrentPartyMode.PartyMode.JokerUsed(teamNr);
|
||||
_CurrentPartyMode.JokerUsed(teamNr);
|
||||
}
|
||||
|
||||
public static void SongSelected(int songID)
|
||||
{
|
||||
_CurrentPartyMode.PartyMode.SongSelected(songID);
|
||||
_CurrentPartyMode.SongSelected(songID);
|
||||
}
|
||||
|
||||
public static void FinishedSinging()
|
||||
{
|
||||
_CurrentPartyMode.PartyMode.FinishedSinging();
|
||||
_CurrentPartyMode.FinishedSinging();
|
||||
}
|
||||
|
||||
public static void LeavingScore()
|
||||
{
|
||||
_CurrentPartyMode.PartyMode.LeavingScore();
|
||||
_CurrentPartyMode.LeavingScore();
|
||||
}
|
||||
|
||||
public static void LeavingHighscore()
|
||||
{
|
||||
_CurrentPartyMode.PartyMode.LeavingHighscore();
|
||||
_CurrentPartyMode.LeavingHighscore();
|
||||
}
|
||||
#endregion Interface
|
||||
|
||||
@@ -216,7 +225,7 @@ namespace Vocaluxe.Base
|
||||
return false;
|
||||
|
||||
object instance = output.CreateInstance(typeof(IPartyMode).Namespace + "." + pm.Info.Folder + "." + pm.Info.PartyModeFile, false,
|
||||
BindingFlags.Public | BindingFlags.Instance, null, new object[] {_NextID++, pathToPm}, null, null);
|
||||
BindingFlags.Public | BindingFlags.Instance, null, new object[] {_NextID++}, null, null);
|
||||
if (instance == null)
|
||||
{
|
||||
CLog.LogError("Error creating Instance of PartyMode file: " + filePath);
|
||||
@@ -258,7 +267,7 @@ namespace Vocaluxe.Base
|
||||
return false;
|
||||
}
|
||||
pm.PartyMode.LoadTheme();
|
||||
pm.Info.LoadData(pm.PartyMode);
|
||||
pm.Info.ExtInfo = pm.PartyMode;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -269,6 +278,7 @@ namespace Vocaluxe.Base
|
||||
|
||||
var compilerParams = new CompilerParameters();
|
||||
compilerParams.ReferencedAssemblies.Add("System.Windows.Forms.dll");
|
||||
compilerParams.ReferencedAssemblies.Add("System.dll");
|
||||
compilerParams.ReferencedAssemblies.Add("System.Core.dll");
|
||||
compilerParams.ReferencedAssemblies.Add("VocaluxeLib.dll");
|
||||
compilerParams.GenerateInMemory = true;
|
||||
|
||||
@@ -23,61 +23,70 @@ namespace Vocaluxe.Base
|
||||
{
|
||||
class CPlaylistElement
|
||||
{
|
||||
private readonly CSong _Song;
|
||||
public readonly CSong Song;
|
||||
private readonly string _MusicFilePath = String.Empty;
|
||||
|
||||
public bool HasMetaData
|
||||
{
|
||||
get { return Song != null; }
|
||||
}
|
||||
|
||||
public int SongID
|
||||
{
|
||||
get { return (_Song == null) ? -1 : _Song.ID; }
|
||||
get { return HasMetaData ? Song.ID : -1; }
|
||||
}
|
||||
|
||||
public string MusicFilePath
|
||||
{
|
||||
get { return _Song != null ? _Song.GetMP3() : _MusicFilePath; }
|
||||
get { return HasMetaData ? Song.GetMP3() : _MusicFilePath; }
|
||||
}
|
||||
|
||||
public string VideoFilePath
|
||||
{
|
||||
get { return _Song != null ? _Song.GetVideo() : string.Empty; }
|
||||
get { return HasMetaData ? Song.GetVideo() : string.Empty; }
|
||||
}
|
||||
|
||||
public string Title
|
||||
{
|
||||
get { return _Song != null ? _Song.Title : ""; }
|
||||
get { return HasMetaData ? Song.Title : ""; }
|
||||
}
|
||||
|
||||
public string Artist
|
||||
{
|
||||
get { return _Song != null ? _Song.Artist : ""; }
|
||||
get { return HasMetaData ? Song.Artist : ""; }
|
||||
}
|
||||
|
||||
public float Start
|
||||
{
|
||||
get { return _Song != null ? _Song.Start : 0f; }
|
||||
get { return HasMetaData ? Song.Start : 0f; }
|
||||
}
|
||||
|
||||
public float Finish
|
||||
{
|
||||
get { return _Song != null ? _Song.Finish : 0f; }
|
||||
get { return HasMetaData ? Song.Finish : 0f; }
|
||||
}
|
||||
|
||||
public CTextureRef Cover
|
||||
{
|
||||
get { return _Song != null ? _Song.CoverTextureSmall : CCover.NoCover; }
|
||||
get { return HasMetaData ? Song.CoverTextureSmall : CCover.NoCover; }
|
||||
}
|
||||
|
||||
public float VideoGap
|
||||
{
|
||||
get { return _Song != null ? _Song.VideoGap : 0; }
|
||||
get { return HasMetaData ? Song.VideoGap : 0; }
|
||||
}
|
||||
|
||||
public CPlaylistElement(CSong song)
|
||||
{
|
||||
_Song = song;
|
||||
if (song == null)
|
||||
throw new ArgumentNullException("song");
|
||||
Song = song;
|
||||
}
|
||||
|
||||
public CPlaylistElement(string filePath)
|
||||
{
|
||||
if (String.IsNullOrEmpty(filePath))
|
||||
throw new ArgumentNullException("filePath");
|
||||
_MusicFilePath = filePath;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Xml.Serialization;
|
||||
using Vocaluxe.Base.Fonts;
|
||||
using VocaluxeLib;
|
||||
@@ -121,17 +122,7 @@ namespace Vocaluxe.Base
|
||||
[XmlAltName("PartyModeVersionMajor")] public int VersionMajor;
|
||||
[XmlAltName("PartyModeVersionMinor")] public int VersionMinor;
|
||||
public string TargetAudience;
|
||||
[XmlIgnore] public int MaxPlayers, MinPlayers, MaxTeams, MinTeams;
|
||||
[XmlIgnore] public int PartyModeID;
|
||||
|
||||
public void LoadData(IPartyMode pm)
|
||||
{
|
||||
MaxPlayers = pm.GetMaxPlayer();
|
||||
MinPlayers = pm.GetMinPlayer();
|
||||
MaxTeams = pm.GetMaxTeams();
|
||||
MinTeams = pm.GetMinTeams();
|
||||
PartyModeID = pm.ID;
|
||||
}
|
||||
[XmlIgnore] public IPartyModeInfo ExtInfo;
|
||||
}
|
||||
|
||||
struct SPartyMode
|
||||
|
||||
@@ -237,7 +237,7 @@ namespace Vocaluxe.Lib.Sound.Playback.GstreamerSharp
|
||||
|
||||
private bool _OnMessage(Message msg)
|
||||
{
|
||||
if (msg.Handle == IntPtr.Zero)
|
||||
if (msg == null || msg.Handle == IntPtr.Zero)
|
||||
return true;
|
||||
switch (msg.Type)
|
||||
{
|
||||
|
||||
@@ -45,9 +45,9 @@ namespace Vocaluxe.Lib.Sound.Playback
|
||||
void Fade(int streamID, int targetVolume, float seconds, EStreamAction afterFadeAction = EStreamAction.Nothing);
|
||||
|
||||
/// <summary>
|
||||
/// Set the streams current volume. Cancels fading
|
||||
/// Set the stream's current volume. Cancels fading
|
||||
/// </summary>
|
||||
/// <param name="streamID">Id of the stream (optained by Load)</param>
|
||||
/// <param name="streamID">Id of the stream (obtained by Load)</param>
|
||||
/// <param name="volume">Volume in percent</param>
|
||||
void SetStreamVolume(int streamID, int volume);
|
||||
|
||||
@@ -62,4 +62,4 @@ namespace Vocaluxe.Lib.Sound.Playback
|
||||
void Update();
|
||||
#endregion stream Handling
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -49,8 +49,7 @@ namespace Vocaluxe.Lib.Sound.Playback.PortAudio
|
||||
|
||||
_CurrentTime = value;
|
||||
_OldTime = value;
|
||||
_Timer.Reset();
|
||||
_Timer.Start();
|
||||
_Timer.Restart();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -44,8 +44,7 @@ namespace Vocaluxe.Lib.Sound.Playback.PortAudio
|
||||
{
|
||||
_ExternTime.Time = value;
|
||||
_SetValue = value;
|
||||
_Timer.Reset();
|
||||
_Timer.Start();
|
||||
_Timer.Restart();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace Vocaluxe.Lib.Video
|
||||
/// Loads the file with the given file path.
|
||||
/// </summary>
|
||||
/// <param name="videoFileName">Absolute file path of the video file</param>
|
||||
/// <returns>stream >=0 on success or -1 on failure</returns>
|
||||
/// <returns>Loaded video stream or null on failure</returns>
|
||||
CVideoStream Load(string videoFileName);
|
||||
|
||||
/// <summary>
|
||||
|
||||
+4
-2
@@ -199,7 +199,8 @@ namespace Vocaluxe
|
||||
|
||||
// Load Cover
|
||||
CLog.StartBenchmark("Init Cover");
|
||||
CCover.Init();
|
||||
if (!CCover.Init())
|
||||
throw new CLoadingException("covertheme");
|
||||
CLog.StopBenchmark("Init Cover");
|
||||
|
||||
Application.DoEvents();
|
||||
@@ -237,7 +238,8 @@ namespace Vocaluxe
|
||||
|
||||
// Init Party Modes;
|
||||
CLog.StartBenchmark("Init Party Modes");
|
||||
CParty.Init();
|
||||
if (!CParty.Init())
|
||||
throw new CLoadingException("Party Modes");
|
||||
CLog.StopBenchmark("Init Party Modes");
|
||||
|
||||
Application.DoEvents();
|
||||
|
||||
@@ -112,7 +112,7 @@ namespace Vocaluxe.Screens
|
||||
if (_Buttons[_ButtonPrevious].Selected)
|
||||
CBackgroundMusic.Previous();
|
||||
if (_Buttons[_ButtonPlay].Selected)
|
||||
CBackgroundMusic.Pause();
|
||||
CBackgroundMusic.Play();
|
||||
if (_Buttons[_ButtonPause].Selected)
|
||||
CBackgroundMusic.Pause();
|
||||
if (_Buttons[_ButtonRepeat].Selected)
|
||||
@@ -140,7 +140,7 @@ namespace Vocaluxe.Screens
|
||||
if (_Buttons[_ButtonPrevious].Selected)
|
||||
CBackgroundMusic.Previous();
|
||||
if (_Buttons[_ButtonPlay].Selected)
|
||||
CBackgroundMusic.Pause();
|
||||
CBackgroundMusic.Play();
|
||||
if (_Buttons[_ButtonPause].Selected)
|
||||
CBackgroundMusic.Pause();
|
||||
if (_Buttons[_ButtonRepeat].Selected)
|
||||
|
||||
@@ -34,6 +34,72 @@ namespace Vocaluxe.Screens
|
||||
Up
|
||||
}
|
||||
|
||||
class CCreditTranslation
|
||||
{
|
||||
private readonly string _Language;
|
||||
private readonly List<CText> _Texts;
|
||||
public float StartTime;
|
||||
|
||||
public float Y
|
||||
{
|
||||
get { return _Texts[0].Y; }
|
||||
set
|
||||
{
|
||||
float diff = value - _Texts[0].Y;
|
||||
foreach (CText t in _Texts)
|
||||
t.Y += diff;
|
||||
}
|
||||
}
|
||||
|
||||
public float Alpha
|
||||
{
|
||||
get { return _Texts[0].Alpha; }
|
||||
set
|
||||
{
|
||||
foreach (CText t in _Texts)
|
||||
t.Alpha = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Visible
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (CText t in _Texts)
|
||||
t.Visible = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float LastY
|
||||
{
|
||||
get
|
||||
{
|
||||
int lastText = _Texts.Count - 1;
|
||||
return _Texts[lastText].Y + _Texts[lastText].H;
|
||||
}
|
||||
}
|
||||
|
||||
public CCreditTranslation(string language, List<CText> texts)
|
||||
{
|
||||
_Language = language;
|
||||
_Texts = texts;
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
StartTime = -1;
|
||||
Alpha = 1f;
|
||||
Visible = true;
|
||||
_Texts[0].Y = CSettings.RenderH + 1;
|
||||
float y = CSettings.RenderH + 1;
|
||||
foreach (CText t in _Texts)
|
||||
{
|
||||
y += 25;
|
||||
t.Y = y;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class CCreditName
|
||||
{
|
||||
private readonly CStatic _Image;
|
||||
@@ -120,8 +186,12 @@ namespace Vocaluxe.Screens
|
||||
private CParticleEffect _StarsBlue;
|
||||
private List<CCreditName> _CreditNames;
|
||||
|
||||
private List<CCreditTranslation> _Translations;
|
||||
private int _NumTranslationTexts;
|
||||
|
||||
private Stopwatch _LogoTimer;
|
||||
private Stopwatch _CreditsTimer;
|
||||
private Stopwatch _TranslationsTimer;
|
||||
private Stopwatch _TextTimer;
|
||||
|
||||
private List<string[]> _Paragraphs;
|
||||
@@ -155,6 +225,7 @@ namespace Vocaluxe.Screens
|
||||
|
||||
_LogoTimer = new Stopwatch();
|
||||
_CreditsTimer = new Stopwatch();
|
||||
_TranslationsTimer = new Stopwatch();
|
||||
_TextTimer = new Stopwatch();
|
||||
|
||||
//Text for last part of credits.
|
||||
@@ -278,6 +349,8 @@ namespace Vocaluxe.Screens
|
||||
_AddNewCreditName(_TexNameBohning, 383, 54, false);
|
||||
_AddNewCreditName(_TexNameMesand, 525, 13, false);
|
||||
_AddNewCreditName(_TexNameBabene03, 33, 26, false);
|
||||
|
||||
_AddTranslations();
|
||||
}
|
||||
|
||||
public override void ReloadTheme(string xmlPath) {}
|
||||
@@ -349,6 +422,42 @@ namespace Vocaluxe.Screens
|
||||
_AddParticleEffect(particle);
|
||||
}
|
||||
|
||||
private void _AddTranslations()
|
||||
{
|
||||
CCreditTranslation intro = _AddNewTranslation("A special thanks to all our translators", new List<string> { });
|
||||
CCreditTranslation asturian = _AddNewTranslation("Asturian", new List<string> { "Puxarra" });
|
||||
CCreditTranslation czech = _AddNewTranslation("Czech", new List<string> { "fri" });
|
||||
CCreditTranslation dutch = _AddNewTranslation("Dutch", new List<string> { "thijsblaauw" });
|
||||
CCreditTranslation french = _AddNewTranslation("French", new List<string> { "pinky007" });
|
||||
CCreditTranslation hungarian = _AddNewTranslation("Hungarian", new List<string> { "warez" });
|
||||
CCreditTranslation italian = _AddNewTranslation("Italian", new List<string> { "giuseppep", "LFactory" });
|
||||
CCreditTranslation spanish = _AddNewTranslation("Spanish", new List<string> { "Pantero03", "RubenDjOn", "TeLiX", "karv" });
|
||||
CCreditTranslation swedish = _AddNewTranslation("Swedish", new List<string> { "u28151" });
|
||||
CCreditTranslation turkish = _AddNewTranslation("Turkish", new List<string> { "spirax", "Swertyy" });
|
||||
|
||||
_Translations = new List<CCreditTranslation> { intro, asturian, czech, dutch, french, hungarian, italian, spanish, swedish, turkish };
|
||||
}
|
||||
|
||||
private CCreditTranslation _AddNewTranslation(string language, List<string> translators)
|
||||
{
|
||||
List<CText> texts = new List<CText>();
|
||||
CText text = GetNewText(new CText(CSettings.RenderW / 2, CSettings.RenderH + 1, -4f, 30, -1, EAlignment.Center, EStyle.Bold, "Outline", new SColorF(1, 1, 1, 1), language));
|
||||
_AddText(text);
|
||||
texts.Add(text);
|
||||
_NumTranslationTexts++;
|
||||
float y = texts[0].Y;
|
||||
foreach (string t in translators)
|
||||
{
|
||||
y += 30;
|
||||
text = GetNewText(new CText(CSettings.RenderW / 2, y, -4f, 27, -1, EAlignment.Center, EStyle.Normal, "Outline", new SColorF(1, 1, 1, 1), t));
|
||||
_AddText(text);
|
||||
texts.Add(text);
|
||||
_NumTranslationTexts++;
|
||||
}
|
||||
CCreditTranslation cct = new CCreditTranslation(language, texts);
|
||||
return cct;
|
||||
}
|
||||
|
||||
public override void OnShow()
|
||||
{
|
||||
base.OnShow();
|
||||
@@ -368,10 +477,13 @@ namespace Vocaluxe.Screens
|
||||
_Logo.Y = -270;
|
||||
_StarsRed.Y = _Logo.Y;
|
||||
_StarsBlue.Y = _Logo.Y;
|
||||
foreach (CCreditTranslation translation in _Translations)
|
||||
translation.Reset();
|
||||
|
||||
_TextTimer.Reset();
|
||||
_LogoTimer.Reset();
|
||||
_CreditsTimer.Reset();
|
||||
_TranslationsTimer.Reset();
|
||||
}
|
||||
|
||||
public override void OnShowFinish()
|
||||
@@ -447,9 +559,7 @@ namespace Vocaluxe.Screens
|
||||
if (i == _CreditNames.Count - 1)
|
||||
{
|
||||
_CreditsTimer.Stop();
|
||||
_TextTimer.Start();
|
||||
foreach (CText text in _ParagraphTexts)
|
||||
text.Visible = true;
|
||||
_TranslationsTimer.Start();
|
||||
}
|
||||
}
|
||||
else if (_CreditNames[i].Y <= 360f)
|
||||
@@ -463,9 +573,43 @@ namespace Vocaluxe.Screens
|
||||
}
|
||||
}
|
||||
}
|
||||
if (_TranslationsTimer.IsRunning)
|
||||
{
|
||||
active = true;
|
||||
|
||||
for (int i = 0; i < _Translations.Count; i++)
|
||||
{
|
||||
if (i * 1500f < _TranslationsTimer.ElapsedMilliseconds)
|
||||
{
|
||||
if (_Translations[i].StartTime == -1)
|
||||
_Translations[i].StartTime = _TranslationsTimer.ElapsedMilliseconds;
|
||||
float newY = 720f - (520f / 5000f) * (_TranslationsTimer.ElapsedMilliseconds - _Translations[i].StartTime);
|
||||
_Translations[i].Y = newY;
|
||||
}
|
||||
|
||||
if (_Translations[i].Y <= 160f)
|
||||
{
|
||||
_Translations[i].Visible = false;
|
||||
if (i == _Translations.Count - 1)
|
||||
{
|
||||
_TranslationsTimer.Stop();
|
||||
_TextTimer.Start();
|
||||
foreach (CText text in _ParagraphTexts)
|
||||
text.Visible = true;
|
||||
}
|
||||
}
|
||||
if (_Translations[i].Y <= 360f)
|
||||
{
|
||||
//Fade out
|
||||
float alpha = ((360 - _Translations[i].Y) / 200).Clamp(0,1);
|
||||
_Translations[i].Alpha = 1 - alpha;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if (_TextTimer.IsRunning)
|
||||
active = _TextTimer.ElapsedMilliseconds <= 500;
|
||||
active = _TextTimer.ElapsedMilliseconds <= 10000;
|
||||
|
||||
return active;
|
||||
}
|
||||
|
||||
@@ -65,6 +65,11 @@ namespace Vocaluxe.Screens
|
||||
private bool _AvatarsChanged;
|
||||
private bool _ProfilesChanged;
|
||||
|
||||
public override EMusicType CurrentMusicType
|
||||
{
|
||||
get { return EMusicType.Preview; }
|
||||
}
|
||||
|
||||
#region public methods
|
||||
public override void Init()
|
||||
{
|
||||
|
||||
@@ -134,7 +134,7 @@ namespace Vocaluxe.Screens
|
||||
private void _SaveConfig()
|
||||
{
|
||||
CLanguage.LanguageId = _SelectSlides[_SelectSlideLanguage].Selection;
|
||||
CConfig.Config.Game.Language = _SelectSlides[_SelectSlideLanguage].Value;
|
||||
CConfig.Config.Game.Language = _SelectSlides[_SelectSlideLanguage].SelectedValue;
|
||||
CConfig.Config.Debug.DebugLevel = (EDebugLevel)_SelectSlides[_SelectSlideDebugLevel].Selection;
|
||||
CConfig.Config.Game.SongMenu = (ESongMenu)_SelectSlides[_SelectSlideSongMenu].Selection;
|
||||
CConfig.Config.Game.SongSorting = (ESongSorting)_SelectSlides[_SelectSlideSongSorting].Selection;
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace Vocaluxe.Screens
|
||||
|
||||
public override EMusicType CurrentMusicType
|
||||
{
|
||||
get { return EMusicType.None; }
|
||||
get { return EMusicType.Game; }
|
||||
}
|
||||
|
||||
public override void Init()
|
||||
@@ -303,7 +303,6 @@ namespace Vocaluxe.Screens
|
||||
public override void OnShowFinish()
|
||||
{
|
||||
base.OnShowFinish();
|
||||
CBackgroundMusic.Disabled = true;
|
||||
}
|
||||
|
||||
public override void Draw()
|
||||
@@ -332,7 +331,6 @@ namespace Vocaluxe.Screens
|
||||
CRecord.Stop();
|
||||
|
||||
_DelayTest.Reset();
|
||||
CBackgroundMusic.Disabled = false;
|
||||
}
|
||||
|
||||
private void _OnDeviceEvent()
|
||||
|
||||
@@ -171,15 +171,15 @@ namespace Vocaluxe.Screens
|
||||
|
||||
CConfig.SaveConfig();
|
||||
|
||||
if (_OldCoverTheme != _SelectSlides[_SelectSlideCover].Value)
|
||||
if (_OldCoverTheme != _SelectSlides[_SelectSlideCover].SelectedValue)
|
||||
CCover.ReloadCovers();
|
||||
}
|
||||
|
||||
private void _OnChange()
|
||||
{
|
||||
if (CConfig.Config.Theme.Theme != _SelectSlides[_SelectSlideTheme].Value)
|
||||
if (CConfig.Config.Theme.Theme != _SelectSlides[_SelectSlideTheme].SelectedValue)
|
||||
{
|
||||
CConfig.Config.Theme.Theme = _SelectSlides[_SelectSlideTheme].Value;
|
||||
CConfig.Config.Theme.Theme = _SelectSlides[_SelectSlideTheme].SelectedValue;
|
||||
|
||||
CThemes.Reload();
|
||||
CGraphics.ReloadTheme();
|
||||
@@ -188,9 +188,9 @@ namespace Vocaluxe.Screens
|
||||
return;
|
||||
}
|
||||
|
||||
if (CConfig.Config.Theme.Skin != _SelectSlides[_SelectSlideSkin].Value)
|
||||
if (CConfig.Config.Theme.Skin != _SelectSlides[_SelectSlideSkin].SelectedValue)
|
||||
{
|
||||
CConfig.Config.Theme.Skin = _SelectSlides[_SelectSlideSkin].Value;
|
||||
CConfig.Config.Theme.Skin = _SelectSlides[_SelectSlideSkin].SelectedValue;
|
||||
|
||||
CThemes.ReloadSkin();
|
||||
CGraphics.ReloadSkin();
|
||||
|
||||
@@ -20,6 +20,7 @@ using System.Windows.Forms;
|
||||
using Vocaluxe.Base;
|
||||
using VocaluxeLib;
|
||||
using VocaluxeLib.Menu;
|
||||
using VocaluxeLib.PartyModes;
|
||||
|
||||
namespace Vocaluxe.Screens
|
||||
{
|
||||
@@ -115,7 +116,7 @@ namespace Vocaluxe.Screens
|
||||
|
||||
_SelectSlides[_SelectSlideModes].Clear();
|
||||
foreach (SPartyModeInfos info in _PartyModeInfos)
|
||||
_SelectSlides[_SelectSlideModes].AddValue(info.Name, info.PartyModeID);
|
||||
_SelectSlides[_SelectSlideModes].AddValue(info.Name, info.ExtInfo.ID);
|
||||
_SelectSlides[_SelectSlideModes].Selection = 0;
|
||||
_UpdateSelection();
|
||||
|
||||
@@ -134,42 +135,48 @@ namespace Vocaluxe.Screens
|
||||
|
||||
int index = _SelectSlides[_SelectSlideModes].Selection;
|
||||
if (index >= _PartyModeInfos.Count)
|
||||
return;
|
||||
{
|
||||
index = 0;
|
||||
_SelectSlides[_SelectSlideModes].Selection = 0;
|
||||
}
|
||||
|
||||
//Description
|
||||
_Texts[_TextDescription].Text = _PartyModeInfos[index].Description;
|
||||
_Texts[_TextDescription].TranslationID = _PartyModeInfos[index].PartyModeID;
|
||||
SPartyModeInfos infos = _PartyModeInfos[index];
|
||||
IPartyModeInfo extInfo = infos.ExtInfo;
|
||||
_Texts[_TextDescription].Text = infos.Description;
|
||||
_Texts[_TextDescription].TranslationID = extInfo.ID;
|
||||
|
||||
//TargetAudience
|
||||
_Texts[_TextTargetAudience].TranslationID = _PartyModeInfos[index].PartyModeID;
|
||||
_Texts[_TextTargetAudience].Text = _PartyModeInfos[index].TargetAudience;
|
||||
_Texts[_TextTargetAudience].TranslationID = extInfo.ID;
|
||||
_Texts[_TextTargetAudience].Text = infos.TargetAudience;
|
||||
|
||||
//NumTeams
|
||||
if (_PartyModeInfos[index].MaxTeams == 0)
|
||||
if (extInfo.MaxTeams == 1)
|
||||
_Texts[_TextNumTeams].Text = "TR_SCREENPARTY_NOTEAMS";
|
||||
else if (_PartyModeInfos[index].MaxTeams == _PartyModeInfos[index].MinTeams)
|
||||
_Texts[_TextNumTeams].Text = _PartyModeInfos[index].MaxTeams.ToString();
|
||||
else if (_PartyModeInfos[index].MaxTeams > _PartyModeInfos[index].MinTeams)
|
||||
_Texts[_TextNumTeams].Text = _PartyModeInfos[index].MinTeams + " - " + _PartyModeInfos[index].MaxTeams;
|
||||
else if (extInfo.MaxTeams == extInfo.MinTeams)
|
||||
_Texts[_TextNumTeams].Text = extInfo.MaxTeams.ToString();
|
||||
else
|
||||
_Texts[_TextNumTeams].Text = extInfo.MinTeams + " - " + extInfo.MaxTeams;
|
||||
|
||||
//NumPlayers
|
||||
if (_PartyModeInfos[index].MaxPlayers == _PartyModeInfos[index].MinPlayers)
|
||||
_Texts[_TextNumPlayers].Text = _PartyModeInfos[index].MaxTeams.ToString();
|
||||
else if (_PartyModeInfos[index].MaxPlayers > _PartyModeInfos[index].MinPlayers)
|
||||
_Texts[_TextNumPlayers].Text = _PartyModeInfos[index].MinPlayers + " - " + _PartyModeInfos[index].MaxPlayers;
|
||||
if (extInfo.MaxPlayers == extInfo.MinPlayers)
|
||||
_Texts[_TextNumPlayers].Text = extInfo.MaxTeams.ToString();
|
||||
else
|
||||
_Texts[_TextNumPlayers].Text = extInfo.MinPlayers + " - " + extInfo.MaxPlayers;
|
||||
|
||||
//Author
|
||||
_Texts[_TextAuthor].Text = _PartyModeInfos[index].Author;
|
||||
_Texts[_TextAuthor].TranslationID = _PartyModeInfos[index].PartyModeID;
|
||||
_Texts[_TextAuthor].Text = infos.Author;
|
||||
_Texts[_TextAuthor].TranslationID = extInfo.ID;
|
||||
|
||||
//Version
|
||||
_Texts[_TextVersion].Text = _PartyModeInfos[index].VersionMajor + "." + _PartyModeInfos[index].VersionMinor;
|
||||
_Texts[_TextVersion].TranslationID = _PartyModeInfos[index].PartyModeID;
|
||||
_Texts[_TextVersion].Text = infos.VersionMajor + "." + infos.VersionMinor;
|
||||
_Texts[_TextVersion].TranslationID = extInfo.ID;
|
||||
|
||||
if (CConfig.GetMaxNumMics() == 0)
|
||||
if (CConfig.GetMaxNumMics() < extInfo.MinMics)
|
||||
{
|
||||
_Buttons[_ButtonStart].Visible = false;
|
||||
_Texts[_TextError].Text = "TR_SCREENPARTY_ERROR_MICS";
|
||||
_Texts[_TextError].Text = CConfig.GetMaxNumMics() == 0
|
||||
? "TR_SCREENPARTY_ERROR_MICS" : CLanguage.Translate("TR_SCREENPARTY_ERROR_MIC_NUM").Replace("%d", extInfo.MinMics.ToString());
|
||||
_Texts[_TextError].Visible = true;
|
||||
}
|
||||
else
|
||||
@@ -193,7 +200,7 @@ namespace Vocaluxe.Screens
|
||||
return;
|
||||
}
|
||||
|
||||
CParty.SetPartyMode(_PartyModeInfos[index].PartyModeID);
|
||||
CParty.SetPartyMode(_PartyModeInfos[index].ExtInfo.ID);
|
||||
CGraphics.FadeTo(CParty.GetStartScreen());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ namespace Vocaluxe.Screens
|
||||
break;
|
||||
case EEditMode.PlayerName:
|
||||
_SelectSlides[_SelectSlideProfiles].RenameValue(
|
||||
CProfiles.AddGetPlayerName(_SelectSlides[_SelectSlideProfiles].ValueIndex, keyEvent.Unicode));
|
||||
CProfiles.AddGetPlayerName(_SelectSlides[_SelectSlideProfiles].SelectedTag, keyEvent.Unicode));
|
||||
_ProfilesChanged = true;
|
||||
break;
|
||||
}
|
||||
@@ -155,7 +155,7 @@ namespace Vocaluxe.Screens
|
||||
if (_EditMode == EEditMode.PlayerName)
|
||||
{
|
||||
_SelectSlides[_SelectSlideProfiles].RenameValue(
|
||||
CProfiles.GetDeleteCharInPlayerName(_SelectSlides[_SelectSlideProfiles].ValueIndex));
|
||||
CProfiles.GetDeleteCharInPlayerName(_SelectSlides[_SelectSlideProfiles].SelectedTag));
|
||||
_ProfilesChanged = true;
|
||||
}
|
||||
else
|
||||
@@ -168,22 +168,22 @@ namespace Vocaluxe.Screens
|
||||
}
|
||||
if (_SelectSlides[_SelectSlideDifficulty].Selected)
|
||||
{
|
||||
CProfiles.SetDifficulty(_SelectSlides[_SelectSlideProfiles].ValueIndex,
|
||||
CProfiles.SetDifficulty(_SelectSlides[_SelectSlideProfiles].SelectedTag,
|
||||
(EGameDifficulty)_SelectSlides[_SelectSlideDifficulty].Selection);
|
||||
}
|
||||
else if (_SelectSlides[_SelectSlideAvatars].Selected)
|
||||
{
|
||||
CProfiles.SetAvatar(_SelectSlides[_SelectSlideProfiles].ValueIndex,
|
||||
_SelectSlides[_SelectSlideAvatars].ValueIndex);
|
||||
CProfiles.SetAvatar(_SelectSlides[_SelectSlideProfiles].SelectedTag,
|
||||
_SelectSlides[_SelectSlideAvatars].SelectedTag);
|
||||
}
|
||||
else if (_SelectSlides[_SelectSlideUserRole].Selected)
|
||||
{
|
||||
CProfiles.SetUserRoleProfile(_SelectSlides[_SelectSlideProfiles].ValueIndex,
|
||||
CProfiles.SetUserRoleProfile(_SelectSlides[_SelectSlideProfiles].SelectedTag,
|
||||
(EUserRole)_SelectSlides[_SelectSlideUserRole].Selection);
|
||||
}
|
||||
else if (_SelectSlides[_SelectSlideActive].Selected)
|
||||
{
|
||||
CProfiles.SetActive(_SelectSlides[_SelectSlideProfiles].ValueIndex,
|
||||
CProfiles.SetActive(_SelectSlides[_SelectSlideProfiles].SelectedTag,
|
||||
(EOffOn)_SelectSlides[_SelectSlideActive].Selection);
|
||||
}
|
||||
}
|
||||
@@ -215,24 +215,24 @@ namespace Vocaluxe.Screens
|
||||
}
|
||||
else if (_SelectSlides[_SelectSlideDifficulty].Selected)
|
||||
{
|
||||
CProfiles.SetDifficulty(_SelectSlides[_SelectSlideProfiles].ValueIndex,
|
||||
CProfiles.SetDifficulty(_SelectSlides[_SelectSlideProfiles].SelectedTag,
|
||||
(EGameDifficulty)_SelectSlides[_SelectSlideDifficulty].Selection);
|
||||
}
|
||||
else if (_SelectSlides[_SelectSlideAvatars].Selected)
|
||||
{
|
||||
CProfiles.SetAvatar(_SelectSlides[_SelectSlideProfiles].ValueIndex,
|
||||
_SelectSlides[_SelectSlideAvatars].ValueIndex);
|
||||
CProfiles.SetAvatar(_SelectSlides[_SelectSlideProfiles].SelectedTag,
|
||||
_SelectSlides[_SelectSlideAvatars].SelectedTag);
|
||||
if (CWebcam.IsDeviceAvailable() && _WebcamTexture != null)
|
||||
_OnDiscardSnapshot();
|
||||
}
|
||||
else if (_SelectSlides[_SelectSlideUserRole].Selected)
|
||||
{
|
||||
CProfiles.SetUserRoleProfile(_SelectSlides[_SelectSlideProfiles].ValueIndex,
|
||||
CProfiles.SetUserRoleProfile(_SelectSlides[_SelectSlideProfiles].SelectedTag,
|
||||
(EUserRole)_SelectSlides[_SelectSlideUserRole].Selection);
|
||||
}
|
||||
else if (_SelectSlides[_SelectSlideActive].Selected)
|
||||
{
|
||||
CProfiles.SetActive(_SelectSlides[_SelectSlideProfiles].ValueIndex,
|
||||
CProfiles.SetActive(_SelectSlides[_SelectSlideProfiles].SelectedTag,
|
||||
(EOffOn)_SelectSlides[_SelectSlideActive].Selection);
|
||||
}
|
||||
else if (_Buttons[_ButtonWebcam].Selected)
|
||||
@@ -260,16 +260,16 @@ namespace Vocaluxe.Screens
|
||||
|
||||
if (_SelectSlides[_SelectSlideProfiles].Selection > -1)
|
||||
{
|
||||
_Buttons[_ButtonPlayerName].Text.Text = CProfiles.GetPlayerName(_SelectSlides[_SelectSlideProfiles].ValueIndex);
|
||||
_Buttons[_ButtonPlayerName].Text.Text = CProfiles.GetPlayerName(_SelectSlides[_SelectSlideProfiles].SelectedTag);
|
||||
if (_EditMode == EEditMode.PlayerName)
|
||||
_Buttons[_ButtonPlayerName].Text.Text += "|";
|
||||
|
||||
_SelectSlides[_SelectSlideDifficulty].Selection = (int)CProfiles.GetDifficulty(_SelectSlides[_SelectSlideProfiles].ValueIndex);
|
||||
_SelectSlides[_SelectSlideUserRole].Selection = (int)CProfiles.GetUserRoleProfile(_SelectSlides[_SelectSlideProfiles].ValueIndex);
|
||||
_SelectSlides[_SelectSlideActive].Selection = (int)CProfiles.GetActive(_SelectSlides[_SelectSlideProfiles].ValueIndex);
|
||||
_SelectSlides[_SelectSlideDifficulty].Selection = (int)CProfiles.GetDifficulty(_SelectSlides[_SelectSlideProfiles].SelectedTag);
|
||||
_SelectSlides[_SelectSlideUserRole].Selection = (int)CProfiles.GetUserRoleProfile(_SelectSlides[_SelectSlideProfiles].SelectedTag);
|
||||
_SelectSlides[_SelectSlideActive].Selection = (int)CProfiles.GetActive(_SelectSlides[_SelectSlideProfiles].SelectedTag);
|
||||
|
||||
int avatarID = CProfiles.GetAvatarID(_SelectSlides[_SelectSlideProfiles].ValueIndex);
|
||||
_SelectSlides[_SelectSlideAvatars].SetSelectionByValueIndex(avatarID);
|
||||
int avatarID = CProfiles.GetAvatarID(_SelectSlides[_SelectSlideProfiles].SelectedTag);
|
||||
_SelectSlides[_SelectSlideAvatars].SelectedTag = avatarID;
|
||||
if (_Snapshot == null)
|
||||
{
|
||||
if (CWebcam.IsCapturing())
|
||||
@@ -357,7 +357,7 @@ namespace Vocaluxe.Screens
|
||||
_Buttons[_ButtonWebcam].Visible = CWebcam.IsDeviceAvailable();
|
||||
|
||||
int id = CProfiles.NewAvatar(file);
|
||||
CProfiles.SetAvatar(_SelectSlides[_SelectSlideProfiles].ValueIndex, id);
|
||||
CProfiles.SetAvatar(_SelectSlides[_SelectSlideProfiles].SelectedTag, id);
|
||||
_LoadAvatars(false);
|
||||
}
|
||||
|
||||
@@ -381,10 +381,9 @@ namespace Vocaluxe.Screens
|
||||
_EditMode = EEditMode.None;
|
||||
int id = CProfiles.NewProfile();
|
||||
_LoadProfiles(false);
|
||||
_SelectSlides[_SelectSlideProfiles].SetSelectionByValueIndex(id);
|
||||
_SelectSlides[_SelectSlideProfiles].SelectedTag = id;
|
||||
|
||||
CProfiles.SetAvatar(_SelectSlides[_SelectSlideProfiles].ValueIndex,
|
||||
_SelectSlides[_SelectSlideAvatars].ValueIndex);
|
||||
CProfiles.SetAvatar(_SelectSlides[_SelectSlideProfiles].SelectedTag, _SelectSlides[_SelectSlideAvatars].SelectedTag);
|
||||
|
||||
_SelectElement(_Buttons[_ButtonPlayerName]);
|
||||
_EditMode = EEditMode.PlayerName;
|
||||
@@ -400,7 +399,7 @@ namespace Vocaluxe.Screens
|
||||
{
|
||||
_EditMode = EEditMode.None;
|
||||
|
||||
CProfiles.DeleteProfile(_SelectSlides[_SelectSlideProfiles].ValueIndex);
|
||||
CProfiles.DeleteProfile(_SelectSlides[_SelectSlideProfiles].SelectedTag);
|
||||
|
||||
int selection = _SelectSlides[_SelectSlideProfiles].Selection;
|
||||
if (_SelectSlides[_SelectSlideProfiles].NumValues - 1 > selection)
|
||||
@@ -413,29 +412,23 @@ namespace Vocaluxe.Screens
|
||||
{
|
||||
string name = String.Empty;
|
||||
if (_EditMode == EEditMode.PlayerName)
|
||||
name = CProfiles.GetPlayerName(_SelectSlides[_SelectSlideProfiles].ValueIndex);
|
||||
name = CProfiles.GetPlayerName(_SelectSlides[_SelectSlideProfiles].SelectedTag);
|
||||
|
||||
int selectedProfileID = _SelectSlides[_SelectSlideProfiles].ValueIndex;
|
||||
int selectedProfileID = _SelectSlides[_SelectSlideProfiles].SelectedTag;
|
||||
_SelectSlides[_SelectSlideProfiles].Clear();
|
||||
|
||||
CProfile[] profiles = CProfiles.GetProfiles();
|
||||
foreach (CProfile profile in profiles)
|
||||
{
|
||||
_SelectSlides[_SelectSlideProfiles].AddValue(
|
||||
profile.PlayerName,
|
||||
null,
|
||||
profile.ID,
|
||||
-1);
|
||||
}
|
||||
_SelectSlides[_SelectSlideProfiles].AddValue(profile.PlayerName, null, profile.ID);
|
||||
|
||||
if (CProfiles.NumProfiles > 0 && CProfiles.NumAvatars > 0)
|
||||
{
|
||||
if (selectedProfileID != -1)
|
||||
_SelectSlides[_SelectSlideProfiles].SetSelectionByValueIndex(selectedProfileID);
|
||||
_SelectSlides[_SelectSlideProfiles].SelectedTag = selectedProfileID;
|
||||
else
|
||||
{
|
||||
_SelectSlides[_SelectSlideProfiles].Selection = 0;
|
||||
selectedProfileID = _SelectSlides[_SelectSlideProfiles].ValueIndex;
|
||||
selectedProfileID = _SelectSlides[_SelectSlideProfiles].SelectedTag;
|
||||
}
|
||||
|
||||
if (!keep)
|
||||
@@ -443,39 +436,33 @@ namespace Vocaluxe.Screens
|
||||
_SelectSlides[_SelectSlideDifficulty].Selection = (int)CProfiles.GetDifficulty(selectedProfileID);
|
||||
_SelectSlides[_SelectSlideUserRole].Selection = (int)CProfiles.GetUserRoleProfile(selectedProfileID);
|
||||
_SelectSlides[_SelectSlideActive].Selection = (int)CProfiles.GetActive(selectedProfileID);
|
||||
_SelectSlides[_SelectSlideAvatars].SetSelectionByValueIndex(CProfiles.GetAvatarID(selectedProfileID));
|
||||
_SelectSlides[_SelectSlideAvatars].SelectedTag = CProfiles.GetAvatarID(selectedProfileID);
|
||||
}
|
||||
|
||||
if (_EditMode == EEditMode.PlayerName)
|
||||
CProfiles.SetPlayerName(_SelectSlides[_SelectSlideProfiles].ValueIndex, name);
|
||||
CProfiles.SetPlayerName(_SelectSlides[_SelectSlideProfiles].SelectedTag, name);
|
||||
}
|
||||
_ProfilesChanged = false;
|
||||
}
|
||||
|
||||
private void _LoadAvatars(bool keep)
|
||||
{
|
||||
int selectedAvatarID = _SelectSlides[_SelectSlideAvatars].ValueIndex;
|
||||
int selectedAvatarID = _SelectSlides[_SelectSlideAvatars].SelectedTag;
|
||||
_SelectSlides[_SelectSlideAvatars].Clear();
|
||||
IEnumerable<CAvatar> avatars = CProfiles.GetAvatars();
|
||||
if (avatars != null)
|
||||
{
|
||||
foreach (CAvatar avatar in avatars)
|
||||
{
|
||||
_SelectSlides[_SelectSlideAvatars].AddValue(
|
||||
avatar.GetDisplayName(),
|
||||
null,
|
||||
avatar.ID,
|
||||
-1);
|
||||
}
|
||||
_SelectSlides[_SelectSlideAvatars].AddValue(avatar.GetDisplayName(), null, avatar.ID);
|
||||
}
|
||||
|
||||
if (keep)
|
||||
{
|
||||
_SelectSlides[_SelectSlideAvatars].SetSelectionByValueIndex(selectedAvatarID);
|
||||
CProfiles.SetAvatar(_SelectSlides[_SelectSlideProfiles].ValueIndex, selectedAvatarID);
|
||||
_SelectSlides[_SelectSlideAvatars].SelectedTag = selectedAvatarID;
|
||||
CProfiles.SetAvatar(_SelectSlides[_SelectSlideProfiles].SelectedTag, selectedAvatarID);
|
||||
}
|
||||
else
|
||||
_SelectSlides[_SelectSlideAvatars].SetSelectionByValueIndex(CProfiles.GetAvatarID(_SelectSlides[_SelectSlideProfiles].ValueIndex));
|
||||
_SelectSlides[_SelectSlideAvatars].SelectedTag = CProfiles.GetAvatarID(_SelectSlides[_SelectSlideProfiles].SelectedTag);
|
||||
|
||||
_AvatarsChanged = false;
|
||||
}
|
||||
|
||||
@@ -124,8 +124,6 @@ namespace Vocaluxe.Screens
|
||||
|
||||
public override void OnShow()
|
||||
{
|
||||
CBackgroundMusic.Disabled = false;
|
||||
|
||||
base.OnShow();
|
||||
//-1 --> Show average
|
||||
_Round = CGame.NumRounds > 1 ? -1 : 0;
|
||||
@@ -187,26 +185,23 @@ namespace Vocaluxe.Screens
|
||||
|
||||
private static string _GetRating(double points)
|
||||
{
|
||||
string rating = String.Empty;
|
||||
string rating;
|
||||
|
||||
if (points >= 9800)
|
||||
{
|
||||
//in case of the game names so:
|
||||
rating = "TR_RATING_VOCAL_HERO";
|
||||
}
|
||||
else if (points < 9800 && points >= 8400)
|
||||
else if (points >= 8400)
|
||||
rating = "TR_RATING_SUPERSTAR";
|
||||
else if (points < 8400 && points >= 7000)
|
||||
else if (points >= 7000)
|
||||
rating = "TR_RATING_LEAD_SINGER";
|
||||
else if (points < 7000 && points >= 5600)
|
||||
else if (points >= 5600)
|
||||
rating = "TR_RATING_RISING_STAR";
|
||||
else if (points < 5600 && points >= 4200)
|
||||
else if (points >= 4200)
|
||||
rating = "TR_RATING_HOPEFUL";
|
||||
else if (points < 4200 && points >= 2800)
|
||||
else if (points >= 2800)
|
||||
rating = "TR_RATING_WANNABE";
|
||||
else if (points < 2800 && points >= 1400)
|
||||
else if (points >= 1400)
|
||||
rating = "TR_RATING_AMATEUR";
|
||||
else if (points < 1400)
|
||||
else
|
||||
rating = "TR_RATING_TONE_DEAF";
|
||||
|
||||
return rating;
|
||||
|
||||
@@ -96,8 +96,7 @@ namespace Vocaluxe.Screens
|
||||
private int _CurrentBeat;
|
||||
private int _CurrentStream = -1;
|
||||
private float _Length = -1f;
|
||||
//private int _NextStream = -1;
|
||||
private const int _Volume = 100;
|
||||
|
||||
private CVideoStream _CurrentVideo;
|
||||
private EAspect _VideoAspect = EAspect.Crop;
|
||||
private CTextureRef _CurrentWebcamFrameTexture;
|
||||
@@ -414,7 +413,6 @@ namespace Vocaluxe.Screens
|
||||
public override void OnShowFinish()
|
||||
{
|
||||
base.OnShowFinish();
|
||||
CBackgroundMusic.Disabled = true;
|
||||
|
||||
CGame.Start();
|
||||
_LoadNextSong();
|
||||
@@ -528,7 +526,7 @@ namespace Vocaluxe.Screens
|
||||
_Texts[_TextSongName].Text = songname;
|
||||
|
||||
_CurrentStream = CSound.Load(song.GetMP3(), false, true);
|
||||
CSound.SetStreamVolume(_CurrentStream, _Volume);
|
||||
CSound.SetStreamVolume(_CurrentStream, 100);
|
||||
CSound.SetPosition(_CurrentStream, song.Start);
|
||||
_CurrentTime = song.Start;
|
||||
_FinishTime = song.Finish;
|
||||
|
||||
@@ -80,7 +80,6 @@ namespace Vocaluxe.Screens
|
||||
private readonly List<string> _ButtonsJoker = new List<string>();
|
||||
private readonly List<string> _TextsPlayer = new List<string>();
|
||||
private ESongOptionsView _CurSongOptionsView;
|
||||
private bool _PlaylistActive;
|
||||
private readonly List<EGameMode> _AvailableGameModes;
|
||||
private SScreenSongOptions _Sso;
|
||||
|
||||
@@ -163,16 +162,26 @@ namespace Vocaluxe.Screens
|
||||
|
||||
public override bool HandleInput(SKeyEvent keyEvent)
|
||||
{
|
||||
if (_Playlist.Visible)
|
||||
{
|
||||
keyEvent.Handled = _Playlist.HandleInput(keyEvent);
|
||||
if (keyEvent.Handled)
|
||||
return true;
|
||||
if (!keyEvent.KeyPressed && keyEvent.Key == Keys.Escape)
|
||||
{
|
||||
_ClosePlaylist();
|
||||
keyEvent.Handled = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Playlist selection is handled below not in base!
|
||||
_Playlist.Selectable = false;
|
||||
base.HandleInput(keyEvent);
|
||||
_Playlist.Selectable = true;
|
||||
if (keyEvent.Handled)
|
||||
return true;
|
||||
|
||||
if (_PlaylistActive)
|
||||
{
|
||||
_Playlist.HandleInput(keyEvent);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_CurSongOptionsView == ESongOptionsView.None)
|
||||
{
|
||||
if (keyEvent.KeyPressed && !Char.IsControl(keyEvent.Unicode) && keyEvent.Mod != EModifier.Ctrl)
|
||||
@@ -233,9 +242,8 @@ namespace Vocaluxe.Screens
|
||||
case Keys.Tab:
|
||||
if (_Playlist.Visible)
|
||||
{
|
||||
_PlaylistActive = !_PlaylistActive;
|
||||
_Playlist.Selected = _PlaylistActive;
|
||||
_SongMenu.Selected = !_PlaylistActive;
|
||||
_Playlist.Selected = !_Playlist.Selected;
|
||||
_SongMenu.Selected = !_Playlist.Selected;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -392,27 +400,18 @@ namespace Vocaluxe.Screens
|
||||
_OldMousePosX = mouseEvent.X;
|
||||
_OldMousePosY = mouseEvent.Y;
|
||||
|
||||
if (_Playlist.Visible && _Playlist.IsMouseOver(mouseEvent))
|
||||
if (_Playlist.Visible && _Playlist.Selected)
|
||||
{
|
||||
_PlaylistActive = true;
|
||||
_Playlist.Selected = _PlaylistActive;
|
||||
_SongMenu.Selected = !_PlaylistActive;
|
||||
_SongMenu.Selected = false;
|
||||
_ToggleSongOptions(ESongOptionsView.None);
|
||||
}
|
||||
else if (CHelper.IsInBounds(_SongMenu.Rect, mouseEvent))
|
||||
{
|
||||
_PlaylistActive = false;
|
||||
_Playlist.Selected = _PlaylistActive;
|
||||
_SongMenu.Selected = !_PlaylistActive;
|
||||
}
|
||||
|
||||
|
||||
if (_Playlist.Visible && _PlaylistActive)
|
||||
{
|
||||
if (_Playlist.HandleMouse(mouseEvent))
|
||||
return true;
|
||||
}
|
||||
|
||||
else if (CHelper.IsInBounds(_SongMenu.Rect, mouseEvent))
|
||||
{
|
||||
_Playlist.Selected = false;
|
||||
_SongMenu.Selected = true;
|
||||
}
|
||||
|
||||
if (mouseEvent.RB)
|
||||
{
|
||||
@@ -522,12 +521,12 @@ namespace Vocaluxe.Screens
|
||||
_HandleSelectButton();
|
||||
return true;
|
||||
}
|
||||
else if (_SelectSlides[_SelectSlideOptionsPlaylistOpen].ValueSelected)
|
||||
else if (_SelectSlides[_SelectSlideOptionsPlaylistOpen].IsValueSelected)
|
||||
{
|
||||
_OpenPlaylist(_SelectSlides[_SelectSlideOptionsPlaylistOpen].Selection);
|
||||
return true;
|
||||
}
|
||||
else if (_SelectSlides[_SelectSlideOptionsPlaylistAdd].ValueSelected)
|
||||
else if (_SelectSlides[_SelectSlideOptionsPlaylistAdd].IsValueSelected)
|
||||
{
|
||||
_OpenPlaylist(_SelectSlides[_SelectSlideOptionsPlaylistAdd].Selection - 1);
|
||||
return true;
|
||||
@@ -629,12 +628,13 @@ namespace Vocaluxe.Screens
|
||||
_SongMenu.OnShow();
|
||||
|
||||
if (_Sso.Selection.PartyMode)
|
||||
_PlaylistActive = false;
|
||||
|
||||
if (_Sso.Selection.PartyMode)
|
||||
{
|
||||
_ClosePlaylist();
|
||||
_ToggleSongOptions(ESongOptionsView.None);
|
||||
_SelectElement(_Buttons[_ButtonStart]);
|
||||
}
|
||||
|
||||
_SongMenu.Selected = !_PlaylistActive;
|
||||
_SongMenu.Selected = !_Playlist.Visible;
|
||||
_SongMenu.SmallView = _Playlist.Visible;
|
||||
|
||||
if (_Playlist.ActivePlaylistID != -1)
|
||||
@@ -659,7 +659,7 @@ namespace Vocaluxe.Screens
|
||||
|
||||
public override bool UpdateGame()
|
||||
{
|
||||
if (_PlaylistActive)
|
||||
if (_Playlist.Visible)
|
||||
{
|
||||
if (_Playlist.ActivePlaylistID == -1)
|
||||
_ClosePlaylist();
|
||||
@@ -1171,7 +1171,7 @@ namespace Vocaluxe.Screens
|
||||
{
|
||||
if (CSongs.VisibleSongs[_SongMenu.GetPreviewSongNr()].IsGameModeAvailable(gameMode))
|
||||
{
|
||||
_SelectSlides[_SelectSlideOptionsMode].AddValue(Enum.GetName(typeof(EGameMode), gameMode));
|
||||
_SelectSlides[_SelectSlideOptionsMode].AddValue(Enum.GetName(typeof(EGameMode), gameMode), null, (int)gameMode);
|
||||
_AvailableGameModes.Add(gameMode);
|
||||
}
|
||||
}
|
||||
@@ -1189,11 +1189,7 @@ namespace Vocaluxe.Screens
|
||||
_CheckAndAddGameMode(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);
|
||||
}
|
||||
_SelectSlides[_SelectSlideOptionsMode].SelectedTag = (int)lastMode;
|
||||
_SelectSlides[_SelectSlideOptionsMode].Visible = true;
|
||||
_SelectSlides[_SelectSlideOptionsPlaylistAdd].Visible = true;
|
||||
_Buttons[_ButtonOptionsSing].Visible = true;
|
||||
@@ -1242,9 +1238,9 @@ namespace Vocaluxe.Screens
|
||||
_SelectSlides[_SelectSlideOptionsNumMedleySongs].AddValue(i.ToString());
|
||||
}
|
||||
if (_SelectSlides[_SelectSlideOptionsNumMedleySongs].NumValues >= 5)
|
||||
_SelectSlides[_SelectSlideOptionsNumMedleySongs].SetSelectionByValueIndex(4);
|
||||
_SelectSlides[_SelectSlideOptionsNumMedleySongs].SelectedValue = "5";
|
||||
else
|
||||
_SelectSlides[_SelectSlideOptionsNumMedleySongs].SetSelectionByValueIndex(_SelectSlides[_SelectSlideOptionsNumMedleySongs].NumValues - 1);
|
||||
_SelectSlides[_SelectSlideOptionsNumMedleySongs].SelectLastValue();
|
||||
_SelectElement(_Buttons[_ButtonOptionsStartMedley]);
|
||||
}
|
||||
|
||||
@@ -1260,12 +1256,12 @@ namespace Vocaluxe.Screens
|
||||
|
||||
private void _ClosePlaylist()
|
||||
{
|
||||
if (_Playlist.Visible || _PlaylistActive)
|
||||
if (_Playlist.Visible)
|
||||
{
|
||||
_SongMenu.SmallView = false;
|
||||
_PlaylistActive = false;
|
||||
_Playlist.Selected = _PlaylistActive;
|
||||
_SongMenu.Selected = !_PlaylistActive;
|
||||
_Playlist.Visible = false;
|
||||
_Playlist.Selected = false;
|
||||
_SongMenu.Selected = false;
|
||||
_Playlist.ClosePlaylist();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@
|
||||
"keyboardButtonShift": "Shift",
|
||||
"keyboardButtonAlt": "Alt",
|
||||
"keyboardButtonCtrl": "Control",
|
||||
"keyboardButtonBackspace": "Backspace",
|
||||
"keyboardAutoSend": "Auto send keys",
|
||||
"keyboardButtonSend": "Send"
|
||||
"keyboardButtonBackspace": "Backsteg",
|
||||
"keyboardAutoSend": "Auto skicka knappar",
|
||||
"keyboardButtonSend": "Skicka"
|
||||
}
|
||||
Reference in new issue
Block a user