From 3b7db42a892e2aaf17b18bad5d23b41affac990b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20K=C3=BCpper?= Date: Fri, 20 Dec 2013 15:57:02 +0100 Subject: [PATCH] PartyNames: Added support for no teams. --- .../Screens/PartyScreenChallengeNames.xml | 266 ++++++++----- .../Challenge/Textures/PlayerSelector.png | Bin 0 -> 1086 bytes Output/PartyModes/Challenge/Textures/Skin.xml | 3 +- .../TicTacToe/Textures/PlayerSelector.png | Bin 0 -> 1086 bytes .../CPartyScreenChallengeNames.cs | 358 +----------------- VocaluxeLib/Menu/CMenuPartyNameSelection.cs | 7 + 6 files changed, 191 insertions(+), 443 deletions(-) create mode 100644 Output/PartyModes/Challenge/Textures/PlayerSelector.png create mode 100644 Output/PartyModes/TicTacToe/Textures/PlayerSelector.png diff --git a/Output/PartyModes/Challenge/Screens/PartyScreenChallengeNames.xml b/Output/PartyModes/Challenge/Screens/PartyScreenChallengeNames.xml index 42fb5218..5405a82a 100644 --- a/Output/PartyModes/Challenge/Screens/PartyScreenChallengeNames.xml +++ b/Output/PartyModes/Challenge/Screens/PartyScreenChallengeNames.xml @@ -57,7 +57,7 @@ - + Button @@ -65,7 +65,7 @@ Button 985 - 600 + 625 0,00 150 50 @@ -122,7 +122,7 @@ Button 145 - 600 + 625 0,00 150 50 @@ -172,103 +172,183 @@ 26 - + - CoverTile - - CoverTile - - 0 - 0 + Invisible + + SelectSlideArrowLeft + + SelectSlideArrowRight + + SelectSlide + + SelectSlideArrowLeft + + SelectSlideArrowRight + + SelectSlide + + 40 + 100 0,00 - 100 - 100 - + 1200 + 50 + + 45 + 105 + 0,00 + 40 + 40 + + 1170 + 105 + 0,00 + 40 + 40 + - ButtonColor - + SelectSlideColor + - ButtonSColor - - - 50 - 102 - - 20 - - 98 - - - ButtonTextColor - - - ButtonTextSColor - - Center - - Center - - - - Outline - - - - - - - - - - - + SelectSlideSColor + + + SelectSlideHColor + + + ArrowColor + + + ArrowSColor + + + TextColor + + + TextSColor + + 27,00 + + + + 205,33 + + Outline + + Bold + + 2 + + - CoverTile - - CoverTile - - 0 - 0 + Invisible + + SelectSlideArrowLeft + + SelectSlideArrowRight + + SelectSlidePlayer + + SelectSlideArrowLeft + + SelectSlideArrowRight + + SelectSlidePlayer + + 40 + 160 0,00 - 100 - 100 - + 1200 + 150 + + 45 + 165 + 0,00 + 40 + 40 + + 1170 + 165 + 0,00 + 40 + 40 + - ButtonColor - + SelectSlideColor + - ButtonSColor - - - 50 - 102 - - 20 - - 98 - - - ButtonTextColor - - - ButtonTextSColor - - Center - - Center - - - - Outline - - - - - - - - - - + SelectSlideSColor + + + SelectSlideHColor + + + ArrowColor + + + ArrowSColor + + + TextColor + + + TextSColor + + 27,00 + + + -5,00 + + 205,33 + + Outline + + Bold + + 3 + + + + 42 + 327 + 0,00 + 1200 + 393 + + CoverTile + + + 1,00 + 1,00 + 1,00 + 0,20 + + PlayerSelector + + + + 100 + 100 + + 10 + 2 + + 20,71 + 30,00 + + + + 2,0 + + Outline + + TextColor + + + + 17 + + + diff --git a/Output/PartyModes/Challenge/Textures/PlayerSelector.png b/Output/PartyModes/Challenge/Textures/PlayerSelector.png new file mode 100644 index 0000000000000000000000000000000000000000..c57ab300c6f81daf0fa108e731ea9f8864af7f7e GIT binary patch literal 1086 zcmeAS@N?(olHy`uVBq!ia0vp^zd)FS4M=vpiLwP!jKx9jP7LeL$-D$|*pj^6U4S$Y z{B+)352QE?JR*x37`TN&n2}-D90{Nxdx@v7EBhT5MiD*UuHKV5Kq1-8kcblJ{M_8s zyb>Unfx)>bHL)Z$MWH;iBtya7(>EYRFO{8vfqAN@i(^Q|t+%%f{iFj$+AjWgD_M5* z^@63v?^O>dd3fn7q<&EPAarNxg2hYE2`yl~HC-t=MOu1|hSHfAbGXv}%+ju{IzP{o zq2b?ZXZssb(yEr;M!rU#MOif;9=@A&MxHVa->RI{Ik{Bw@N#4SPkUF% z{j>UV?N;Ta?9DCy?-#8S`<+*JQ@CR5wRJ9hdkgPI?ao^J_RgOEZ#usouHf6dIqTc& z-R|YbOC|0Z?%Sqh?^%@ZccJ?6SNRv)_AfqvhMg^OTe185d6VsD@$($}_{#G4ufDo8 zJp&DW-}V1r+1VBp&XoUC{~=9TtCk2@DU>+8Xt=<*klBg7g^xoPgi!=x5->r>7j6s?r7#i3h0O^45J5CU z1+35vCDJA&cM)qYy3>H(!t?=}xd@Ly0|ASB(apv1a>E5j7IK05qHk;S0(QJwK(ooZtj#P7jqH}`c}Wn zeEi~G?2OsGJcnvTe;(_*_x6>#=ex5URrxWY{HyEDz(1KdYfeXDSTo1Mtzxw z3$MF>JNoTtt^S!BVe2pYpVr+Cf3-Gr?bgpK*PpTPwOFVB?QYFy(HnUWZ@lB1UnMTT zU-aj0>tEO2*?ARBOPQ52>B*IzhllSzJujVqT4np|{tFBZ3xD%6HRiFe7S=op%DJAd KelF{r5}E*YeWUFF literal 0 HcmV?d00001 diff --git a/Output/PartyModes/Challenge/Textures/Skin.xml b/Output/PartyModes/Challenge/Textures/Skin.xml index 4912e998..229c0284 100644 --- a/Output/PartyModes/Challenge/Textures/Skin.xml +++ b/Output/PartyModes/Challenge/Textures/Skin.xml @@ -148,8 +148,9 @@ ScrollUp.png ScrollDown.png Invisible.png + PlayerSelector.png [Blue]BG_Video.mp4 - \ No newline at end of file + diff --git a/Output/PartyModes/TicTacToe/Textures/PlayerSelector.png b/Output/PartyModes/TicTacToe/Textures/PlayerSelector.png new file mode 100644 index 0000000000000000000000000000000000000000..c57ab300c6f81daf0fa108e731ea9f8864af7f7e GIT binary patch literal 1086 zcmeAS@N?(olHy`uVBq!ia0vp^zd)FS4M=vpiLwP!jKx9jP7LeL$-D$|*pj^6U4S$Y z{B+)352QE?JR*x37`TN&n2}-D90{Nxdx@v7EBhT5MiD*UuHKV5Kq1-8kcblJ{M_8s zyb>Unfx)>bHL)Z$MWH;iBtya7(>EYRFO{8vfqAN@i(^Q|t+%%f{iFj$+AjWgD_M5* z^@63v?^O>dd3fn7q<&EPAarNxg2hYE2`yl~HC-t=MOu1|hSHfAbGXv}%+ju{IzP{o zq2b?ZXZssb(yEr;M!rU#MOif;9=@A&MxHVa->RI{Ik{Bw@N#4SPkUF% z{j>UV?N;Ta?9DCy?-#8S`<+*JQ@CR5wRJ9hdkgPI?ao^J_RgOEZ#usouHf6dIqTc& z-R|YbOC|0Z?%Sqh?^%@ZccJ?6SNRv)_AfqvhMg^OTe185d6VsD@$($}_{#G4ufDo8 zJp&DW-}V1r+1VBp&XoUC{~=9TtCk2@DU>+8Xt=<*klBg7g^xoPgi!=x5->r>7j6s?r7#i3h0O^45J5CU z1+35vCDJA&cM)qYy3>H(!t?=}xd@Ly0|ASB(apv1a>E5j7IK05qHk;S0(QJwK(ooZtj#P7jqH}`c}Wn zeEi~G?2OsGJcnvTe;(_*_x6>#=ex5URrxWY{HyEDz(1KdYfeXDSTo1Mtzxw z3$MF>JNoTtt^S!BVe2pYpVr+Cf3-Gr?bgpK*PpTPwOFVB?QYFy(HnUWZ@lB1UnMTT zU-aj0>tEO2*?ARBOPQ52>B*IzhllSzJujVqT4np|{tFBZ3xD%6HRiFe7S=op%DJAd KelF{r5}E*YeWUFF literal 0 HcmV?d00001 diff --git a/PartyModes/PartyModeChallenge/CPartyScreenChallengeNames.cs b/PartyModes/PartyModeChallenge/CPartyScreenChallengeNames.cs index 16b275de..203d54f2 100644 --- a/PartyModes/PartyModeChallenge/CPartyScreenChallengeNames.cs +++ b/PartyModes/PartyModeChallenge/CPartyScreenChallengeNames.cs @@ -25,7 +25,7 @@ using VocaluxeLib.Profile; namespace VocaluxeLib.PartyModes.Challenge { // ReSharper disable UnusedMember.Global - public class CPartyScreenChallengeNames : CMenuParty + public class CPartyScreenChallengeNames : CMenuPartyNameSelection // ReSharper restore UnusedMember.Global { // Version number for theme files. Increment it, if you've changed something on the theme files! @@ -34,58 +34,14 @@ namespace VocaluxeLib.PartyModes.Challenge get { return 1; } } - private const string _ButtonNext = "ButtonNext"; - private const string _ButtonBack = "ButtonBack"; - private const string _ButtonPlayerDestination = "ButtonPlayerDestination"; - private const string _ButtonPlayerChoose = "ButtonPlayerChoose"; - - private List _PlayerChooseButtons; - private List _PlayerDestinationButtons; - //PlayerDestinationButtons-Option - private const int _PlayerDestinationButtonsNumH = 3; - private const int _PlayerDestinationButtonsFirstX = 900; - private const int _PlayerDestinationButtonsFirstY = 105; - private const int _PlayerDestinationButtonsSpaceH = 15; - private const int _PlayerDestinationButtonsSpaceW = 25; - //PlayerChooseButtons-Option - private List _PlayerChooseButtonsVisibleProfiles; - private const int _PlayerChooseButtonsNumH = 7; - private const int _PlayerChooseButtonsNumW = 4; - private const int _PlayerChooseButtonsFirstX = 52; - private const int _PlayerChooseButtonsFirstY = 105; - private const int _PlayerChooseButtonsSpaceH = 15; - private const int _PlayerChooseButtonsSpaceW = 25; - private const int _PlayerChooseButtonsOffset = 0; - - private CStatic _ChooseAvatarStatic; - private bool _SelectingMouseActive; - private int _OldMouseX; - private int _OldMouseY; - private bool _ButtonsAdded; - - private int _NumPlayer = 4; - + private int _NumPlayer = 4; private SDataFromScreen _Data; - private class CPlayerChooseButton - { - public CButton Button; - public int ProfileID; - } - public override void Init() { base.Init(); - _ChooseAvatarStatic = GetNewStatic(); - _ChooseAvatarStatic.Visible = false; - - _PlayerChooseButtonsVisibleProfiles = new List(); - _Data.ScreenNames.ProfileIDs = new List(); - - _ThemeButtons = new string[] {_ButtonBack, _ButtonNext, _ButtonPlayerDestination, _ButtonPlayerChoose}; - _Data = new SDataFromScreen(); var names = new SFromScreenNames {FadeBack = false, ProfileIDs = new List()}; _Data.ScreenNames = names; @@ -109,320 +65,24 @@ namespace VocaluxeLib.PartyModes.Challenge } } - public override bool HandleInput(SKeyEvent keyEvent) - { - base.HandleInput(keyEvent); - - if (keyEvent.KeyPressed) {} - else - { - switch (keyEvent.Key) - { - case Keys.Back: - case Keys.Escape: - _Back(); - break; - - case Keys.Enter: - if (_Buttons[_ButtonBack].Selected) - _Back(); - - if (_Buttons[_ButtonNext].Selected) - _Next(); - - if (!_OnAdd()) - _OnRemove(); - break; - - case Keys.Delete: - _OnRemove(); - break; - } - } - return true; - } - - public override bool HandleMouse(SMouseEvent mouseEvent) - { - base.HandleMouse(mouseEvent); - - //Check if LeftButton is hold and Select-Mode active - if (mouseEvent.LBH && _SelectingMouseActive) - { - //Update coords for Drag/Drop-Texture - _ChooseAvatarStatic.Rect.X += mouseEvent.X - _OldMouseX; - _ChooseAvatarStatic.Rect.Y += mouseEvent.Y - _OldMouseY; - _OldMouseX = mouseEvent.X; - _OldMouseY = mouseEvent.Y; - } - // LeftButton isn't hold anymore, but Selec-Mode is still active -> "Drop" of Avatar - else if (_SelectingMouseActive) - { - //Reset variables - _SelectingMouseActive = false; - _ChooseAvatarStatic.Visible = false; - } - - if (mouseEvent.LB && _IsMouseOver(mouseEvent)) - { - if (_Buttons[_ButtonBack].Selected) - _Back(); - - if (_Buttons[_ButtonNext].Selected) - _Next(); - - if (!_OnAdd()) - _OnRemove(); - } - - if (mouseEvent.RB) - _Back(); - - return true; - } - public override void OnShow() { base.OnShow(); - - if (!_ButtonsAdded) - { - _AddButtonPlayerDestination(); - _AddButtonPlayerChoose(); - _ButtonsAdded = true; - } - - _UpdateButtonPlayerDestination(); - _UpdateButtonPlayerChoose(); - - _UpdateButtonNext(); + SetPartyModeData(_NumPlayer); } - public override bool UpdateGame() - { - return true; - } - - public override bool Draw() - { - base.Draw(); - if (_ChooseAvatarStatic.Visible) - _ChooseAvatarStatic.Draw(); - return true; - } - - private void _AddButtonPlayerDestination() - { - _Buttons[_ButtonPlayerDestination].Visible = false; - _PlayerDestinationButtons = new List(); - int row = 0; - int column = 0; - for (int i = 1; i <= _PartyMode.GetMaxPlayer(); i++) - { - CButton b = GetNewButton(_Buttons[_ButtonPlayerDestination]); - b.Rect.X = _PlayerDestinationButtonsFirstX + column * (b.Rect.W + _PlayerDestinationButtonsSpaceH); - b.Rect.Y = _PlayerDestinationButtonsFirstY + row * (b.Rect.H + _PlayerDestinationButtonsSpaceW); - _PlayerDestinationButtons.Add(b); - column++; - if (column >= _PlayerDestinationButtonsNumH) - { - row++; - column = 0; - } - b.Visible = true; - b.Enabled = false; - _AddButton(b); - } - } - - private void _AddButtonPlayerChoose() - { - _Buttons[_ButtonPlayerChoose].Visible = false; - _PlayerChooseButtons = new List(); - int row = 0; - int column = 0; - for (int i = 1; i <= _PlayerChooseButtonsNumH * _PlayerChooseButtonsNumW; i++) - { - CButton b = GetNewButton(_Buttons[_ButtonPlayerChoose]); - b.Rect.X = _PlayerChooseButtonsFirstX + column * (b.Rect.W + _PlayerChooseButtonsSpaceH); - b.Rect.Y = _PlayerChooseButtonsFirstY + row * (b.Rect.H + _PlayerChooseButtonsSpaceW); - var pcb = new CPlayerChooseButton {Button = b, ProfileID = -1}; - _PlayerChooseButtons.Add(pcb); - column++; - if (column >= _PlayerChooseButtonsNumH) - { - row++; - column = 0; - } - b.Visible = true; - b.Enabled = false; - _AddButton(b); - } - } - - private void _UpdateButtonPlayerChoose() - { - _UpdateVisibleProfiles(); - if ((_PlayerChooseButtonsNumW * _PlayerChooseButtonsNumH) * (_PlayerChooseButtonsOffset + 1) - _PlayerChooseButtonsVisibleProfiles.Count >= - (_PlayerChooseButtonsNumW * _PlayerChooseButtonsNumH) * _PlayerChooseButtonsOffset) - _UpdateButtonPlayerChoose(_PlayerChooseButtonsOffset - 1); - else - _UpdateButtonPlayerChoose(_PlayerChooseButtonsOffset); - } - - private void _UpdateButtonPlayerChoose(int offset) - { - const int numButtonPlayerChoose = _PlayerChooseButtonsNumW * _PlayerChooseButtonsNumH; - if (offset < 0) - offset = 0; - - if (numButtonPlayerChoose * (offset + 1) - _PlayerChooseButtonsVisibleProfiles.Count <= numButtonPlayerChoose) - { - for (int i = 0; i < numButtonPlayerChoose; i++) - { - if ((i + offset * numButtonPlayerChoose) < _PlayerChooseButtonsVisibleProfiles.Count) - { - int id = _PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose]; - _PlayerChooseButtons[i].ProfileID = id; - _PlayerChooseButtons[i].Button.Text.Text = CBase.Profiles.GetPlayerName(id); - _PlayerChooseButtons[i].Button.Texture = CBase.Profiles.GetAvatar(id); - _PlayerChooseButtons[i].Button.SelTexture = CBase.Profiles.GetAvatar(id); - _PlayerChooseButtons[i].Button.Color = new SColorF(1, 1, 1, 0.6f); - _PlayerChooseButtons[i].Button.SelColor = new SColorF(1, 1, 1, 1); - _PlayerChooseButtons[i].Button.Enabled = true; - } - else - { - _PlayerChooseButtons[i].ProfileID = -1; - _PlayerChooseButtons[i].Button.Text.Text = String.Empty; - _PlayerChooseButtons[i].Button.Texture = _Buttons[_ButtonPlayerChoose].Texture; - _PlayerChooseButtons[i].Button.SelTexture = _Buttons[_ButtonPlayerChoose].SelTexture; - _PlayerChooseButtons[i].Button.Color = _Buttons[_ButtonPlayerChoose].Color; - _PlayerChooseButtons[i].Button.SelColor = _Buttons[_ButtonPlayerChoose].SelColor; - _PlayerChooseButtons[i].Button.Enabled = false; - } - } - } - } - - private void _UpdateVisibleProfiles() - { - _PlayerChooseButtonsVisibleProfiles.Clear(); - CProfile[] profiles = CBase.Profiles.GetProfiles(); - foreach (CProfile profile in profiles) - { - bool visible = false; - //Show profile only if active - if (profile.Active == EOffOn.TR_CONFIG_ON) - visible = _Data.ScreenNames.ProfileIDs.All(profileID => profileID != profile.ID); - if (visible) - _PlayerChooseButtonsVisibleProfiles.Add(profile.ID); - } - } - - private void _UpdateButtonPlayerDestination() - { - for (int i = 0; i < _PlayerDestinationButtons.Count; i++) - { - if (_NumPlayer > i) - { - _PlayerDestinationButtons[i].Visible = true; - _PlayerDestinationButtons[i].Enabled = true; - } - else - { - _PlayerDestinationButtons[i].Visible = false; - _PlayerDestinationButtons[i].Enabled = false; - } - } - for (int i = 0; i < _NumPlayer; i++) - { - if (i < _Data.ScreenNames.ProfileIDs.Count) - { - if (_Data.ScreenNames.ProfileIDs[i] != -1) - { - int id = _Data.ScreenNames.ProfileIDs[i]; - _PlayerDestinationButtons[i].Color = new SColorF(1, 1, 1, 0.6f); - _PlayerDestinationButtons[i].SelColor = new SColorF(1, 1, 1, 1); - _PlayerDestinationButtons[i].Texture = CBase.Profiles.GetAvatar(id); - _PlayerDestinationButtons[i].SelTexture = CBase.Profiles.GetAvatar(id); - _PlayerDestinationButtons[i].Text.Text = CBase.Profiles.GetPlayerName(id); - _PlayerDestinationButtons[i].Enabled = true; - } - } - else - { - _PlayerDestinationButtons[i].Color = _Buttons[_ButtonPlayerDestination].Color; - _PlayerDestinationButtons[i].SelColor = _Buttons[_ButtonPlayerDestination].SelColor; - _PlayerDestinationButtons[i].Texture = _Buttons[_ButtonPlayerDestination].Texture; - _PlayerDestinationButtons[i].SelTexture = _Buttons[_ButtonPlayerDestination].SelTexture; - _PlayerDestinationButtons[i].Text.Text = String.Empty; - _PlayerDestinationButtons[i].Enabled = false; - } - } - } - - private void _UpdateButtonNext() - { - if (_Data.ScreenNames.ProfileIDs.Count == _NumPlayer) - { - _Buttons[_ButtonNext].Visible = true; - _SetInteractionToButton(_Buttons[_ButtonNext]); - } - else - _Buttons[_ButtonNext].Visible = false; - } - - private bool _OnAdd() - { - foreach (CPlayerChooseButton button in _PlayerChooseButtons) - { - int id = button.ProfileID; - if (!button.Button.Selected || id == -1 || _Data.ScreenNames.ProfileIDs.Count >= _NumPlayer) - continue; - _Data.ScreenNames.ProfileIDs.Add(id); - int added = _Data.ScreenNames.ProfileIDs.Count - 1; - _UpdateButtonNext(); - //Update texture and name - _PlayerDestinationButtons[added].Color = new SColorF(1, 1, 1, 0.6f); - _PlayerDestinationButtons[added].SelColor = new SColorF(1, 1, 1, 1); - _PlayerDestinationButtons[added].Texture = CBase.Profiles.GetAvatar(id); - _PlayerDestinationButtons[added].SelTexture = CBase.Profiles.GetAvatar(id); - _PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetPlayerName(id); - _PlayerDestinationButtons[added].Enabled = true; - //Update Tiles-List - _UpdateButtonPlayerChoose(); - _CheckInteraction(); - return true; - } - return false; - } - - private void _OnRemove() - { - for (int i = 0; i < _PlayerDestinationButtons.Count; i++) - { - if (!_PlayerDestinationButtons[i].Selected) - continue; - if ((i + 1) > _Data.ScreenNames.ProfileIDs.Count) - continue; - _Data.ScreenNames.ProfileIDs.RemoveAt(i); - _UpdateButtonNext(); - _UpdateButtonPlayerDestination(); - _UpdateButtonPlayerChoose(); - _CheckInteraction(); - return; - } - } - - private void _Back() + public override void Back() { + List ids = GetTeamIDs(0); + _Data.ScreenNames.ProfileIDs = ids; _Data.ScreenNames.FadeBack = true; _PartyMode.DataFromScreen(ThemeName, _Data); } - private void _Next() + public override void Next() { + List ids = GetTeamIDs(0); + _Data.ScreenNames.ProfileIDs = ids; _Data.ScreenNames.FadeBack = false; _PartyMode.DataFromScreen(ThemeName, _Data); } diff --git a/VocaluxeLib/Menu/CMenuPartyNameSelection.cs b/VocaluxeLib/Menu/CMenuPartyNameSelection.cs index 15c1122d..569b3cee 100644 --- a/VocaluxeLib/Menu/CMenuPartyNameSelection.cs +++ b/VocaluxeLib/Menu/CMenuPartyNameSelection.cs @@ -70,6 +70,12 @@ namespace VocaluxeLib.Menu CBase.Profiles.AddProfileChangedCallback(_OnProfileChanged); } + public void SetPartyModeData(int numPlayer) + { + SetPartyModeData(1, numPlayer, new int[] { numPlayer }); + _CurrentTeam = 0; + } + public void SetPartyModeData(int numTeams, int numPlayer, int[] numPlayerTeams) { _NumTeams = numTeams; @@ -357,6 +363,7 @@ namespace VocaluxeLib.Menu base.LoadTheme(xmlPath); _SelectSlides[_SelectSlidePlayer].WithTextures = true; _SelectSlides[_SelectSlidePlayer].SelectionByHover = true; + _SelectSlides[_SelectSlideTeams].Visible = _Teams; } public override bool UpdateGame()