Merge pull request #123 from Flamefire/develop

Bugfixes
This commit is contained in:
Stephan Sundermann committed 2014-12-07 23:53:55 +01:00
commit 18bdb7aa05
7 files changed
+155 -198

No files matched your search

@@ -17,8 +17,11 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using VocaluxeLib.Menu; using VocaluxeLib.Menu;
using VocaluxeLib.Songs;
[assembly: ComVisible(false)] [assembly: ComVisible(false)]
@@ -105,7 +108,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
public List<int> Songs; public List<int> Songs;
public int CurrentRoundNr; public int CurrentRoundNr;
public int SingRoundNr; public int FieldNr;
public int[] NumJokerRandom; public int[] NumJokerRandom;
public int[] NumJokerRetry; public int[] NumJokerRetry;
@@ -136,7 +139,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
PlayerTeam1 = new List<int>(), PlayerTeam1 = new List<int>(),
PlayerTeam2 = new List<int>(), PlayerTeam2 = new List<int>(),
CurrentRoundNr = 0, CurrentRoundNr = 0,
SingRoundNr = 0, FieldNr = 0,
SongSource = ESongSource.TR_ALLSONGS, SongSource = ESongSource.TR_ALLSONGS,
PlaylistID = 0, PlaylistID = 0,
CategoryID = 0, CategoryID = 0,
@@ -160,10 +163,10 @@ namespace VocaluxeLib.PartyModes.TicTacToe
if (CBase.Config.GetTabs() == EOffOn.TR_CONFIG_ON && _ScreenSongOptions.Sorting.SongSorting != ESongSorting.TR_CONFIG_NONE) if (CBase.Config.GetTabs() == EOffOn.TR_CONFIG_ON && _ScreenSongOptions.Sorting.SongSorting != ESongSorting.TR_CONFIG_NONE)
_ScreenSongOptions.Sorting.Tabs = EOffOn.TR_CONFIG_ON; _ScreenSongOptions.Sorting.Tabs = EOffOn.TR_CONFIG_ON;
GameData.Songs = new List<int>(); GameData.Songs.Clear();
GameData.Rounds = new List<CRound>(); GameData.Rounds.Clear();
GameData.PlayerTeam1 = new List<int>(); GameData.PlayerTeam1.Clear();
GameData.PlayerTeam2 = new List<int>(); GameData.PlayerTeam2.Clear();
return true; return true;
} }
@@ -195,7 +198,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
private void _FadeToScreen() private void _FadeToScreen()
{ {
if(CBase.Graphics.GetNextScreen() != _GetNextScreen()) if (CBase.Graphics.GetNextScreen() != _GetNextScreen())
CBase.Graphics.FadeTo(_GetNextScreen()); CBase.Graphics.FadeTo(_GetNextScreen());
} }
@@ -214,16 +217,14 @@ namespace VocaluxeLib.PartyModes.TicTacToe
_CreateRounds(); _CreateRounds();
_SetNumJokers(); _SetNumJokers();
_PreparePlayerList(0); _PreparePlayerList(0);
_PrepareSongList();
break; break;
case EStage.Main: case EStage.Main:
_Stage = EStage.Singing; _Stage = EStage.Singing;
_StartRound(GameData.SingRoundNr); _StartRound(GameData.FieldNr);
break; break;
case EStage.Singing: case EStage.Singing:
_Stage = EStage.Main; _Stage = EStage.Main;
GameData.Team = GameData.Team == 1 ? 0 : 1; GameData.Team = GameData.Team == 1 ? 0 : 1;
_UpdateSongList();
_UpdatePlayerList(); _UpdatePlayerList();
break; break;
default: default:
@@ -258,31 +259,22 @@ namespace VocaluxeLib.PartyModes.TicTacToe
public override SScreenSongOptions GetScreenSongOptions() public override SScreenSongOptions GetScreenSongOptions()
{ {
_ScreenSongOptions.Sorting.SongSorting = CBase.Config.GetSongSorting(); throw new ArgumentException("Not required!");
_ScreenSongOptions.Sorting.Tabs = CBase.Config.GetTabs();
_ScreenSongOptions.Sorting.IgnoreArticles = CBase.Config.GetIgnoreArticles();
return _ScreenSongOptions;
} }
// ReSharper disable RedundantAssignment
public override void OnSongChange(int songIndex, ref SScreenSongOptions screenSongOptions) public override void OnSongChange(int songIndex, ref SScreenSongOptions screenSongOptions)
// ReSharper restore RedundantAssignment
{ {
screenSongOptions = _ScreenSongOptions; throw new ArgumentException("Not required!");
} }
// ReSharper disable RedundantAssignment
public override void OnCategoryChange(int categoryIndex, ref SScreenSongOptions screenSongOptions) public override void OnCategoryChange(int categoryIndex, ref SScreenSongOptions screenSongOptions)
// ReSharper restore RedundantAssignment
{ {
screenSongOptions = _ScreenSongOptions; throw new ArgumentException("Not required!");
} }
public override void SetSearchString(string searchString, bool visible) public override void SetSearchString(string searchString, bool visible)
{ {
_ScreenSongOptions.Sorting.SearchString = searchString; throw new ArgumentException("Not required!");
_ScreenSongOptions.Sorting.SearchActive = visible;
} }
public override int GetMaxPlayer() public override int GetMaxPlayer()
@@ -324,25 +316,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
public override void SongSelected(int songID) public override void SongSelected(int songID)
{ {
var gm = EGameMode.TR_GAMEMODE_NORMAL; throw new ArgumentException("Not required!");
switch (GameData.GameMode)
{
case EPartyGameMode.TR_GAMEMODE_NORMAL:
gm = EGameMode.TR_GAMEMODE_NORMAL;
break;
case EPartyGameMode.TR_GAMEMODE_DUET:
gm = EGameMode.TR_GAMEMODE_DUET;
break;
case EPartyGameMode.TR_GAMEMODE_SHORTSONG:
gm = EGameMode.TR_GAMEMODE_SHORTSONG;
break;
}
CBase.Game.AddSong(songID, gm);
CBase.Graphics.FadeTo(EScreen.Sing);
} }
public override void LeavingHighscore() public override void LeavingHighscore()
@@ -457,10 +431,23 @@ namespace VocaluxeLib.PartyModes.TicTacToe
} }
} }
private void _PrepareSongList() private static void _Shuffle<T>(IList<T> list)
{ {
var gm = EGameMode.TR_GAMEMODE_NORMAL; for (int n = list.Count - 1; n >= 1; n--)
{
int k = CBase.Game.GetRandom(n);
T value = list[k];
list[k] = list[n];
list[n] = value;
}
}
public void UpdateSongList()
{
if (GameData.Songs.Count > 0)
return;
EGameMode gm;
switch (GameData.GameMode) switch (GameData.GameMode)
{ {
case EPartyGameMode.TR_GAMEMODE_NORMAL: case EPartyGameMode.TR_GAMEMODE_NORMAL:
@@ -474,61 +461,37 @@ namespace VocaluxeLib.PartyModes.TicTacToe
case EPartyGameMode.TR_GAMEMODE_SHORTSONG: case EPartyGameMode.TR_GAMEMODE_SHORTSONG:
gm = EGameMode.TR_GAMEMODE_SHORTSONG; gm = EGameMode.TR_GAMEMODE_SHORTSONG;
break; break;
default:
gm = EGameMode.TR_GAMEMODE_NORMAL;
break;
} }
while (GameData.Songs.Count < (GameData.NumFields + GameData.NumJokerRandom[0] + GameData.NumJokerRandom[1])) switch (GameData.SongSource)
{ {
var songs = new List<int>(); case ESongSource.TR_PLAYLIST:
switch (GameData.SongSource) for (int i = 0; i < CBase.Playlist.GetSongCount(GameData.PlaylistID); i++)
{ {
case ESongSource.TR_PLAYLIST: int id = CBase.Playlist.GetSong(GameData.PlaylistID, i).SongID;
for (int i = 0; i < CBase.Playlist.GetSongCount(GameData.PlaylistID); i++) if (CBase.Songs.GetSongByID(id).AvailableGameModes.Contains(gm))
{ GameData.Songs.Add(id);
int id = CBase.Playlist.GetSong(GameData.PlaylistID, i).SongID; }
// ReSharper disable LoopCanBeConvertedToQuery break;
foreach (EGameMode mode in CBase.Songs.GetSongByID(id).AvailableGameModes)
// ReSharper restore LoopCanBeConvertedToQuery
{
if (mode == gm)
songs.Add(id);
}
}
break;
case ESongSource.TR_ALLSONGS: case ESongSource.TR_ALLSONGS:
for (int i = 0; i < CBase.Songs.GetNumSongs(); i++) ReadOnlyCollection<CSong> avSongs = CBase.Songs.GetSongs();
{ GameData.Songs.AddRange(avSongs.Where(song => song.AvailableGameModes.Contains(gm)).Select(song => song.ID));
// ReSharper disable LoopCanBeConvertedToQuery break;
foreach (EGameMode mode in CBase.Songs.GetSongByID(i).AvailableGameModes)
// ReSharper restore LoopCanBeConvertedToQuery
{
if (mode == gm)
songs.Add(i);
}
}
break;
case ESongSource.TR_CATEGORY: case ESongSource.TR_CATEGORY:
CBase.Songs.SetCategory(GameData.CategoryID); CBase.Songs.SetCategory(GameData.CategoryID);
for (int i = 0; i < CBase.Songs.GetNumSongsVisible(); i++) avSongs = CBase.Songs.GetVisibleSongs();
{ GameData.Songs.AddRange(avSongs.Where(song => song.AvailableGameModes.Contains(gm)).Select(song => song.ID));
// ReSharper disable LoopCanBeConvertedToQuery
foreach (EGameMode mode in CBase.Songs.GetVisibleSong(i).AvailableGameModes) CBase.Songs.SetCategory(-1);
// ReSharper restore LoopCanBeConvertedToQuery break;
{
if (mode == gm)
songs.Add(CBase.Songs.GetVisibleSong(i).ID);
}
}
CBase.Songs.SetCategory(-1);
break;
}
while (songs.Count > 0)
{
GameData.Songs.Add(songs[CBase.Game.GetRandom(songs.Count - 1)]);
songs.Remove(GameData.Songs[GameData.Songs.Count - 1]);
}
} }
_Shuffle(GameData.Songs);
} }
private void _UpdatePlayerList() private void _UpdatePlayerList()
@@ -539,12 +502,6 @@ namespace VocaluxeLib.PartyModes.TicTacToe
_PreparePlayerList(2); _PreparePlayerList(2);
} }
private void _UpdateSongList()
{
if (GameData.Songs.Count == 0)
_PrepareSongList();
}
private void _StartRound(int roundNr) private void _StartRound(int roundNr)
{ {
CBase.Game.Reset(); CBase.Game.Reset();
@@ -559,8 +516,8 @@ namespace VocaluxeLib.PartyModes.TicTacToe
if (players.Length < 2) if (players.Length < 2)
return; return;
CRound r = GameData.Rounds[roundNr]; CRound round = GameData.Rounds[roundNr];
bool isDuet = CBase.Songs.GetSongByID(r.SongID).IsDuet; bool isDuet = CBase.Songs.GetSongByID(round.SongID).IsDuet;
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
@@ -569,18 +526,31 @@ namespace VocaluxeLib.PartyModes.TicTacToe
} }
//try to fill with the right data //try to fill with the right data
if (r != null) players[0].ProfileID = GameData.ProfileIDsTeam1[round.SingerTeam1];
if (isDuet)
players[0].VoiceNr = 0;
players[1].ProfileID = GameData.ProfileIDsTeam2[round.SingerTeam2];
if (isDuet)
players[1].VoiceNr = 1;
var gm = EGameMode.TR_GAMEMODE_NORMAL;
switch (GameData.GameMode)
{ {
players[0].ProfileID = GameData.ProfileIDsTeam1[r.SingerTeam1]; case EPartyGameMode.TR_GAMEMODE_NORMAL:
if (isDuet) gm = EGameMode.TR_GAMEMODE_NORMAL;
players[0].VoiceNr = 0; break;
players[1].ProfileID = GameData.ProfileIDsTeam2[r.SingerTeam2]; case EPartyGameMode.TR_GAMEMODE_DUET:
if (isDuet) gm = EGameMode.TR_GAMEMODE_DUET;
players[1].VoiceNr = 1; break;
SongSelected(r.SongID); case EPartyGameMode.TR_GAMEMODE_SHORTSONG:
gm = EGameMode.TR_GAMEMODE_SHORTSONG;
break;
} }
CBase.Game.AddSong(round.SongID, gm);
} }
private void _SetNumJokers() private void _SetNumJokers()
@@ -612,7 +582,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
private void _UpdateScores() private void _UpdateScores()
{ {
if (!GameData.Rounds[GameData.SingRoundNr].Finished) if (!GameData.Rounds[GameData.FieldNr].Finished)
GameData.CurrentRoundNr++; GameData.CurrentRoundNr++;
SPlayer[] results = CBase.Game.GetPlayers(); SPlayer[] results = CBase.Game.GetPlayers();
@@ -622,16 +592,16 @@ namespace VocaluxeLib.PartyModes.TicTacToe
if (results.Length < 2) if (results.Length < 2)
return; return;
GameData.Rounds[GameData.SingRoundNr].PointsTeam1 = (int)Math.Round(results[0].Points); GameData.Rounds[GameData.FieldNr].PointsTeam1 = (int)Math.Round(results[0].Points);
GameData.Rounds[GameData.SingRoundNr].PointsTeam2 = (int)Math.Round(results[1].Points); GameData.Rounds[GameData.FieldNr].PointsTeam2 = (int)Math.Round(results[1].Points);
GameData.Rounds[GameData.SingRoundNr].Finished = true; GameData.Rounds[GameData.FieldNr].Finished = true;
if (GameData.Rounds[GameData.SingRoundNr].PointsTeam1 < GameData.Rounds[GameData.SingRoundNr].PointsTeam2) if (GameData.Rounds[GameData.FieldNr].PointsTeam1 < GameData.Rounds[GameData.FieldNr].PointsTeam2)
GameData.Rounds[GameData.SingRoundNr].Winner = 2; GameData.Rounds[GameData.FieldNr].Winner = 2;
else if (GameData.Rounds[GameData.SingRoundNr].PointsTeam1 > GameData.Rounds[GameData.SingRoundNr].PointsTeam2) else if (GameData.Rounds[GameData.FieldNr].PointsTeam1 > GameData.Rounds[GameData.FieldNr].PointsTeam2)
GameData.Rounds[GameData.SingRoundNr].Winner = 1; GameData.Rounds[GameData.FieldNr].Winner = 1;
else else
{ {
GameData.Rounds[GameData.SingRoundNr].Finished = false; GameData.Rounds[GameData.FieldNr].Finished = false;
GameData.CurrentRoundNr--; GameData.CurrentRoundNr--;
} }
} }
@@ -23,12 +23,6 @@ using VocaluxeLib.Songs;
namespace VocaluxeLib.PartyModes.TicTacToe namespace VocaluxeLib.PartyModes.TicTacToe
{ {
public class CField
{
public CRound Content;
public CButton Button;
}
public enum EStatus public enum EStatus
{ {
FieldChoosing, FieldChoosing,
@@ -73,14 +67,13 @@ namespace VocaluxeLib.PartyModes.TicTacToe
private bool _ExitPopupVisible; private bool _ExitPopupVisible;
private List<CField> _Fields; private List<CButton> _Fields = new List<CButton>();
private float _FieldFirstX = 25; private float _FieldFirstX = 25;
private float _FieldFirstY = 25; private float _FieldFirstY = 25;
private const int _FieldSpace = 10; private const int _FieldSpace = 10;
private float _FieldSize = 100; private float _FieldSize = 100;
private int _PreviewStream = -1; private int _PreviewStream = -1;
private int _SelectedField = -1;
private int _OldSelectedField = -1; private int _OldSelectedField = -1;
private int[,] _Possibilities; private int[,] _Possibilities;
@@ -98,8 +91,6 @@ namespace VocaluxeLib.PartyModes.TicTacToe
_ButtonJokerRetryT2 _ButtonJokerRetryT2
}; };
_ThemeStatics = new string[] {_StaticPopupBG, _StaticAvatarT1, _StaticAvatarT2}; _ThemeStatics = new string[] {_StaticPopupBG, _StaticAvatarT1, _StaticAvatarT2};
_Fields = new List<CField>();
} }
public override void LoadTheme(string xmlPath) public override void LoadTheme(string xmlPath)
@@ -150,17 +141,17 @@ namespace VocaluxeLib.PartyModes.TicTacToe
switch (_Status) switch (_Status)
{ {
case EStatus.FieldChoosing: case EStatus.FieldChoosing:
if (_Fields[i].Button.Selected) if (_Fields[i].Selected)
{ {
_SelectedField = i; _PartyMode.GameData.FieldNr = i;
_FieldSelected(); _FieldSelected();
} }
break; break;
case EStatus.JokerRetry: case EStatus.JokerRetry:
if (_Fields[i].Button.Selected) if (_Fields[i].Selected)
{ {
_SelectedField = i; _PartyMode.GameData.FieldNr = i;
_FieldSelectedAgain(); _FieldSelectedAgain();
} }
break; break;
@@ -215,17 +206,17 @@ namespace VocaluxeLib.PartyModes.TicTacToe
switch (_Status) switch (_Status)
{ {
case EStatus.FieldChoosing: case EStatus.FieldChoosing:
if (_Fields[i].Button.Selected) if (_Fields[i].Selected)
{ {
_SelectedField = i; _PartyMode.GameData.FieldNr = i;
_FieldSelected(); _FieldSelected();
} }
break; break;
case EStatus.JokerRetry: case EStatus.JokerRetry:
if (_Fields[i].Button.Selected) if (_Fields[i].Selected)
{ {
_SelectedField = i; _PartyMode.GameData.FieldNr = i;
_FieldSelectedAgain(); _FieldSelectedAgain();
} }
break; break;
@@ -281,7 +272,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
if (_PartyMode.GameData.CurrentRoundNr == 1) if (_PartyMode.GameData.CurrentRoundNr == 1)
{ {
_BuildWinnerPossibilities(); _BuildWinnerPossibilities();
_SelectedField = -1; _PartyMode.GameData.FieldNr = -1;
_Buttons[_ButtonBack].Visible = true; _Buttons[_ButtonBack].Visible = true;
_Buttons[_ButtonExit].Visible = false; _Buttons[_ButtonExit].Visible = false;
_SelectElement(_Buttons[_ButtonBack]); _SelectElement(_Buttons[_ButtonBack]);
@@ -354,10 +345,9 @@ namespace VocaluxeLib.PartyModes.TicTacToe
{ {
for (int i = 0; i < 25; i++) for (int i = 0; i < 25; i++)
{ {
var f = new CField {Button = GetNewButton(_Buttons[_ButtonField])}; CButton f = GetNewButton(_Buttons[_ButtonField]);
f.Button.Visible = false; f.Visible = false;
f.Content = new CRound(); _AddButton(f);
_AddButton(f.Button);
_Fields.Add(f); _Fields.Add(f);
} }
} }
@@ -378,12 +368,12 @@ namespace VocaluxeLib.PartyModes.TicTacToe
{ {
if (i < _PartyMode.GameData.NumFields) if (i < _PartyMode.GameData.NumFields)
{ {
_Fields[i].Button.W = _FieldSize; _Fields[i].W = _FieldSize;
_Fields[i].Button.H = _FieldSize; _Fields[i].H = _FieldSize;
_Fields[i].Button.X = x; _Fields[i].X = x;
_Fields[i].Button.Y = y; _Fields[i].Y = y;
_Fields[i].Button.Visible = true; _Fields[i].Visible = true;
_Fields[i].Button.Selectable = true; _Fields[i].Selectable = true;
column++; column++;
if ((i + 1) >= numOneRow * (row + 1)) if ((i + 1) >= numOneRow * (row + 1))
{ {
@@ -397,8 +387,8 @@ namespace VocaluxeLib.PartyModes.TicTacToe
} }
else else
{ {
_Fields[i].Button.Visible = false; _Fields[i].Visible = false;
_Fields[i].Button.Selectable = false; _Fields[i].Selectable = false;
} }
} }
} }
@@ -407,34 +397,33 @@ namespace VocaluxeLib.PartyModes.TicTacToe
{ {
for (int i = 0; i < _PartyMode.GameData.Rounds.Count; i++) for (int i = 0; i < _PartyMode.GameData.Rounds.Count; i++)
{ {
_Fields[i].Button.Selectable = true; _Fields[i].Selectable = true;
_Fields[i].Button.Texture = _Buttons[_ButtonField].Texture; _Fields[i].Texture = _Buttons[_ButtonField].Texture;
_Fields[i].Button.Color = _Buttons[_ButtonField].Color; _Fields[i].Color = _Buttons[_ButtonField].Color;
_Fields[i].Button.SelColor = _Buttons[_ButtonField].SelColor; _Fields[i].SelColor = _Buttons[_ButtonField].SelColor;
_Fields[i].Content = _PartyMode.GameData.Rounds[i]; if (_PartyMode.GameData.Rounds[i].Finished)
if (_Fields[i].Content.Finished)
{ {
_Fields[i].Button.Selectable = false; _Fields[i].Selectable = false;
_Fields[i].Button.Texture = CBase.Songs.GetSongByID(_Fields[i].Content.SongID).CoverTextureBig; _Fields[i].Texture = CBase.Songs.GetSongByID(_PartyMode.GameData.Rounds[i].SongID).CoverTextureBig;
_Fields[i].Button.Color = CBase.Themes.GetPlayerColor(_Fields[i].Content.Winner); _Fields[i].Color = CBase.Themes.GetPlayerColor(_PartyMode.GameData.Rounds[i].Winner);
_Fields[i].Button.SelColor = CBase.Themes.GetPlayerColor(_Fields[i].Content.Winner); _Fields[i].SelColor = CBase.Themes.GetPlayerColor(_PartyMode.GameData.Rounds[i].Winner);
} }
if (_Status == EStatus.FieldSelected && _SelectedField == i) if (_Status == EStatus.FieldSelected && _PartyMode.GameData.FieldNr == i)
{ {
_Fields[i].Button.Texture = CBase.Songs.GetSongByID(_Fields[i].Content.SongID).CoverTextureBig; _Fields[i].Texture = CBase.Songs.GetSongByID(_PartyMode.GameData.Rounds[i].SongID).CoverTextureBig;
_Fields[i].Button.Color = new SColorF(1, 1, 1, 1); _Fields[i].Color = new SColorF(1, 1, 1, 1);
_Fields[i].Button.SelColor = new SColorF(1, 1, 1, 1); _Fields[i].SelColor = new SColorF(1, 1, 1, 1);
_Fields[i].Button.Selectable = false; _Fields[i].Selectable = false;
} }
if (_Status == EStatus.JokerRetry && _Fields[i].Content.Finished) if (_Status == EStatus.JokerRetry && _PartyMode.GameData.Rounds[i].Finished)
{ {
_Fields[i].Button.SelColor = CBase.Themes.GetPlayerColor(_PartyMode.GameData.Team + 1); _Fields[i].SelColor = CBase.Themes.GetPlayerColor(_PartyMode.GameData.Team + 1);
_Fields[i].Button.Selectable = true; _Fields[i].Selectable = true;
} }
if (_Status == EStatus.JokerRetry && !_Fields[i].Content.Finished) if (_Status == EStatus.JokerRetry && !_PartyMode.GameData.Rounds[i].Finished)
_Fields[i].Button.Selectable = false; _Fields[i].Selectable = false;
if (_Status == EStatus.FieldSelected) if (_Status == EStatus.FieldSelected)
_Fields[i].Button.Selectable = false; _Fields[i].Selectable = false;
} }
} }
@@ -456,22 +445,18 @@ namespace VocaluxeLib.PartyModes.TicTacToe
singerTeam2 = _PartyMode.GameData.PlayerTeam2[0]; singerTeam2 = _PartyMode.GameData.PlayerTeam2[0];
_PartyMode.GameData.PlayerTeam2.RemoveAt(0); _PartyMode.GameData.PlayerTeam2.RemoveAt(0);
} }
_PartyMode.GameData.Rounds[_SelectedField].SingerTeam1 = singerTeam1; _PartyMode.GameData.Rounds[_PartyMode.GameData.FieldNr].SingerTeam1 = singerTeam1;
_PartyMode.GameData.Rounds[_SelectedField].SingerTeam2 = singerTeam2; _PartyMode.GameData.Rounds[_PartyMode.GameData.FieldNr].SingerTeam2 = singerTeam2;
_UpdatePlayerInformation(); _UpdatePlayerInformation();
} }
int songID = 0; _PartyMode.UpdateSongList();
if (_PartyMode.GameData.Songs.Count > 0) int songID = _PartyMode.GameData.Songs[0];
{ _PartyMode.GameData.Songs.RemoveAt(0);
songID = _PartyMode.GameData.Songs[0];
_PartyMode.GameData.Songs.RemoveAt(0);
}
_StartPreview(songID); _StartPreview(songID);
_Status = EStatus.FieldSelected; _Status = EStatus.FieldSelected;
_Fields[_SelectedField].Content.SongID = songID; _PartyMode.GameData.Rounds[_PartyMode.GameData.FieldNr].SongID = songID;
_PartyMode.GameData.Rounds[_SelectedField].SongID = songID;
_UpdateFieldContents(); _UpdateFieldContents();
_UpdateJokerButtons(); _UpdateJokerButtons();
@@ -484,13 +469,12 @@ namespace VocaluxeLib.PartyModes.TicTacToe
private void _FieldSelectedAgain() private void _FieldSelectedAgain()
{ {
int songID = _Fields[_SelectedField].Content.SongID; int songID = _PartyMode.GameData.Rounds[_OldSelectedField].SongID;
_StartPreview(songID); _StartPreview(songID);
_Status = EStatus.FieldSelected; _Status = EStatus.FieldSelected;
_Fields[_SelectedField].Content.SongID = songID; _PartyMode.GameData.Rounds[_PartyMode.GameData.FieldNr].SongID = songID;
_PartyMode.GameData.Rounds[_SelectedField].SongID = songID; _PartyMode.GameData.Rounds[_PartyMode.GameData.FieldNr].SingerTeam1 = _PartyMode.GameData.Rounds[_OldSelectedField].SingerTeam1;
_PartyMode.GameData.Rounds[_SelectedField].SingerTeam1 = _PartyMode.GameData.Rounds[_OldSelectedField].SingerTeam1; _PartyMode.GameData.Rounds[_PartyMode.GameData.FieldNr].SingerTeam2 = _PartyMode.GameData.Rounds[_OldSelectedField].SingerTeam2;
_PartyMode.GameData.Rounds[_SelectedField].SingerTeam2 = _PartyMode.GameData.Rounds[_OldSelectedField].SingerTeam2;
_UpdateFieldContents(); _UpdateFieldContents();
_UpdatePlayerInformation(); _UpdatePlayerInformation();
@@ -522,12 +506,14 @@ namespace VocaluxeLib.PartyModes.TicTacToe
_Texts[_TextNextPlayerT2].Visible = true; _Texts[_TextNextPlayerT2].Visible = true;
_Texts[_TextNextPlayerNameT1].Visible = true; _Texts[_TextNextPlayerNameT1].Visible = true;
_Texts[_TextNextPlayerNameT2].Visible = true; _Texts[_TextNextPlayerNameT2].Visible = true;
_Texts[_TextNextPlayerNameT1].Text = CBase.Profiles.GetPlayerName(_PartyMode.GameData.ProfileIDsTeam1[_PartyMode.GameData.Rounds[_SelectedField].SingerTeam1]); _Texts[_TextNextPlayerNameT1].Text =
_Texts[_TextNextPlayerNameT2].Text = CBase.Profiles.GetPlayerName(_PartyMode.GameData.ProfileIDsTeam2[_PartyMode.GameData.Rounds[_SelectedField].SingerTeam2]); CBase.Profiles.GetPlayerName(_PartyMode.GameData.ProfileIDsTeam1[_PartyMode.GameData.Rounds[_PartyMode.GameData.FieldNr].SingerTeam1]);
_Texts[_TextNextPlayerNameT2].Text =
CBase.Profiles.GetPlayerName(_PartyMode.GameData.ProfileIDsTeam2[_PartyMode.GameData.Rounds[_PartyMode.GameData.FieldNr].SingerTeam2]);
_Statics[_StaticAvatarT1].Visible = true; _Statics[_StaticAvatarT1].Visible = true;
_Statics[_StaticAvatarT2].Visible = true; _Statics[_StaticAvatarT2].Visible = true;
_Statics[_StaticAvatarT1].Texture = CBase.Profiles.GetAvatar(_PartyMode.GameData.ProfileIDsTeam1[_PartyMode.GameData.Rounds[_SelectedField].SingerTeam1]); _Statics[_StaticAvatarT1].Texture = CBase.Profiles.GetAvatar(_PartyMode.GameData.ProfileIDsTeam1[_PartyMode.GameData.Rounds[_PartyMode.GameData.FieldNr].SingerTeam1]);
_Statics[_StaticAvatarT2].Texture = CBase.Profiles.GetAvatar(_PartyMode.GameData.ProfileIDsTeam2[_PartyMode.GameData.Rounds[_SelectedField].SingerTeam2]); _Statics[_StaticAvatarT2].Texture = CBase.Profiles.GetAvatar(_PartyMode.GameData.ProfileIDsTeam2[_PartyMode.GameData.Rounds[_PartyMode.GameData.FieldNr].SingerTeam2]);
} }
private void _UseJoker(int teamNr, int jokerNum) private void _UseJoker(int teamNr, int jokerNum)
@@ -554,8 +540,8 @@ namespace VocaluxeLib.PartyModes.TicTacToe
if (!CBase.Sound.IsFinished(_PreviewStream)) if (!CBase.Sound.IsFinished(_PreviewStream))
CBase.Sound.Fade(_PreviewStream, 0, 1, EStreamAction.Close); CBase.Sound.Fade(_PreviewStream, 0, 1, EStreamAction.Close);
_Status = EStatus.JokerRetry; _Status = EStatus.JokerRetry;
_OldSelectedField = _SelectedField; _OldSelectedField = _PartyMode.GameData.FieldNr;
_SelectedField = -1; _PartyMode.GameData.FieldNr = -1;
_UpdateFieldContents(); _UpdateFieldContents();
_Buttons[_ButtonNextRound].Visible = false; _Buttons[_ButtonNextRound].Visible = false;
} }
@@ -587,8 +573,8 @@ namespace VocaluxeLib.PartyModes.TicTacToe
_Buttons[_ButtonJokerRetryT2].Visible = true; _Buttons[_ButtonJokerRetryT2].Visible = true;
_Buttons[_ButtonJokerRetryT1].Text.Text = _PartyMode.GameData.NumJokerRetry[0].ToString(); _Buttons[_ButtonJokerRetryT1].Text.Text = _PartyMode.GameData.NumJokerRetry[0].ToString();
_Buttons[_ButtonJokerRetryT2].Text.Text = _PartyMode.GameData.NumJokerRetry[1].ToString(); _Buttons[_ButtonJokerRetryT2].Text.Text = _PartyMode.GameData.NumJokerRetry[1].ToString();
_Buttons[_ButtonJokerRetryT1].Selectable = _PartyMode.GameData.NumJokerRetry[0] > 0; _Buttons[_ButtonJokerRetryT1].Selectable = _PartyMode.GameData.NumJokerRetry[0] > 0 && _PartyMode.GameData.CurrentRoundNr > 1;
_Buttons[_ButtonJokerRetryT2].Selectable = _PartyMode.GameData.NumJokerRetry[1] > 0; _Buttons[_ButtonJokerRetryT2].Selectable = _PartyMode.GameData.NumJokerRetry[1] > 0 && _PartyMode.GameData.CurrentRoundNr > 1;
} }
private void _NextRound() private void _NextRound()
@@ -658,8 +644,8 @@ namespace VocaluxeLib.PartyModes.TicTacToe
var check = new List<int>(); var check = new List<int>();
for (int j = 0; j < _Possibilities.GetLength(1); j++) for (int j = 0; j < _Possibilities.GetLength(1); j++)
{ {
if (_Fields[_Possibilities[i, j]].Content.Winner > 0) if (_PartyMode.GameData.Rounds[_Possibilities[i, j]].Winner > 0)
check.Add(_Fields[_Possibilities[i, j]].Content.Winner); check.Add(_PartyMode.GameData.Rounds[_Possibilities[i, j]].Winner);
} }
if (check.Count != _Possibilities.GetLength(1)) if (check.Count != _Possibilities.GetLength(1))
continue; continue;
+1 -1
View File
@@ -357,7 +357,7 @@ namespace Vocaluxe.Lib.Draw
/// <returns></returns> /// <returns></returns>
protected CTextureRef _GetTextureReference(Size origSize, TTextureType texture) protected CTextureRef _GetTextureReference(Size origSize, TTextureType texture)
{ {
Debug.Assert(origSize.Width > 0 && origSize.Height > 0); Debug.Assert(origSize.Width > 0 && origSize.Height > 0 || origSize.Width == -1 && origSize.Height == -1);
Debug.Assert(texture != null); Debug.Assert(texture != null);
int id; int id;
lock (_MutexID) lock (_MutexID)
+1
View File
@@ -251,6 +251,7 @@ namespace Vocaluxe.Screens
} }
CBackground bg = new CBackground(_BGTheme, -1); CBackground bg = new CBackground(_BGTheme, -1);
bg.LoadSkin();
_AddBackground(bg); _AddBackground(bg);
//Vocaluxe-Logo //Vocaluxe-Logo
+1
View File
@@ -238,6 +238,7 @@ namespace VocaluxeLib
CSong GetVisibleSong(int visibleIndex); CSong GetVisibleSong(int visibleIndex);
CSong GetSongByID(int songID); CSong GetSongByID(int songID);
ReadOnlyCollection<CSong> GetSongs();
ReadOnlyCollection<CSong> GetVisibleSongs(); ReadOnlyCollection<CSong> GetVisibleSongs();
CCategory GetCategory(int index); CCategory GetCategory(int index);
-2
View File
@@ -84,8 +84,6 @@ namespace VocaluxeLib.Menu
_PartyModeID = partyModeID; _PartyModeID = partyModeID;
ThemeLoaded = true; ThemeLoaded = true;
LoadSkin();
} }
#endregion Constructors #endregion Constructors
@@ -667,6 +667,7 @@ namespace VocaluxeLib.Menu
_CurrentTeam = _SelectSlides[_SelectSlideTeams].Selection; _CurrentTeam = _SelectSlides[_SelectSlideTeams].Selection;
_UpdatePlayerSlide(); _UpdatePlayerSlide();
_UpdateButtonState();
} }
private void _UpdatePlayerSlide() private void _UpdatePlayerSlide()