Fix blank screen issue

Also fix some other bugs and improvements (easier party modes, volume fixes, new fields for screens to control volume and popups)
This commit is contained in:
Flamefire committed 2014-11-27 21:47:02 +01:00
1 parent 36b81e8c1f
commit 26484ad137
62 files changed
+1160 -1964

No files matched your search

+34 -22
View File
@@ -360,32 +360,44 @@ namespace VocaluxeLib
Freestyle
}
public enum EScreens
public enum EMusicType
{
ScreenTest = 0,
ScreenLoad = 1,
ScreenMain = 2,
ScreenSong = 3,
ScreenOptions = 4,
ScreenSing = 5,
ScreenProfiles = 6,
ScreenScore = 7,
ScreenHighscore = 8,
None,
Background,
Preview,
Game
}
ScreenOptionsGame = 9,
ScreenOptionsSound = 10,
ScreenOptionsRecord = 11,
ScreenOptionsVideo = 12,
ScreenOptionsVideoAdjustments = 13,
ScreenOptionsLyrics = 14,
ScreenOptionsTheme = 15,
/// <summary>
/// Base screens
/// </summary>
public enum EScreen
{
Unknown = -1,
ScreenNames = 16,
ScreenCredits = 17,
ScreenParty = 18,
ScreenPartyDummy = 19,
Test,
Load,
Main,
Song,
Options,
Sing,
Profiles,
Score,
Highscore,
ScreenNull = -1
OptionsGame,
OptionsSound,
OptionsRecord,
OptionsVideo,
OptionsVideoAdjustments,
OptionsLyrics,
OptionsTheme,
Names,
Credits,
Party,
CountEntry //Leave this as last entry and never use it!
}
public enum EPopupScreens
+7 -3
View File
@@ -32,7 +32,7 @@ namespace VocaluxeLib
EOffOn GetSaveModifiedSongs();
void SetBackgroundMusicVolume(int newVolume);
int GetBackgroundMusicVolume();
int GetMusicVolume(EMusicType type);
EBackgroundMusicOffOn GetBackgroundMusicStatus();
@@ -147,11 +147,14 @@ namespace VocaluxeLib
{
void ReloadTheme();
void SaveTheme();
void FadeTo(EScreens nextScreen);
void FadeTo(EScreen nextScreen);
void FadeTo(IMenu nextScreen);
float GetGlobalAlpha();
EScreens GetNextScreen();
IMenu GetNextScreen();
EScreen GetNextScreenType();
IMenu GetScreen(EScreen screen);
}
public interface ILog
@@ -272,6 +275,7 @@ namespace VocaluxeLib
float GetLength(int soundStream);
void SetStreamVolume(int soundStream, float volume);
void SetGlobalVolume(int volume);
}
public interface ICover
+5 -5
View File
@@ -112,11 +112,6 @@ namespace VocaluxeLib.Menu
_ThemeScreenSettings = null;
}
protected static void _FadeTo(EScreens nextScreen)
{
CBase.Graphics.FadeTo(nextScreen);
}
#region ThemeHandler
protected override void _ClearElements()
{
@@ -569,6 +564,11 @@ namespace VocaluxeLib.Menu
get { return CBase.Settings.GetRenderRect(); }
}
public virtual EMusicType CurrentMusicType
{
get { return EMusicType.Background; }
}
protected void _ResumeBG()
{
foreach (CBackground bg in _Backgrounds)
-2
View File
@@ -29,7 +29,5 @@ namespace VocaluxeLib.Menu
_PartyMode = partyMode;
PartyModeID = partyMode.ID;
}
public virtual void DataToScreen(Object data) {}
}
}
+1 -13
View File
@@ -22,12 +22,6 @@ using VocaluxeLib.Profile;
namespace VocaluxeLib.Menu
{
public struct SPartyNameOptions
{
public int[] NumPlayerTeams;
public List<int>[] TeamList;
}
public abstract class CMenuPartyNameSelection : CMenuParty
{
private bool _Teams;
@@ -63,7 +57,7 @@ namespace VocaluxeLib.Menu
private const string _SelectSlidePlayer = "SelectSlidePlayer";
private const string _NameSelection = "NameSelection";
private List<int>[] _TeamList;
protected List<int>[] _TeamList;
public override void Init()
{
@@ -558,12 +552,6 @@ namespace VocaluxeLib.Menu
public abstract void Back();
public abstract void Next();
public SPartyNameOptions GetData()
{
SPartyNameOptions option = new SPartyNameOptions {NumPlayerTeams = _NumPlayerTeams, TeamList = _TeamList};
return option;
}
public void IncreaseTeamNum()
{
if (!_AllowChangeTeamNum)
+4 -2
View File
@@ -140,8 +140,10 @@ namespace VocaluxeLib.Menu
{
_PrepareTiles();
_PlayerSelector = new CStatic(_PartyModeID, _TextureTileSelected, new SColorF(), new SRectF(0, 0, _Theme.Tiles.W + 6, _Theme.Tiles.H + 6, Rect.Z - 0.5f));
_PlayerSelector.Visible = false;
_PlayerSelector = new CStatic(_PartyModeID, _TextureTileSelected, new SColorF(), new SRectF(0, 0, _Theme.Tiles.W + 6, _Theme.Tiles.H + 6, Rect.Z - 0.5f))
{
Visible = false
};
_UpdateVisibleProfiles();
+2 -2
View File
@@ -1112,7 +1112,7 @@ namespace VocaluxeLib.Menu
for (int i = 0; i < CBase.Playlist.GetSongCount(ActivePlaylistID); i++)
CBase.Game.AddSong(CBase.Playlist.GetSong(ActivePlaylistID, i).SongID, CBase.Playlist.GetSong(ActivePlaylistID, i).GameMode);
if (CBase.Game.GetNumSongs() > 0)
CBase.Graphics.FadeTo(EScreens.ScreenNames);
CBase.Graphics.FadeTo(EScreen.Names);
}
}
@@ -1124,7 +1124,7 @@ namespace VocaluxeLib.Menu
CBase.Game.AddSong(CBase.Playlist.GetSong(ActivePlaylistID, selected).SongID, CBase.Playlist.GetSong(ActivePlaylistID, selected).GameMode);
if (CBase.Game.GetNumSongs() > 0)
CBase.Graphics.FadeTo(EScreens.ScreenNames);
CBase.Graphics.FadeTo(EScreen.Names);
}
private void _Update()
+4
View File
@@ -42,6 +42,10 @@ namespace VocaluxeLib.Menu
void OnClose();
SRectF ScreenArea { get; }
/// <summary>
/// Type of currently playing music
/// </summary>
EMusicType CurrentMusicType { get; }
void NextElement();
void PrevElement();
@@ -243,7 +243,7 @@ namespace VocaluxeLib.Menu.SongMenu
public virtual void OnHide()
{
if (CBase.Graphics.GetNextScreen() != EScreens.ScreenNames || CBase.Config.GetBackgroundMusicStatus() == EBackgroundMusicOffOn.TR_CONFIG_OFF)
if (CBase.Graphics.GetNextScreenType() != EScreen.Names || CBase.Config.GetBackgroundMusicStatus() == EBackgroundMusicOffOn.TR_CONFIG_OFF)
_ResetPreview();
}
@@ -454,7 +454,7 @@ namespace VocaluxeLib.Menu.SongMenu
}
if (CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_OFF && !songOptions.Selection.PartyMode)
{
CBase.Graphics.FadeTo(EScreens.ScreenMain);
CBase.Graphics.FadeTo(EScreen.Main);
return true;
}
}
+6 -26
View File
@@ -15,7 +15,6 @@
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
#endregion
using System;
using System.Collections.Generic;
using VocaluxeLib.Menu;
@@ -35,10 +34,7 @@ namespace VocaluxeLib.PartyModes
}
#region Implementation
public virtual bool Init()
{
return false;
}
public abstract bool Init();
public void LoadTheme()
{
@@ -74,25 +70,9 @@ namespace VocaluxeLib.PartyModes
entry.Value.SaveTheme();
}
public virtual void DataFromScreen(string screenName, Object data) {}
public virtual void UpdateGame() {}
public virtual CMenuParty GetNextPartyScreen(out EScreens alternativeScreen)
{
alternativeScreen = EScreens.ScreenMain;
return null;
}
public virtual EScreens GetStartScreen()
{
return EScreens.ScreenSong;
}
public virtual EScreens GetMainScreen()
{
return EScreens.ScreenSong;
}
public abstract IMenu GetStartScreen();
public virtual SScreenSongOptions GetScreenSongOptions()
{
@@ -157,21 +137,21 @@ namespace VocaluxeLib.PartyModes
_ScreenSongOptions.Selection.NumJokers[teamNr]--;
}
public virtual void SongSelected(int songID) {}
public abstract void SongSelected(int songID);
public virtual void FinishedSinging()
{
CBase.Graphics.FadeTo(EScreens.ScreenScore);
CBase.Graphics.FadeTo(EScreen.Score);
}
public virtual void LeavingScore()
{
CBase.Graphics.FadeTo(EScreens.ScreenHighscore);
CBase.Graphics.FadeTo(EScreen.Highscore);
}
public virtual void LeavingHighscore()
{
CBase.Graphics.FadeTo(EScreens.ScreenSong);
CBase.Graphics.FadeTo(EScreen.Song);
}
#endregion Implementation
}
+16
View File
@@ -16,6 +16,7 @@
#endregion
using System;
using VocaluxeLib.Menu;
namespace VocaluxeLib.PartyModes
{
@@ -37,6 +38,16 @@ namespace VocaluxeLib.PartyModes
_ScreenSongOptions.Sorting.DuetOptions = EDuetOptions.All;
}
public override bool Init()
{
return true;
}
public override IMenu GetStartScreen()
{
return CBase.Graphics.GetScreen(EScreen.Names);
}
public override SScreenSongOptions GetScreenSongOptions()
{
_ScreenSongOptions.Sorting.SongSorting = CBase.Config.GetSongSorting();
@@ -55,5 +66,10 @@ namespace VocaluxeLib.PartyModes
_ScreenSongOptions.Sorting.SearchString = searchString;
_ScreenSongOptions.Sorting.SearchActive = visible;
}
public override void SongSelected(int songID)
{
CBase.Graphics.FadeTo(EScreen.Sing);
}
}
}
@@ -1,87 +0,0 @@
#region license
// This file is part of Vocaluxe.
//
// Vocaluxe is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Vocaluxe is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
#endregion
using System.Windows.Forms;
using VocaluxeLib.Menu;
namespace VocaluxeLib.PartyModes
{
public class CScreenPartyDummy : CMenuParty
{
// Version number for theme files. Increment it, if you've changed something on the theme files!
protected override int _ScreenVersion
{
get { return 1; }
}
private CText _Warning;
public override void LoadTheme(string xmlPath)
{
_Warning = GetNewText();
_Warning.Font.Height = 100f;
_Warning.X = 150;
_Warning.Y = 300;
_Warning.Color = new SColorF(1f, 0f, 0f, 1f);
_Warning.SelColor = new SColorF(1f, 0f, 0f, 1f);
_Warning.Text = "SOMETHING WENT WRONG!";
_AddText(_Warning);
}
public override void ReloadTheme(string xmlPath) {}
public override void ReloadSkin() {}
public override void SaveTheme() {}
public override void UnloadSkin() {}
public override bool HandleInput(SKeyEvent keyEvent)
{
base.HandleInput(keyEvent);
if (keyEvent.KeyPressed) {}
else
{
switch (keyEvent.Key)
{
case Keys.Back:
case Keys.Escape:
_FadeTo(EScreens.ScreenParty);
break;
}
}
return true;
}
public override bool HandleMouse(SMouseEvent mouseEvent)
{
base.HandleMouse(mouseEvent);
if (mouseEvent.LB && _IsMouseOverCurSelection(mouseEvent)) {}
if (mouseEvent.RB)
_FadeTo(EScreens.ScreenParty);
return true;
}
public override bool UpdateGame()
{
return true;
}
}
}
+1 -5
View File
@@ -15,7 +15,6 @@
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
#endregion
using System;
using VocaluxeLib.Menu;
namespace VocaluxeLib.PartyModes
@@ -91,13 +90,10 @@ namespace VocaluxeLib.PartyModes
void AddScreen(CMenuParty screen, string screenName);
void SaveScreens();
void DataFromScreen(string screenName, Object data);
void UpdateGame();
CMenuParty GetNextPartyScreen(out EScreens alternativeScreen);
EScreens GetStartScreen();
EScreens GetMainScreen();
IMenu GetStartScreen();
SScreenSongOptions GetScreenSongOptions();
void OnSongChange(int songIndex, ref SScreenSongOptions screenSongOptions);
+2 -3
View File
@@ -71,7 +71,7 @@ namespace VocaluxeLib.Utils.Player
public bool IsFinished
{
get { return RepeatSong ? false : CBase.Sound.IsFinished(_StreamID); }
get { return !RepeatSong && CBase.Sound.IsFinished(_StreamID); }
}
public CSoundPlayer(bool loop = false)
@@ -145,9 +145,8 @@ namespace VocaluxeLib.Utils.Player
if (_StreamID == -1 || !IsPlaying)
return;
float timeToPlay;
float len = CBase.Sound.GetLength(_StreamID);
timeToPlay = (len > 0f) ? len - CBase.Sound.GetPosition(_StreamID) : _FadeTime + 1f;
float timeToPlay = (len > 0f) ? len - CBase.Sound.GetPosition(_StreamID) : _FadeTime + 1f;
bool finished = CBase.Sound.IsFinished(_StreamID);
if (timeToPlay <= _FadeTime || finished)
-1
View File
@@ -139,7 +139,6 @@
<Compile Include="Structs.cs" />
<Compile Include="PartyModes\CPartyMode.cs" />
<Compile Include="PartyModes\CPartyModeNone.cs" />
<Compile Include="PartyModes\CScreenPartyDummy.cs" />
<Compile Include="PartyModes\IPartyMode.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Utils\CWavFile.cs" />
+2 -1
View File
@@ -44,7 +44,8 @@ namespace VocaluxeLib.Xml
/// Attribute for float fields to enforce normalized (0&lt;=x&lt;=1) values
/// </summary>
[AttributeUsage(AttributeTargets.Field)]
public class XmlNormalizedAttribute : XmlRangedAttribute {
public class XmlNormalizedAttribute : XmlRangedAttribute
{
public XmlNormalizedAttribute() : base(0, 1) {}
}