some code reorganization

This commit is contained in:
Alexander Eckart committed 2013-02-22 21:27:34 +01:00
1 parent a29f4fb0d6
commit 521033ed97
41 files changed
+836 -842

No files matched your search

@@ -175,12 +175,12 @@ namespace Vocaluxe.PartyModes
{
_Stage = EStage.NotStarted;
_ScreenSongOptions.Sorting.IgnoreArticles = _Base.Config.GetIgnoreArticles();
_ScreenSongOptions.Sorting.SongSorting = _Base.Config.GetSongSorting();
_ScreenSongOptions.Sorting.IgnoreArticles = CBase.Config.GetIgnoreArticles();
_ScreenSongOptions.Sorting.SongSorting = CBase.Config.GetSongSorting();
_ScreenSongOptions.Sorting.Tabs = EOffOn.TR_CONFIG_OFF;
_ScreenSongOptions.Selection.SongIndex = -1;
if (_Base.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;
ToScreenMain.ResultTable = new List<ResultTableRow>();
@@ -204,11 +204,11 @@ namespace Vocaluxe.PartyModes
GameData.NumRounds = data.ScreenConfig.NumRounds;
_Stage = EStage.Config;
_Base.Graphics.FadeTo(EScreens.ScreenPartyDummy);
CBase.Graphics.FadeTo(EScreens.ScreenPartyDummy);
}
catch (Exception e)
{
_Base.Log.LogError("Error in party mode challenge. Can't cast received data from screen " + ScreenName + ". " + e.Message);
CBase.Log.LogError("Error in party mode challenge. Can't cast received data from screen " + ScreenName + ". " + e.Message);
}
break;
@@ -224,11 +224,11 @@ namespace Vocaluxe.PartyModes
_Stage = EStage.Names;
}
_Base.Graphics.FadeTo(EScreens.ScreenPartyDummy);
CBase.Graphics.FadeTo(EScreens.ScreenPartyDummy);
}
catch (Exception e)
{
_Base.Log.LogError("Error in party mode challenge. Can't cast received data from screen " + ScreenName + ". " + e.Message);
CBase.Log.LogError("Error in party mode challenge. Can't cast received data from screen " + ScreenName + ". " + e.Message);
}
break;
@@ -243,18 +243,18 @@ namespace Vocaluxe.PartyModes
}
catch (Exception e)
{
_Base.Log.LogError("Error in party mode challenge. Can't cast received data from screen " + ScreenName + ". " + e.Message);
CBase.Log.LogError("Error in party mode challenge. Can't cast received data from screen " + ScreenName + ". " + e.Message);
}
if (_Stage == EStage.Singing)
StartNextRound();
if (_Stage == EStage.Config)
_Base.Graphics.FadeTo(EScreens.ScreenPartyDummy);
CBase.Graphics.FadeTo(EScreens.ScreenPartyDummy);
break;
default:
_Base.Log.LogError("Error in party mode challenge. Wrong screen is sending: " + ScreenName);
CBase.Log.LogError("Error in party mode challenge. Wrong screen is sending: " + ScreenName);
break;
}
}
@@ -262,7 +262,7 @@ namespace Vocaluxe.PartyModes
public override void UpdateGame()
{
/*
if (_Base.Songs.GetCurrentCategoryIndex() != -1 || _ScreenSongOptions.Sorting.Tabs == EOffOn.TR_CONFIG_OFF)
if (CBase.Songs.GetCurrentCategoryIndex() != -1 || _ScreenSongOptions.Sorting.Tabs == EOffOn.TR_CONFIG_OFF)
_ScreenSongOptions.Selection.RandomOnly = true;
else
_ScreenSongOptions.Selection.RandomOnly = false;*/
@@ -298,7 +298,7 @@ namespace Vocaluxe.PartyModes
_Screens.TryGetValue("PartyScreenChallengeMain", out Screen);
if (_Screens != null)
{
_Base.Songs.ResetPartySongSung();
CBase.Songs.ResetPartySongSung();
ToScreenMain.ResultTable = new List<ResultTableRow>();
GameData.ResultTable = new List<ResultTableRow>();
GameData.Rounds = new ChallengeRounds(GameData.NumRounds, GameData.NumPlayer, GameData.NumPlayerAtOnce);
@@ -346,9 +346,9 @@ namespace Vocaluxe.PartyModes
public override ScreenSongOptions GetScreenSongOptions()
{
_ScreenSongOptions.Sorting.SongSorting = _Base.Config.GetSongSorting();
_ScreenSongOptions.Sorting.Tabs = _Base.Config.GetTabs();
_ScreenSongOptions.Sorting.IgnoreArticles = _Base.Config.GetIgnoreArticles();
_ScreenSongOptions.Sorting.SongSorting = CBase.Config.GetSongSorting();
_ScreenSongOptions.Sorting.Tabs = CBase.Config.GetTabs();
_ScreenSongOptions.Sorting.IgnoreArticles = CBase.Config.GetIgnoreArticles();
return _ScreenSongOptions;
}
@@ -365,8 +365,8 @@ namespace Vocaluxe.PartyModes
if (GameData.CatSongIndices != null)
{
if (GameData.CatSongIndices[_Base.Songs.GetCurrentCategoryIndex()] == -1)
GameData.CatSongIndices[_Base.Songs.GetCurrentCategoryIndex()] = SongIndex;
if (GameData.CatSongIndices[CBase.Songs.GetCurrentCategoryIndex()] == -1)
GameData.CatSongIndices[CBase.Songs.GetCurrentCategoryIndex()] = SongIndex;
}
}
@@ -444,19 +444,19 @@ namespace Vocaluxe.PartyModes
EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL;
_Base.Game.Reset();
_Base.Game.ClearSongs();
_Base.Game.AddSong(SongID, gm);
_Base.Game.SetNumPlayer(GameData.NumPlayerAtOnce);
CBase.Game.Reset();
CBase.Game.ClearSongs();
CBase.Game.AddSong(SongID, gm);
CBase.Game.SetNumPlayer(GameData.NumPlayerAtOnce);
SPlayer[] player = _Base.Game.GetPlayer();
SPlayer[] player = CBase.Game.GetPlayer();
if (player == null)
return;
if (player.Length < GameData.NumPlayerAtOnce)
return;
SProfile[] profiles = _Base.Profiles.GetProfiles();
SProfile[] profiles = CBase.Profiles.GetProfiles();
Combination c = GameData.Rounds.GetRound(GameData.CurrentRoundNr - 1);
for (int i = 0; i < GameData.NumPlayerAtOnce; i++)
@@ -478,14 +478,14 @@ namespace Vocaluxe.PartyModes
}
}
_Base.Songs.AddPartySongSung(SongID);
_Base.Graphics.FadeTo(EScreens.ScreenSing);
CBase.Songs.AddPartySongSung(SongID);
CBase.Graphics.FadeTo(EScreens.ScreenSing);
}
public override void LeavingHighscore()
{
GameData.CurrentRoundNr++;
_Base.Graphics.FadeTo(EScreens.ScreenPartyDummy);
CBase.Graphics.FadeTo(EScreens.ScreenPartyDummy);
}
private void StartNextRound()
@@ -495,7 +495,7 @@ namespace Vocaluxe.PartyModes
SetNumJokers();
SetTeamNames();
GameData.CatSongIndices = null;
_Base.Graphics.FadeTo(EScreens.ScreenSong);
CBase.Graphics.FadeTo(EScreens.ScreenSong);
}
private void SetNumJokers()
@@ -533,7 +533,7 @@ namespace Vocaluxe.PartyModes
private void SetTeamNames()
{
SProfile[] profiles = _Base.Profiles.GetProfiles();
SProfile[] profiles = CBase.Profiles.GetProfiles();
if (profiles == null)
{
@@ -591,7 +591,7 @@ namespace Vocaluxe.PartyModes
}
else
{
SPlayer[] results = _Base.Game.GetPlayer();
SPlayer[] results = CBase.Game.GetPlayer();
if (results == null)
return;
@@ -704,16 +704,16 @@ namespace Vocaluxe.PartyModes
private void CreateCatSongIndices()
{
if (GameData.CatSongIndices == null && _Base.Songs.GetNumCategories() > 0 && _ScreenSongOptions.Sorting.Tabs == EOffOn.TR_CONFIG_ON)
if (GameData.CatSongIndices == null && CBase.Songs.GetNumCategories() > 0 && _ScreenSongOptions.Sorting.Tabs == EOffOn.TR_CONFIG_ON)
{
GameData.CatSongIndices = new int[_Base.Songs.GetNumCategories()];
GameData.CatSongIndices = new int[CBase.Songs.GetNumCategories()];
for (int i = 0; i < GameData.CatSongIndices.Length; i++)
{
GameData.CatSongIndices[i] = -1;
}
}
if (_Base.Songs.GetNumCategories() == 0 || _ScreenSongOptions.Sorting.Tabs == EOffOn.TR_CONFIG_OFF)
if (CBase.Songs.GetNumCategories() == 0 || _ScreenSongOptions.Sorting.Tabs == EOffOn.TR_CONFIG_OFF)
GameData.CatSongIndices = null;
}
}
@@ -63,7 +63,7 @@ namespace Vocaluxe.PartyModes
}
catch (Exception e)
{
CBase.Base.Log.LogError("Error in party mode screen challenge config. Can't cast received data from game mode " + _ThemeName + ". " + e.Message);;
CBase.Log.LogError("Error in party mode screen challenge config. Can't cast received data from game mode " + _ThemeName + ". " + e.Message);;
}
}
@@ -133,7 +133,7 @@ namespace Vocaluxe.PartyModes
{
base.OnShow();
_MaxNumMics = CBase.Base.Config.GetMaxNumMics();
_MaxNumMics = CBase.Config.GetMaxNumMics();
if (_MaxNumMics > 6)
_MaxNumMics = 6;
@@ -122,7 +122,7 @@ namespace Vocaluxe.PartyModes
}
catch (Exception e)
{
CBase.Base.Log.LogError("Error in party mode screen challenge main. Can't cast received data from game mode " + _ThemeName + ". " + e.Message); ;
CBase.Log.LogError("Error in party mode screen challenge main. Can't cast received data from game mode " + _ThemeName + ". " + e.Message); ;
}
}
@@ -331,7 +331,7 @@ namespace Vocaluxe.PartyModes
private void UpdateNextPlayerPositions()
{
float x = CBase.Base.Settings.GetRenderW()/2 - ((GameState.NumPlayerAtOnce * Statics[htStatics(StaticNextPlayer)].Rect.W) + ((GameState.NumPlayerAtOnce-1) * 15))/2;
float x = CBase.Settings.GetRenderW()/2 - ((GameState.NumPlayerAtOnce * Statics[htStatics(StaticNextPlayer)].Rect.W) + ((GameState.NumPlayerAtOnce-1) * 15))/2;
float static_y = 590;
float text_y = 550;
for (int i = 0; i < GameState.NumPlayerAtOnce; i++)
@@ -359,13 +359,13 @@ namespace Vocaluxe.PartyModes
if (GameState.CurrentRoundNr <= GameState.Combs.Count)
{
Texts[htTexts(TextNextPlayerMessage)].Visible = true;
SProfile[] profiles = CBase.Base.Profiles.GetProfiles();
SProfile[] profiles = CBase.Profiles.GetProfiles();
for (int i = 0; i < GameState.NumPlayerAtOnce; i++)
{
int pid = GameState.Combs[GameState.CurrentRoundNr - 1].Player[i];
NextPlayerStatics[i].Texture = profiles[GameState.ProfileIDs[pid]].Avatar.Texture;
NextPlayerTexts[i].Text = profiles[GameState.ProfileIDs[pid]].PlayerName;
NextPlayerTexts[i].Color = CBase.Base.Theme.GetPlayerColor((i + 1));
NextPlayerTexts[i].Color = CBase.Theme.GetPlayerColor((i + 1));
}
}
else
@@ -432,7 +432,7 @@ namespace Vocaluxe.PartyModes
RoundsTableScrollArea.X = x;
RoundsTableScrollArea.Y = y;
RoundsTableScrollArea.W = CBase.Base.Settings.GetRenderW() - Texts[htTexts(TextRoundNumber)].X - 20;
RoundsTableScrollArea.W = CBase.Settings.GetRenderW() - Texts[htTexts(TextRoundNumber)].X - 20;
float delta = Texts[htTexts(TextRoundNumber)].Height;
@@ -455,8 +455,8 @@ namespace Vocaluxe.PartyModes
for (int column = row * NumPlayerInOneRow; column < num; column++)
{
//Player
float _x = x + 15 + (CBase.Base.Settings.GetRenderW() - Texts[htTexts(TextRoundNumber)].X - 20) / NumPlayerInThisRow * (column - row * NumPlayerInOneRow) + ((CBase.Base.Settings.GetRenderW() - Texts[htTexts(TextRoundNumber)].X - 20) / NumPlayerInThisRow) / 2;
float maxw = ((CBase.Base.Settings.GetRenderW() - Texts[htTexts(TextRoundNumber)].X - 20) / NumPlayerInThisRow) / 2 - 5;
float _x = x + 15 + (CBase.Settings.GetRenderW() - Texts[htTexts(TextRoundNumber)].X - 20) / NumPlayerInThisRow * (column - row * NumPlayerInOneRow) + ((CBase.Settings.GetRenderW() - Texts[htTexts(TextRoundNumber)].X - 20) / NumPlayerInThisRow) / 2;
float maxw = ((CBase.Settings.GetRenderW() - Texts[htTexts(TextRoundNumber)].X - 20) / NumPlayerInThisRow) / 2 - 5;
RoundsTable[round].TextPlayer[column].X = _x;
RoundsTable[round].TextPlayer[column].Y = y;
RoundsTable[round].TextPlayer[column].MaxWidth = maxw;
@@ -475,7 +475,7 @@ namespace Vocaluxe.PartyModes
private void UpdateRoundsTable()
{
SProfile[] profile = CBase.Base.Profiles.GetProfiles();
SProfile[] profile = CBase.Profiles.GetProfiles();
for (int i = 0; i < RoundsTable.Count; i++)
{
for(int p = 0; p < RoundsTable[i].TextPlayer.Count; p++)
@@ -569,7 +569,7 @@ namespace Vocaluxe.PartyModes
private void UpdatePlayerTable()
{
SProfile[] profiles = CBase.Base.Profiles.GetProfiles();
SProfile[] profiles = CBase.Profiles.GetProfiles();
for (int i = 0; i < PlayerTable.Count; i++)
{
@@ -641,7 +641,7 @@ namespace Vocaluxe.PartyModes
private string GetPlayerWinString()
{
string s = "";
SProfile[] profiles = CBase.Base.Profiles.GetProfiles();
SProfile[] profiles = CBase.Profiles.GetProfiles();
for (int i = 0; i < GameState.ResultTable.Count; i++)
{
@@ -108,7 +108,7 @@ namespace Vocaluxe.PartyModes
}
catch (Exception e)
{
CBase.Base.Log.LogError("Error in party mode screen challenge names. Can't cast received data from game mode " + _ThemeName + ". " + e.Message); ;
CBase.Log.LogError("Error in party mode screen challenge names. Can't cast received data from game mode " + _ThemeName + ". " + e.Message); ;
}
}
@@ -175,7 +175,7 @@ namespace Vocaluxe.PartyModes
chooseAvatarStatic.Rect = PlayerChooseButtons[i].Button.Rect;
chooseAvatarStatic.Rect.Z = -100;
chooseAvatarStatic.Color = new SColorF(1, 1, 1, 1);
chooseAvatarStatic.Texture = CBase.Base.Profiles.GetProfiles()[SelectedPlayerNr].Avatar.Texture;
chooseAvatarStatic.Texture = CBase.Profiles.GetProfiles()[SelectedPlayerNr].Avatar.Texture;
}
}
}
@@ -223,7 +223,7 @@ namespace Vocaluxe.PartyModes
PlayerDestinationButtons[added].SColor = new SColorF(1, 1, 1, 1);
PlayerDestinationButtons[added].Texture = chooseAvatarStatic.Texture;
PlayerDestinationButtons[added].STexture = chooseAvatarStatic.Texture;
PlayerDestinationButtons[added].Text.Text = CBase.Base.Profiles.GetProfiles()[SelectedPlayerNr].PlayerName;
PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetProfiles()[SelectedPlayerNr].PlayerName;
//Update Tiles-List
UpdateButtonPlayerChoose();
}
@@ -368,9 +368,9 @@ namespace Vocaluxe.PartyModes
if ((i + Offset * NumButtonPlayerChoose) < PlayerChooseButtonsVisibleProfiles.Count)
{
PlayerChooseButtons[i].ProfileID = PlayerChooseButtonsVisibleProfiles[i + Offset * NumButtonPlayerChoose];
PlayerChooseButtons[i].Button.Text.Text = CBase.Base.Profiles.GetProfiles()[PlayerChooseButtonsVisibleProfiles[i + Offset * NumButtonPlayerChoose]].PlayerName;
PlayerChooseButtons[i].Button.Texture = CBase.Base.Profiles.GetProfiles()[PlayerChooseButtonsVisibleProfiles[i + Offset * NumButtonPlayerChoose]].Avatar.Texture;
PlayerChooseButtons[i].Button.STexture = CBase.Base.Profiles.GetProfiles()[PlayerChooseButtonsVisibleProfiles[i + Offset * NumButtonPlayerChoose]].Avatar.Texture;
PlayerChooseButtons[i].Button.Text.Text = CBase.Profiles.GetProfiles()[PlayerChooseButtonsVisibleProfiles[i + Offset * NumButtonPlayerChoose]].PlayerName;
PlayerChooseButtons[i].Button.Texture = CBase.Profiles.GetProfiles()[PlayerChooseButtonsVisibleProfiles[i + Offset * NumButtonPlayerChoose]].Avatar.Texture;
PlayerChooseButtons[i].Button.STexture = CBase.Profiles.GetProfiles()[PlayerChooseButtonsVisibleProfiles[i + Offset * NumButtonPlayerChoose]].Avatar.Texture;
PlayerChooseButtons[i].Button.Color = new SColorF(1, 1, 1, 0.6f);
PlayerChooseButtons[i].Button.SColor = new SColorF(1, 1, 1, 1);
PlayerChooseButtons[i].Button.Enabled = true;
@@ -392,11 +392,11 @@ namespace Vocaluxe.PartyModes
private void UpdateVisibleProfiles()
{
PlayerChooseButtonsVisibleProfiles.Clear();
for (int i = 0; i < CBase.Base.Profiles.GetProfiles().Length; i++)
for (int i = 0; i < CBase.Profiles.GetProfiles().Length; i++)
{
bool visible = false;
//Show profile only if active
if (CBase.Base.Profiles.GetProfiles()[i].Active == EOffOn.TR_CONFIG_ON)
if (CBase.Profiles.GetProfiles()[i].Active == EOffOn.TR_CONFIG_ON)
{
visible = true;
@@ -440,9 +440,9 @@ namespace Vocaluxe.PartyModes
{
PlayerDestinationButtons[i].Color = new SColorF(1, 1, 1, 0.6f);
PlayerDestinationButtons[i].SColor = new SColorF(1, 1, 1, 1);
PlayerDestinationButtons[i].Texture = CBase.Base.Profiles.GetProfiles()[Data.ScreenNames.ProfileIDs[i]].Avatar.Texture;
PlayerDestinationButtons[i].STexture = CBase.Base.Profiles.GetProfiles()[Data.ScreenNames.ProfileIDs[i]].Avatar.Texture;
PlayerDestinationButtons[i].Text.Text = CBase.Base.Profiles.GetProfiles()[Data.ScreenNames.ProfileIDs[i]].PlayerName;
PlayerDestinationButtons[i].Texture = CBase.Profiles.GetProfiles()[Data.ScreenNames.ProfileIDs[i]].Avatar.Texture;
PlayerDestinationButtons[i].STexture = CBase.Profiles.GetProfiles()[Data.ScreenNames.ProfileIDs[i]].Avatar.Texture;
PlayerDestinationButtons[i].Text.Text = CBase.Profiles.GetProfiles()[Data.ScreenNames.ProfileIDs[i]].PlayerName;
PlayerDestinationButtons[i].Enabled = true;
}
}
@@ -483,9 +483,9 @@ namespace Vocaluxe.PartyModes
//Update texture and name
PlayerDestinationButtons[added].Color = new SColorF(1, 1, 1, 0.6f);
PlayerDestinationButtons[added].SColor = new SColorF(1, 1, 1, 1);
PlayerDestinationButtons[added].Texture = CBase.Base.Profiles.GetProfiles()[PlayerChooseButtons[i].ProfileID].Avatar.Texture;
PlayerDestinationButtons[added].STexture = CBase.Base.Profiles.GetProfiles()[PlayerChooseButtons[i].ProfileID].Avatar.Texture;
PlayerDestinationButtons[added].Text.Text = CBase.Base.Profiles.GetProfiles()[PlayerChooseButtons[i].ProfileID].PlayerName;
PlayerDestinationButtons[added].Texture = CBase.Profiles.GetProfiles()[PlayerChooseButtons[i].ProfileID].Avatar.Texture;
PlayerDestinationButtons[added].STexture = CBase.Profiles.GetProfiles()[PlayerChooseButtons[i].ProfileID].Avatar.Texture;
PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetProfiles()[PlayerChooseButtons[i].ProfileID].PlayerName;
PlayerDestinationButtons[added].Enabled = true;
//Update Tiles-List
UpdateButtonPlayerChoose();