Auto cleanup of party modes
This commit is contained in:
1 parent
91e6d4901b
commit
cd62c3cd88
16 files changed
+497
-595
No files matched your search
Binary file not shown.
@@ -1,8 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using VocaluxeLib.Menu;
|
||||
|
||||
[assembly: System.Runtime.InteropServices.ComVisible(false)]
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
{
|
||||
public enum ESongSource
|
||||
@@ -29,7 +31,9 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
public int Winner;
|
||||
public bool Finished = false;
|
||||
}
|
||||
|
||||
#region Communication
|
||||
|
||||
#region ToScreen
|
||||
public struct DataToScreenConfig
|
||||
{
|
||||
@@ -104,6 +108,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
public List<int> Songs;
|
||||
}
|
||||
#endregion FromScreen
|
||||
|
||||
#endregion Communication
|
||||
|
||||
public sealed class PartyModeTicTacToe : CPartyMode
|
||||
@@ -114,7 +119,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
private const int MinTeams = 2;
|
||||
private const int NumFields = 9;
|
||||
|
||||
enum EStage
|
||||
private enum EStage
|
||||
{
|
||||
NotStarted,
|
||||
Config,
|
||||
@@ -123,7 +128,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
Singing
|
||||
}
|
||||
|
||||
struct Data
|
||||
private struct Data
|
||||
{
|
||||
public int NumPlayerTeam1;
|
||||
public int NumPlayerTeam2;
|
||||
@@ -162,13 +167,13 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
_ScreenSongOptions.Selection.RandomOnly = false;
|
||||
_ScreenSongOptions.Selection.PartyMode = true;
|
||||
_ScreenSongOptions.Selection.CategoryChangeAllowed = true;
|
||||
_ScreenSongOptions.Selection.NumJokers = new int[] { 5, 5 };
|
||||
_ScreenSongOptions.Selection.TeamNames = new string[] { "foo", "bar" };
|
||||
_ScreenSongOptions.Selection.NumJokers = new[] {5, 5};
|
||||
_ScreenSongOptions.Selection.TeamNames = new[] {"foo", "bar"};
|
||||
|
||||
_ScreenSongOptions.Sorting.SearchString = String.Empty;
|
||||
_ScreenSongOptions.Sorting.SearchActive = false;
|
||||
_ScreenSongOptions.Sorting.DuetOptions = EDuetOptions.NoDuets;
|
||||
|
||||
|
||||
_Stage = EStage.NotStarted;
|
||||
|
||||
ToScreenConfig = new DataToScreenConfig();
|
||||
@@ -224,7 +229,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
switch (ScreenName)
|
||||
{
|
||||
case "PartyScreenTicTacToeConfig":
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
data = (DataFromScreen)Data;
|
||||
@@ -284,9 +289,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
GameData.PlayerTeam2 = data.ScreenMain.PlayerTeam2;
|
||||
}
|
||||
if (data.ScreenMain.FadeToNameSelection)
|
||||
{
|
||||
_Stage = EStage.Config;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -407,7 +410,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return Screen;
|
||||
}
|
||||
|
||||
@@ -471,9 +474,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
return NumFields;
|
||||
}
|
||||
|
||||
public override void JokerUsed(int TeamNr)
|
||||
{
|
||||
}
|
||||
public override void JokerUsed(int TeamNr) {}
|
||||
|
||||
public override void SongSelected(int SongID)
|
||||
{
|
||||
@@ -528,14 +529,19 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
int num = 0;
|
||||
int random = 0;
|
||||
//Add IDs to team-list
|
||||
while (GameData.PlayerTeam1.Count < GameData.NumFields + GameData.NumJokerRetry[0] && IDs1.Count == 0 && GameData.PlayerTeam2.Count < GameData.NumFields + GameData.NumJokerRetry[1] && IDs2.Count == 0)
|
||||
while (GameData.PlayerTeam1.Count < GameData.NumFields + GameData.NumJokerRetry[0] && IDs1.Count == 0 &&
|
||||
GameData.PlayerTeam2.Count < GameData.NumFields + GameData.NumJokerRetry[1] && IDs2.Count == 0)
|
||||
{
|
||||
if (IDs1.Count == 0)
|
||||
{
|
||||
for (int i = 0; i < GameData.NumPlayerTeam1; i++)
|
||||
IDs1.Add(i);
|
||||
}
|
||||
if (IDs2.Count == 0)
|
||||
{
|
||||
for (int i = 0; i < GameData.NumPlayerTeam2; i++)
|
||||
IDs2.Add(i);
|
||||
}
|
||||
if (GameData.PlayerTeam1.Count < GameData.NumFields + GameData.NumJokerRetry[0])
|
||||
{
|
||||
random = CBase.Game.GetRandom((IDs1.Count - 1) * 10);
|
||||
@@ -566,8 +572,10 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
while (GameData.PlayerTeam1.Count < GameData.NumFields + GameData.NumJokerRetry[0] && IDs.Count == 0)
|
||||
{
|
||||
if (IDs.Count == 0)
|
||||
{
|
||||
for (int i = 0; i < GameData.NumPlayerTeam1; i++)
|
||||
IDs.Add(i);
|
||||
}
|
||||
if (GameData.PlayerTeam1.Count < GameData.NumFields + GameData.NumJokerRetry[0])
|
||||
{
|
||||
random = CBase.Game.GetRandom((IDs.Count - 1) * 10);
|
||||
@@ -589,8 +597,10 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
while (GameData.PlayerTeam2.Count < GameData.NumFields + GameData.NumJokerRetry[1] && IDs.Count == 0)
|
||||
{
|
||||
if (IDs.Count == 0)
|
||||
{
|
||||
for (int i = 0; i < GameData.NumPlayerTeam2; i++)
|
||||
IDs.Add(i);
|
||||
}
|
||||
if (GameData.PlayerTeam2.Count < GameData.NumFields + GameData.NumJokerRetry[1])
|
||||
{
|
||||
random = CBase.Game.GetRandom((IDs.Count - 1) * 20);
|
||||
@@ -623,7 +633,8 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
break;
|
||||
}
|
||||
|
||||
while(GameData.Songs.Count < (GameData.NumFields + GameData.NumJokerRandom[0] + GameData.NumJokerRandom[1])){
|
||||
while (GameData.Songs.Count < (GameData.NumFields + GameData.NumJokerRandom[0] + GameData.NumJokerRandom[1]))
|
||||
{
|
||||
List<int> Songs = new List<int>();
|
||||
switch (GameData.SongSource)
|
||||
{
|
||||
@@ -632,8 +643,10 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
{
|
||||
int id = CBase.Playlist.GetPlaylistSong(GameData.PlaylistID, i).SongID;
|
||||
foreach (EGameMode mode in CBase.Songs.GetSongByID(id).AvailableGameModes)
|
||||
if (mode == gm)
|
||||
{
|
||||
if (mode == gm)
|
||||
Songs.Add(id);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -641,8 +654,10 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
for (int i = 0; i < CBase.Songs.GetNumSongs(); i++)
|
||||
{
|
||||
foreach (EGameMode mode in CBase.Songs.GetSongByID(i).AvailableGameModes)
|
||||
if (mode == gm)
|
||||
{
|
||||
if (mode == gm)
|
||||
Songs.Add(i);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -650,14 +665,16 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
CBase.Songs.SetCategory(GameData.CategoryID);
|
||||
for (int i = 0; i < CBase.Songs.NumSongsInCategory(GameData.CategoryID); i++)
|
||||
{
|
||||
foreach(EGameMode mode in CBase.Songs.GetVisibleSong(i).AvailableGameModes)
|
||||
if(mode == gm)
|
||||
foreach (EGameMode mode in CBase.Songs.GetVisibleSong(i).AvailableGameModes)
|
||||
{
|
||||
if (mode == gm)
|
||||
Songs.Add(CBase.Songs.GetVisibleSong(i).ID);
|
||||
}
|
||||
}
|
||||
CBase.Songs.SetCategory(-1);
|
||||
break;
|
||||
}
|
||||
while(Songs.Count > 0)
|
||||
while (Songs.Count > 0)
|
||||
{
|
||||
GameData.Songs.Add(Songs[CBase.Game.GetRandom(Songs.Count - 1)]);
|
||||
Songs.Remove(GameData.Songs[GameData.Songs.Count - 1]);
|
||||
@@ -773,13 +790,9 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
GameData.Rounds[GameData.SingRoundNr].PointsTeam2 = (int)Math.Round(results[1].Points);
|
||||
GameData.Rounds[GameData.SingRoundNr].Finished = true;
|
||||
if (GameData.Rounds[GameData.SingRoundNr].PointsTeam1 < GameData.Rounds[GameData.SingRoundNr].PointsTeam2)
|
||||
{
|
||||
GameData.Rounds[GameData.SingRoundNr].Winner = 2;
|
||||
}
|
||||
else if (GameData.Rounds[GameData.SingRoundNr].PointsTeam1 > GameData.Rounds[GameData.SingRoundNr].PointsTeam2)
|
||||
{
|
||||
GameData.Rounds[GameData.SingRoundNr].Winner = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
GameData.Rounds[GameData.SingRoundNr].Finished = false;
|
||||
|
||||
@@ -7,32 +7,32 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
public class PartyScreenTicTacToeConfig : CMenuParty
|
||||
{
|
||||
// Version number for theme files. Increment it, if you've changed something on the theme files!
|
||||
protected override int _ScreenVersion { get { return 1; } }
|
||||
protected override int _ScreenVersion
|
||||
{
|
||||
get { return 1; }
|
||||
}
|
||||
|
||||
const string SelectSlideNumPlayerTeam1 = "SelectSlideNumPlayerTeam1";
|
||||
const string SelectSlideNumPlayerTeam2 = "SelectSlideNumPlayerTeam2";
|
||||
const string SelectSlideNumFields = "SelectSlideNumFields";
|
||||
const string SelectSlideSongSource = "SelectSlideSongSource";
|
||||
const string SelectSlidePlaylist = "SelectSlidePlaylist";
|
||||
const string SelectSlideCategory = "SelectSlideCategory";
|
||||
const string SelectSlideGameMode = "SelectSlideGameMode";
|
||||
const string ButtonNext = "ButtonNext";
|
||||
const string ButtonBack = "ButtonBack";
|
||||
private const string SelectSlideNumPlayerTeam1 = "SelectSlideNumPlayerTeam1";
|
||||
private const string SelectSlideNumPlayerTeam2 = "SelectSlideNumPlayerTeam2";
|
||||
private const string SelectSlideNumFields = "SelectSlideNumFields";
|
||||
private const string SelectSlideSongSource = "SelectSlideSongSource";
|
||||
private const string SelectSlidePlaylist = "SelectSlidePlaylist";
|
||||
private const string SelectSlideCategory = "SelectSlideCategory";
|
||||
private const string SelectSlideGameMode = "SelectSlideGameMode";
|
||||
private const string ButtonNext = "ButtonNext";
|
||||
private const string ButtonBack = "ButtonBack";
|
||||
|
||||
private bool ConfigOk = true;
|
||||
|
||||
DataFromScreen Data;
|
||||
|
||||
public PartyScreenTicTacToeConfig()
|
||||
{
|
||||
}
|
||||
private DataFromScreen Data;
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
base.Init();
|
||||
|
||||
_ThemeSelectSlides = new string[] { SelectSlideNumPlayerTeam1, SelectSlideNumPlayerTeam2, SelectSlideNumFields, SelectSlideSongSource, SelectSlidePlaylist, SelectSlideCategory, SelectSlideGameMode };
|
||||
_ThemeButtons = new string[] { ButtonNext, ButtonBack };
|
||||
_ThemeSelectSlides = new[]
|
||||
{SelectSlideNumPlayerTeam1, SelectSlideNumPlayerTeam2, SelectSlideNumFields, SelectSlideSongSource, SelectSlidePlaylist, SelectSlideCategory, SelectSlideGameMode};
|
||||
_ThemeButtons = new[] {ButtonNext, ButtonBack};
|
||||
|
||||
Data = new DataFromScreen();
|
||||
FromScreenConfig config = new FromScreenConfig();
|
||||
@@ -48,7 +48,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
|
||||
public override void LoadTheme(string XmlPath)
|
||||
{
|
||||
base.LoadTheme(XmlPath);
|
||||
base.LoadTheme(XmlPath);
|
||||
}
|
||||
|
||||
public override void DataToScreen(object ReceivedData)
|
||||
@@ -68,19 +68,16 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
CBase.Log.LogError("Error in party mode screen TicTacToe config. Can't cast received data from game mode " + ThemeName + ". " + e.Message);;
|
||||
CBase.Log.LogError("Error in party mode screen TicTacToe config. Can't cast received data from game mode " + ThemeName + ". " + e.Message);
|
||||
;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public override bool HandleInput(KeyEvent KeyEvent)
|
||||
{
|
||||
base.HandleInput(KeyEvent);
|
||||
|
||||
if (KeyEvent.KeyPressed)
|
||||
{
|
||||
|
||||
}
|
||||
if (KeyEvent.KeyPressed) {}
|
||||
else
|
||||
{
|
||||
switch (KeyEvent.Key)
|
||||
@@ -127,9 +124,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
}
|
||||
|
||||
if (MouseEvent.RB)
|
||||
{
|
||||
Back();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -161,18 +156,14 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
{
|
||||
// build num player slide (min player ... max player);
|
||||
SelectSlides[SelectSlideNumPlayerTeam1].Clear();
|
||||
for (int i = _PartyMode.GetMinPlayer()/2; i <= _PartyMode.GetMaxPlayer() / 2; i++)
|
||||
{
|
||||
for (int i = _PartyMode.GetMinPlayer() / 2; i <= _PartyMode.GetMaxPlayer() / 2; i++)
|
||||
SelectSlides[SelectSlideNumPlayerTeam1].AddValue(i.ToString());
|
||||
}
|
||||
SelectSlides[SelectSlideNumPlayerTeam1].Selection = Data.ScreenConfig.NumPlayerTeam1 - (_PartyMode.GetMinPlayer()/2);
|
||||
SelectSlides[SelectSlideNumPlayerTeam1].Selection = Data.ScreenConfig.NumPlayerTeam1 - (_PartyMode.GetMinPlayer() / 2);
|
||||
|
||||
SelectSlides[SelectSlideNumPlayerTeam2].Clear();
|
||||
for (int i = _PartyMode.GetMinPlayer()/2; i <= _PartyMode.GetMaxPlayer() / 2; i++)
|
||||
{
|
||||
for (int i = _PartyMode.GetMinPlayer() / 2; i <= _PartyMode.GetMaxPlayer() / 2; i++)
|
||||
SelectSlides[SelectSlideNumPlayerTeam2].AddValue(i.ToString());
|
||||
}
|
||||
SelectSlides[SelectSlideNumPlayerTeam2].Selection = Data.ScreenConfig.NumPlayerTeam2 -( _PartyMode.GetMinPlayer()/2);
|
||||
SelectSlides[SelectSlideNumPlayerTeam2].Selection = Data.ScreenConfig.NumPlayerTeam2 - (_PartyMode.GetMinPlayer() / 2);
|
||||
|
||||
SelectSlides[SelectSlideNumFields].Clear();
|
||||
SelectSlides[SelectSlideNumFields].AddValue("9");
|
||||
@@ -199,10 +190,8 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
SelectSlides[SelectSlidePlaylist].Visible = Data.ScreenConfig.SongSource == ESongSource.TR_PLAYLIST;
|
||||
|
||||
string[] _Categories = new string[CBase.Songs.GetNumCategories()];
|
||||
for (int i = 0; i < CBase.Songs.GetNumCategories(); i++ )
|
||||
{
|
||||
for (int i = 0; i < CBase.Songs.GetNumCategories(); i++)
|
||||
_Categories[i] = CBase.Songs.GetCategory(i).Name;
|
||||
}
|
||||
SelectSlides[SelectSlideCategory].Clear();
|
||||
for (int i = 0; i < _Categories.Length; i++)
|
||||
{
|
||||
@@ -218,8 +207,8 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
|
||||
private void UpdateSlides()
|
||||
{
|
||||
Data.ScreenConfig.NumPlayerTeam1 = SelectSlides[SelectSlideNumPlayerTeam1].Selection + (_PartyMode.GetMinPlayer()/2);
|
||||
Data.ScreenConfig.NumPlayerTeam2 = SelectSlides[SelectSlideNumPlayerTeam2].Selection + (_PartyMode.GetMinPlayer()/2);
|
||||
Data.ScreenConfig.NumPlayerTeam1 = SelectSlides[SelectSlideNumPlayerTeam1].Selection + (_PartyMode.GetMinPlayer() / 2);
|
||||
Data.ScreenConfig.NumPlayerTeam2 = SelectSlides[SelectSlideNumPlayerTeam2].Selection + (_PartyMode.GetMinPlayer() / 2);
|
||||
|
||||
if (SelectSlides[SelectSlideNumFields].Selection == 0)
|
||||
Data.ScreenConfig.NumFields = 9;
|
||||
@@ -253,6 +242,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
if (Data.ScreenConfig.SongSource == ESongSource.TR_PLAYLIST)
|
||||
{
|
||||
if (CBase.Playlist.GetNumPlaylists() > 0)
|
||||
{
|
||||
if (CBase.Playlist.GetPlaylistSongCount(Data.ScreenConfig.PlaylistID) > 0)
|
||||
{
|
||||
ConfigOk = false;
|
||||
@@ -260,23 +250,27 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
{
|
||||
int id = CBase.Playlist.GetPlaylistSong(Data.ScreenConfig.PlaylistID, i).SongID;
|
||||
foreach (EGameMode mode in CBase.Songs.GetSongByID(id).AvailableGameModes)
|
||||
{
|
||||
if (mode == gm)
|
||||
{
|
||||
ConfigOk = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ConfigOk)
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
ConfigOk = false;
|
||||
}
|
||||
else
|
||||
ConfigOk = false;
|
||||
}
|
||||
if (Data.ScreenConfig.SongSource == ESongSource.TR_CATEGORY)
|
||||
{
|
||||
if (CBase.Songs.GetNumCategories() > 0)
|
||||
{
|
||||
if (CBase.Songs.NumSongsInCategory(Data.ScreenConfig.CategoryID) > 0)
|
||||
{
|
||||
CBase.Songs.SetCategory(Data.ScreenConfig.CategoryID);
|
||||
@@ -284,11 +278,13 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
for (int i = 0; i < CBase.Songs.NumSongsInCategory(Data.ScreenConfig.CategoryID); i++)
|
||||
{
|
||||
foreach (EGameMode mode in CBase.Songs.GetVisibleSong(i).AvailableGameModes)
|
||||
{
|
||||
if (mode == gm)
|
||||
{
|
||||
ConfigOk = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ConfigOk)
|
||||
break;
|
||||
}
|
||||
@@ -296,6 +292,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
}
|
||||
else
|
||||
ConfigOk = false;
|
||||
}
|
||||
else
|
||||
ConfigOk = false;
|
||||
}
|
||||
@@ -306,11 +303,13 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
for (int i = 0; i < CBase.Songs.GetNumSongs(); i++)
|
||||
{
|
||||
foreach (EGameMode mode in CBase.Songs.GetSongByID(i).AvailableGameModes)
|
||||
{
|
||||
if (mode == gm)
|
||||
{
|
||||
ConfigOk = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ConfigOk)
|
||||
break;
|
||||
}
|
||||
@@ -320,7 +319,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
}
|
||||
SelectSlides[SelectSlideCategory].Visible = Data.ScreenConfig.SongSource == ESongSource.TR_CATEGORY;
|
||||
SelectSlides[SelectSlidePlaylist].Visible = Data.ScreenConfig.SongSource == ESongSource.TR_PLAYLIST;
|
||||
}
|
||||
}
|
||||
|
||||
private void Back()
|
||||
{
|
||||
@@ -332,4 +331,4 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
_PartyMode.DataFromScreen(ThemeName, Data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,34 +23,36 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
public class PartyScreenTicTacToeMain : CMenuParty
|
||||
{
|
||||
// Version number for theme files. Increment it, if you've changed something on the theme files!
|
||||
protected override int _ScreenVersion { get { return 1; } }
|
||||
protected override int _ScreenVersion
|
||||
{
|
||||
get { return 1; }
|
||||
}
|
||||
|
||||
const string TextPopupReallyExit = "TextPopupReallyExit";
|
||||
const string TextTeamChoosing = "TextTeamChoosing";
|
||||
const string TextFinishMessage = "TextFinishMessage";
|
||||
const string TextNextPlayerT1 = "TextNextPlayerT1";
|
||||
const string TextNextPlayerT2 = "TextNextPlayerT2";
|
||||
const string TextNextPlayerNameT1 = "TextNextPlayerNameT1";
|
||||
const string TextNextPlayerNameT2 = "TextNextPlayerNameT2";
|
||||
private const string TextPopupReallyExit = "TextPopupReallyExit";
|
||||
private const string TextTeamChoosing = "TextTeamChoosing";
|
||||
private const string TextFinishMessage = "TextFinishMessage";
|
||||
private const string TextNextPlayerT1 = "TextNextPlayerT1";
|
||||
private const string TextNextPlayerT2 = "TextNextPlayerT2";
|
||||
private const string TextNextPlayerNameT1 = "TextNextPlayerNameT1";
|
||||
private const string TextNextPlayerNameT2 = "TextNextPlayerNameT2";
|
||||
|
||||
const string ButtonNextRound = "ButtonNextRound";
|
||||
const string ButtonBack = "ButtonBack";
|
||||
const string ButtonExit = "ButtonExit";
|
||||
const string ButtonPopupYes = "ButtonPopupYes";
|
||||
const string ButtonPopupNo = "ButtonPopupNo";
|
||||
const string ButtonField = "ButtonField";
|
||||
private const string ButtonNextRound = "ButtonNextRound";
|
||||
private const string ButtonBack = "ButtonBack";
|
||||
private const string ButtonExit = "ButtonExit";
|
||||
private const string ButtonPopupYes = "ButtonPopupYes";
|
||||
private const string ButtonPopupNo = "ButtonPopupNo";
|
||||
private const string ButtonField = "ButtonField";
|
||||
|
||||
const string ButtonJokerRandomT1 = "ButtonJokerRandomT1";
|
||||
const string ButtonJokerRandomT2 = "ButtonJokerRandomT2";
|
||||
const string ButtonJokerRetryT1 = "ButtonJokerRetryT1";
|
||||
const string ButtonJokerRetryT2 = "ButtonJokerRetryT2";
|
||||
private const string ButtonJokerRandomT1 = "ButtonJokerRandomT1";
|
||||
private const string ButtonJokerRandomT2 = "ButtonJokerRandomT2";
|
||||
private const string ButtonJokerRetryT1 = "ButtonJokerRetryT1";
|
||||
private const string ButtonJokerRetryT2 = "ButtonJokerRetryT2";
|
||||
|
||||
private const string StaticPopupBG = "StaticPopupBG";
|
||||
private const string StaticAvatarT1 = "StaticAvatarT1";
|
||||
private const string StaticAvatarT2 = "StaticAvatarT2";
|
||||
|
||||
const string StaticPopupBG = "StaticPopupBG";
|
||||
const string StaticAvatarT1 = "StaticAvatarT1";
|
||||
const string StaticAvatarT2 = "StaticAvatarT2";
|
||||
|
||||
private bool ExitPopupVisible = false;
|
||||
private bool ExitPopupVisible;
|
||||
|
||||
private DataFromScreen Data;
|
||||
private DataToScreenMain GameData;
|
||||
@@ -68,17 +70,17 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
private int[,] Possibilities;
|
||||
private EStatus Status;
|
||||
|
||||
public PartyScreenTicTacToeMain()
|
||||
{
|
||||
}
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
base.Init();
|
||||
|
||||
_ThemeTexts = new string[] { TextPopupReallyExit, TextTeamChoosing, TextFinishMessage, TextNextPlayerT1, TextNextPlayerT2, TextNextPlayerNameT1, TextNextPlayerNameT2 };
|
||||
_ThemeButtons = new string[] { ButtonNextRound, ButtonBack, ButtonExit, ButtonPopupYes, ButtonPopupNo, ButtonField, ButtonJokerRandomT1, ButtonJokerRandomT2, ButtonJokerRetryT1, ButtonJokerRetryT2 };
|
||||
_ThemeStatics = new string[] { StaticPopupBG, StaticAvatarT1, StaticAvatarT2 };
|
||||
_ThemeTexts = new[] {TextPopupReallyExit, TextTeamChoosing, TextFinishMessage, TextNextPlayerT1, TextNextPlayerT2, TextNextPlayerNameT1, TextNextPlayerNameT2};
|
||||
_ThemeButtons = new[]
|
||||
{
|
||||
ButtonNextRound, ButtonBack, ButtonExit, ButtonPopupYes, ButtonPopupNo, ButtonField, ButtonJokerRandomT1, ButtonJokerRandomT2, ButtonJokerRetryT1,
|
||||
ButtonJokerRetryT2
|
||||
};
|
||||
_ThemeStatics = new[] {StaticPopupBG, StaticAvatarT1, StaticAvatarT2};
|
||||
|
||||
Data = new DataFromScreen();
|
||||
FromScreenMain config = new FromScreenMain();
|
||||
@@ -97,7 +99,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
|
||||
public override void LoadTheme(string XmlPath)
|
||||
{
|
||||
base.LoadTheme(XmlPath);
|
||||
base.LoadTheme(XmlPath);
|
||||
|
||||
CreateFields();
|
||||
Buttons[ButtonField].Visible = false;
|
||||
@@ -114,19 +116,16 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
CBase.Log.LogError("Error in party mode screen TicTacToe main. Can't cast received data from game mode " + ThemeName + ". " + e.Message); ;
|
||||
CBase.Log.LogError("Error in party mode screen TicTacToe main. Can't cast received data from game mode " + ThemeName + ". " + e.Message);
|
||||
;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public override bool HandleInput(KeyEvent KeyEvent)
|
||||
{
|
||||
base.HandleInput(KeyEvent);
|
||||
|
||||
if (KeyEvent.KeyPressed)
|
||||
{
|
||||
|
||||
}
|
||||
if (KeyEvent.KeyPressed) {}
|
||||
else
|
||||
{
|
||||
switch (KeyEvent.Key)
|
||||
@@ -134,12 +133,14 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
case Keys.Back:
|
||||
case Keys.Escape:
|
||||
if (!ExitPopupVisible)
|
||||
{
|
||||
if (GameData.CurrentRoundNr == 1 && Status != EStatus.FieldSelected)
|
||||
Back();
|
||||
else if(Status == EStatus.None)
|
||||
else if (Status == EStatus.None)
|
||||
EndParty();
|
||||
else
|
||||
ShowPopup(true);
|
||||
}
|
||||
else
|
||||
ShowPopup(false);
|
||||
break;
|
||||
@@ -214,10 +215,12 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
if (Buttons[ButtonBack].Selected)
|
||||
Back();
|
||||
if (Buttons[ButtonExit].Selected)
|
||||
{
|
||||
if (Status == EStatus.None)
|
||||
EndParty();
|
||||
else
|
||||
ShowPopup(true);
|
||||
}
|
||||
for (int i = 0; i < GameData.NumFields; i++)
|
||||
{
|
||||
switch (Status)
|
||||
@@ -239,7 +242,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(Status == EStatus.FieldSelected)
|
||||
if (Status == EStatus.FieldSelected)
|
||||
{
|
||||
if (Buttons[ButtonJokerRandomT1].Selected)
|
||||
UseJoker(0, 0);
|
||||
@@ -249,7 +252,6 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
UseJoker(0, 1);
|
||||
if (Buttons[ButtonJokerRetryT2].Selected)
|
||||
UseJoker(1, 1);
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -264,19 +266,19 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
if (MouseEvent.RB)
|
||||
{
|
||||
if (!ExitPopupVisible)
|
||||
{
|
||||
if (GameData.CurrentRoundNr == 1 && Status != EStatus.FieldSelected)
|
||||
Back();
|
||||
else if(Status == EStatus.None)
|
||||
else if (Status == EStatus.None)
|
||||
EndParty();
|
||||
else
|
||||
ShowPopup(true);
|
||||
}
|
||||
else
|
||||
ShowPopup(false);
|
||||
}
|
||||
|
||||
if (MouseEvent.Wheel != 0)
|
||||
{
|
||||
}
|
||||
if (MouseEvent.Wheel != 0) {}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -289,7 +291,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
|
||||
if (GameData.CurrentRoundNr == 1)
|
||||
{
|
||||
BuildWinnerPossibilities();
|
||||
BuildWinnerPossibilities();
|
||||
SelectedField = -1;
|
||||
Buttons[ButtonBack].Visible = true;
|
||||
Buttons[ButtonExit].Visible = false;
|
||||
@@ -333,7 +335,8 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
if (Winner > 0)
|
||||
{
|
||||
Texts[TextFinishMessage].Color = CBase.Theme.GetPlayerColor(Winner);
|
||||
Texts[TextFinishMessage].Text = CBase.Language.Translate("TR_SCREENMAIN_WINNER", _PartyModeID) + " " + CBase.Language.Translate("TR_TEAM", _PartyModeID) + " " + Winner;
|
||||
Texts[TextFinishMessage].Text = CBase.Language.Translate("TR_SCREENMAIN_WINNER", _PartyModeID) + " " + CBase.Language.Translate("TR_TEAM", _PartyModeID) + " " +
|
||||
Winner;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -379,7 +382,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
|
||||
private void UpdateFields()
|
||||
{
|
||||
int NumOneRow = (int)Math.Sqrt((double)GameData.NumFields);
|
||||
int NumOneRow = (int)Math.Sqrt(GameData.NumFields);
|
||||
float FieldSizeY = (CBase.Settings.GetRenderH() - 150 - NumOneRow * FieldSpace) / NumOneRow;
|
||||
float FieldSizeX = (CBase.Settings.GetRenderW() - 300 - NumOneRow * FieldSpace) / NumOneRow;
|
||||
if (FieldSizeX < FieldSizeY)
|
||||
@@ -403,7 +406,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
Fields[i].Button.Visible = true;
|
||||
Fields[i].Button.Enabled = true;
|
||||
column++;
|
||||
if ((i+1) >= NumOneRow * (row+1))
|
||||
if ((i + 1) >= NumOneRow * (row + 1))
|
||||
{
|
||||
column = 0;
|
||||
row++;
|
||||
@@ -446,17 +449,13 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
}
|
||||
if (Status == EStatus.JokerRetry && Fields[i].Content.Finished)
|
||||
{
|
||||
Fields[i].Button.SColor = CBase.Theme.GetPlayerColor(GameData.Team+1);
|
||||
Fields[i].Button.SColor = CBase.Theme.GetPlayerColor(GameData.Team + 1);
|
||||
Fields[i].Button.Enabled = true;
|
||||
}
|
||||
if (Status == EStatus.JokerRetry && !Fields[i].Content.Finished)
|
||||
{
|
||||
Fields[i].Button.Enabled = false;
|
||||
}
|
||||
if(Status == EStatus.FieldSelected)
|
||||
{
|
||||
if (Status == EStatus.FieldSelected)
|
||||
Fields[i].Button.Enabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -501,7 +500,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
Texts[TextNextPlayerT2].Visible = true;
|
||||
Texts[TextNextPlayerNameT1].Visible = true;
|
||||
Texts[TextNextPlayerNameT2].Visible = true;
|
||||
SProfile[] profiles = CBase.Profiles.GetProfiles();
|
||||
SProfile[] profiles = CBase.Profiles.GetProfiles();
|
||||
Texts[TextNextPlayerNameT1].Text = profiles[GameData.ProfileIDsTeam1[GameData.Rounds[SelectedField].SingerTeam1]].PlayerName;
|
||||
Texts[TextNextPlayerNameT2].Text = profiles[GameData.ProfileIDsTeam2[GameData.Rounds[SelectedField].SingerTeam2]].PlayerName;
|
||||
Statics[StaticAvatarT1].Visible = true;
|
||||
@@ -561,7 +560,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
{
|
||||
switch (JokerNum)
|
||||
{
|
||||
//Random-Joker
|
||||
//Random-Joker
|
||||
case 0:
|
||||
if (GameData.NumJokerRandom[TeamNr] > 0)
|
||||
{
|
||||
@@ -572,7 +571,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
}
|
||||
break;
|
||||
|
||||
//Retry-Joker
|
||||
//Retry-Joker
|
||||
case 1:
|
||||
if (GameData.NumJokerRetry[TeamNr] > 0 && GameData.CurrentRoundNr > 1)
|
||||
{
|
||||
@@ -593,7 +592,8 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
private void UpdateTeamChoosingMessage()
|
||||
{
|
||||
Texts[TextTeamChoosing].Color = CBase.Theme.GetPlayerColor(GameData.Team + 1);
|
||||
Texts[TextTeamChoosing].Text = CBase.Language.Translate("TR_TEAM", _PartyModeID) + " " + (GameData.Team + 1) + "! " + CBase.Language.Translate("TR_SCREENMAIN_TEAM_CHOOSE", _PartyModeID);
|
||||
Texts[TextTeamChoosing].Text = CBase.Language.Translate("TR_TEAM", _PartyModeID) + " " + (GameData.Team + 1) + "! " +
|
||||
CBase.Language.Translate("TR_SCREENMAIN_TEAM_CHOOSE", _PartyModeID);
|
||||
if (Status == EStatus.JokerRetry || Status == EStatus.FieldChoosing)
|
||||
Texts[TextTeamChoosing].Visible = true;
|
||||
else
|
||||
@@ -659,36 +659,29 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
|
||||
private int BuildWinnerPossibilities()
|
||||
{
|
||||
int NumOneRow = (int)Math.Sqrt((double)GameData.NumFields);
|
||||
Possibilities = new int[(NumOneRow * 2) + 2, NumOneRow];
|
||||
int NumOneRow = (int)Math.Sqrt(GameData.NumFields);
|
||||
Possibilities = new int[(NumOneRow * 2) + 2,NumOneRow];
|
||||
for (int i = 0; i < Possibilities.GetLength(0); i++)
|
||||
{
|
||||
if (i < NumOneRow)
|
||||
{
|
||||
for(int c = 0; c < NumOneRow; c++){
|
||||
for (int c = 0; c < NumOneRow; c++)
|
||||
Possibilities[i, c] = i * NumOneRow + c;
|
||||
}
|
||||
}
|
||||
else if (i < NumOneRow * 2)
|
||||
{
|
||||
for (int c = 0; c < NumOneRow; c++)
|
||||
{
|
||||
Possibilities[i, c] = (i-NumOneRow) + (c*NumOneRow);
|
||||
}
|
||||
Possibilities[i, c] = (i - NumOneRow) + (c * NumOneRow);
|
||||
}
|
||||
else if( i == Possibilities.GetLength(0) - 2)
|
||||
else if (i == Possibilities.GetLength(0) - 2)
|
||||
{
|
||||
for (int c = 0; c < NumOneRow;c++)
|
||||
{
|
||||
for (int c = 0; c < NumOneRow; c++)
|
||||
Possibilities[i, c] = (NumOneRow + 1) * c;
|
||||
}
|
||||
}
|
||||
else if (i == Possibilities.GetLength(0) - 1)
|
||||
{
|
||||
for (int c = 0; c < NumOneRow; c++)
|
||||
{
|
||||
Possibilities[i, c] = (NumOneRow - 1) * c + (NumOneRow - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
@@ -716,4 +709,4 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,14 +8,17 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
public class PartyScreenTicTacToeNames : CMenuParty
|
||||
{
|
||||
// Version number for theme files. Increment it, if you've changed something on the theme files!
|
||||
protected override int _ScreenVersion { get { return 1; } }
|
||||
protected override int _ScreenVersion
|
||||
{
|
||||
get { return 1; }
|
||||
}
|
||||
|
||||
const string ButtonNext = "ButtonNext";
|
||||
const string ButtonBack = "ButtonBack";
|
||||
const string ButtonPlayerDestination = "ButtonPlayerDestination";
|
||||
const string ButtonPlayerChoose = "ButtonPlayerChoose";
|
||||
const string ButtonPlayerChooseScrollUp = "ButtonPlayerChooseScrollUp";
|
||||
const string ButtonPlayerChooseScrollDown = "ButtonPlayerChooseScrollDown";
|
||||
private const string ButtonNext = "ButtonNext";
|
||||
private const string ButtonBack = "ButtonBack";
|
||||
private const string ButtonPlayerDestination = "ButtonPlayerDestination";
|
||||
private const string ButtonPlayerChoose = "ButtonPlayerChoose";
|
||||
private const string ButtonPlayerChooseScrollUp = "ButtonPlayerChooseScrollUp";
|
||||
private const string ButtonPlayerChooseScrollDown = "ButtonPlayerChooseScrollDown";
|
||||
|
||||
private List<CPlayerChooseButton> PlayerChooseButtons;
|
||||
private List<CButton> PlayerDestinationButtons;
|
||||
@@ -34,18 +37,18 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
private const int PlayerChooseButtonsFirstY = 105;
|
||||
private const int PlayerChooseButtonsSpaceH = 15;
|
||||
private const int PlayerChooseButtonsSpaceW = 25;
|
||||
private int PlayerChooseButtonsOffset = 0;
|
||||
private int PlayerChooseButtonsOffset;
|
||||
|
||||
private CStatic chooseAvatarStatic;
|
||||
private bool SelectingMouseActive = false;
|
||||
private int OldMouseX = 0;
|
||||
private int OldMouseY = 0;
|
||||
private bool SelectingMouseActive;
|
||||
private int OldMouseX;
|
||||
private int OldMouseY;
|
||||
private int SelectedPlayerNr = -1;
|
||||
private bool ButtonsAdded = false;
|
||||
private bool ButtonsAdded;
|
||||
|
||||
private int NumPlayerTeam1 = 2;
|
||||
private int NumPlayerTeam2 = 2;
|
||||
|
||||
|
||||
private DataFromScreen Data;
|
||||
|
||||
private class CPlayerChooseButton
|
||||
@@ -54,10 +57,6 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
public int ProfileID;
|
||||
}
|
||||
|
||||
public PartyScreenTicTacToeNames()
|
||||
{
|
||||
}
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
base.Init();
|
||||
@@ -71,7 +70,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
Data.ScreenNames.ProfileIDsTeam2 = new List<int>();
|
||||
|
||||
List<string> buttons = new List<string>();
|
||||
_ThemeButtons = new string[] { ButtonBack, ButtonNext, ButtonPlayerDestination, ButtonPlayerChoose, ButtonPlayerChooseScrollUp, ButtonPlayerChooseScrollDown };
|
||||
_ThemeButtons = new[] {ButtonBack, ButtonNext, ButtonPlayerDestination, ButtonPlayerChoose, ButtonPlayerChooseScrollUp, ButtonPlayerChooseScrollDown};
|
||||
|
||||
Data = new DataFromScreen();
|
||||
FromScreenNames names = new FromScreenNames();
|
||||
@@ -84,7 +83,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
|
||||
public override void LoadTheme(string XmlPath)
|
||||
{
|
||||
base.LoadTheme(XmlPath);
|
||||
base.LoadTheme(XmlPath);
|
||||
}
|
||||
|
||||
public override void DataToScreen(object ReceivedData)
|
||||
@@ -105,62 +104,53 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
NumPlayerTeam2 = config.NumPlayerTeam2;
|
||||
|
||||
while (Data.ScreenNames.ProfileIDsTeam1.Count > NumPlayerTeam1)
|
||||
{
|
||||
Data.ScreenNames.ProfileIDsTeam1.RemoveAt(Data.ScreenNames.ProfileIDsTeam1.Count - 1);
|
||||
}
|
||||
while (Data.ScreenNames.ProfileIDsTeam2.Count > NumPlayerTeam2)
|
||||
{
|
||||
Data.ScreenNames.ProfileIDsTeam2.RemoveAt(Data.ScreenNames.ProfileIDsTeam2.Count - 1);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
CBase.Log.LogError("Error in party mode screen TicTacToe names. Can't cast received data from game mode " + ThemeName + ". " + e.Message); ;
|
||||
CBase.Log.LogError("Error in party mode screen TicTacToe names. Can't cast received data from game mode " + ThemeName + ". " + e.Message);
|
||||
;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public override bool HandleInput(KeyEvent KeyEvent)
|
||||
{
|
||||
base.HandleInput(KeyEvent);
|
||||
|
||||
if (KeyEvent.KeyPressed)
|
||||
if (KeyEvent.KeyPressed) {}
|
||||
else
|
||||
{
|
||||
switch (KeyEvent.Key)
|
||||
{
|
||||
case Keys.Back:
|
||||
case Keys.Escape:
|
||||
Back();
|
||||
break;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (KeyEvent.Key)
|
||||
{
|
||||
case Keys.Back:
|
||||
case Keys.Escape:
|
||||
case Keys.Enter:
|
||||
if (Buttons[ButtonBack].Selected)
|
||||
Back();
|
||||
break;
|
||||
|
||||
case Keys.Enter:
|
||||
if (Buttons[ButtonBack].Selected)
|
||||
Back();
|
||||
if (Buttons[ButtonNext].Selected)
|
||||
Next();
|
||||
|
||||
if (Buttons[ButtonNext].Selected)
|
||||
Next();
|
||||
if (Buttons[ButtonPlayerChooseScrollUp].Selected)
|
||||
Scroll(-1);
|
||||
|
||||
if (Buttons[ButtonPlayerChooseScrollUp].Selected)
|
||||
Scroll(-1);
|
||||
if (Buttons[ButtonPlayerChooseScrollDown].Selected)
|
||||
Scroll(1);
|
||||
|
||||
if (Buttons[ButtonPlayerChooseScrollDown].Selected)
|
||||
Scroll(1);
|
||||
|
||||
if (!OnAdd())
|
||||
OnRemove();
|
||||
break;
|
||||
|
||||
case Keys.Delete:
|
||||
if (!OnAdd())
|
||||
OnRemove();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case Keys.Delete:
|
||||
OnRemove();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -195,7 +185,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//Check if LeftButton is hold and Select-Mode active
|
||||
if (MouseEvent.LBH && SelectingMouseActive)
|
||||
{
|
||||
@@ -207,7 +197,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
|
||||
return true;
|
||||
}
|
||||
// LeftButton isn't hold anymore, but Selec-Mode is still active -> "Drop" of Avatar
|
||||
// LeftButton isn't hold anymore, but Selec-Mode is still active -> "Drop" of Avatar
|
||||
else if (SelectingMouseActive)
|
||||
{
|
||||
//Check if really a player was selected
|
||||
@@ -217,7 +207,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
for (int i = 0; i < PlayerDestinationButtons.Count; i++)
|
||||
{
|
||||
//Check first, if area is "active"
|
||||
if (PlayerDestinationButtons[i].Visible == true)
|
||||
if (PlayerDestinationButtons[i].Visible)
|
||||
{
|
||||
//Check if Mouse is in area
|
||||
if (CHelper.IsInBounds(PlayerDestinationButtons[i].Rect, MouseEvent))
|
||||
@@ -286,14 +276,14 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
Scroll(1);
|
||||
}
|
||||
|
||||
if(MouseEvent.LD && IsMouseOver(MouseEvent))
|
||||
if (MouseEvent.LD && IsMouseOver(MouseEvent))
|
||||
{
|
||||
if (!OnAdd())
|
||||
OnRemove();
|
||||
}
|
||||
|
||||
if (MouseEvent.RB)
|
||||
{
|
||||
Back();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -335,12 +325,11 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
PlayerChooseButtonsOffset += Offset;
|
||||
UpdateButtonPlayerChoose();
|
||||
}
|
||||
else if (PlayerChooseButtonsVisibleProfiles.Count < PlayerChooseButtons.Count + (PlayerChooseButtonsOffset + Offset) * PlayerChooseButtonsNumH)
|
||||
else if (PlayerChooseButtonsVisibleProfiles.Count < PlayerChooseButtons.Count + (PlayerChooseButtonsOffset + Offset) * PlayerChooseButtonsNumH)
|
||||
{
|
||||
PlayerChooseButtonsOffset += Offset;
|
||||
UpdateButtonPlayerChoose();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void AddButtonPlayerDestination()
|
||||
@@ -397,16 +386,14 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
private void UpdateButtonPlayerChoose()
|
||||
{
|
||||
UpdateVisibleProfiles();
|
||||
if ((PlayerChooseButtonsNumW * PlayerChooseButtonsNumH) * (PlayerChooseButtonsOffset + 1) - PlayerChooseButtonsVisibleProfiles.Count >= (PlayerChooseButtonsNumW * PlayerChooseButtonsNumH) * PlayerChooseButtonsOffset)
|
||||
{
|
||||
if ((PlayerChooseButtonsNumW * PlayerChooseButtonsNumH) * (PlayerChooseButtonsOffset + 1) - PlayerChooseButtonsVisibleProfiles.Count >=
|
||||
(PlayerChooseButtonsNumW * PlayerChooseButtonsNumH) * PlayerChooseButtonsOffset)
|
||||
UpdateButtonPlayerChoose(PlayerChooseButtonsOffset - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateButtonPlayerChoose(PlayerChooseButtonsOffset);
|
||||
}
|
||||
Buttons[ButtonPlayerChooseScrollUp].Enabled = PlayerChooseButtonsOffset > 0;
|
||||
Buttons[ButtonPlayerChooseScrollDown].Enabled = PlayerChooseButtonsVisibleProfiles.Count > PlayerChooseButtons.Count + PlayerChooseButtonsOffset * PlayerChooseButtonsNumH;
|
||||
Buttons[ButtonPlayerChooseScrollDown].Enabled = PlayerChooseButtonsVisibleProfiles.Count >
|
||||
PlayerChooseButtons.Count + PlayerChooseButtonsOffset * PlayerChooseButtonsNumH;
|
||||
}
|
||||
|
||||
private void UpdateButtonPlayerChoose(int Offset)
|
||||
@@ -475,9 +462,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
}
|
||||
}
|
||||
if (visible)
|
||||
{
|
||||
PlayerChooseButtonsVisibleProfiles.Add(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -632,11 +617,11 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = PlayerDestinationButtonsNumH; i < PlayerDestinationButtonsNumH*2; i++)
|
||||
for (int i = PlayerDestinationButtonsNumH; i < PlayerDestinationButtonsNumH * 2; i++)
|
||||
{
|
||||
if (PlayerDestinationButtons[i].Selected)
|
||||
{
|
||||
if (((i-PlayerDestinationButtonsNumH) + 1) <= Data.ScreenNames.ProfileIDsTeam2.Count)
|
||||
if (((i - PlayerDestinationButtonsNumH) + 1) <= Data.ScreenNames.ProfileIDsTeam2.Count)
|
||||
{
|
||||
Data.ScreenNames.ProfileIDsTeam2.RemoveAt(i - PlayerDestinationButtonsNumH);
|
||||
UpdateButtonNext();
|
||||
@@ -664,4 +649,4 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
_PartyMode.DataFromScreen(ThemeName, Data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user