public PlaylistElement(PlaylistElement pe) { Cover = new CStatic(pe.Cover); Background = new CStatic(pe.Background); Text1 = new CText(pe.Text1); SelectSlide = new CSelectSlide(pe.SelectSlide); Content = pe.Content; }
public virtual void LoadTheme() { string file = Path.Combine(CTheme.GetThemeScreensPath(), _ThemeName + ".xml"); XPathDocument xPathDoc = null; XPathNavigator navigator = null; bool loaded = false; try { xPathDoc = new XPathDocument(file); navigator = xPathDoc.CreateNavigator(); loaded = true; } catch (Exception e) { loaded = false; if (navigator != null) navigator = null; if (xPathDoc != null) xPathDoc = null; CLog.LogError("Error loading theme file " + file + ": " + e.Message); } bool VersionCheck = false; if (loaded) VersionCheck = CheckVersion(_ScreenVersion, navigator); int SkinIndex = CTheme.GetSkinIndex(); if (loaded && VersionCheck && SkinIndex != -1) { LoadThemeBasics(navigator, SkinIndex); if (_ThemeBackgrounds != null) { for (int i = 0; i < _ThemeBackgrounds.Length; i++) { CBackground background = new CBackground(); if (background.LoadTheme("//root/" + _ThemeName, _ThemeBackgrounds[i], navigator, SkinIndex)) { _htBackgrounds.Add(_ThemeBackgrounds[i], AddBackground(background)); } else { CLog.LogError("Can't load Background \"" + _ThemeBackgrounds[i] + "\" in screen " + _ThemeName); } } } if (_ThemeStatics != null) { for (int i = 0; i < _ThemeStatics.Length; i++) { CStatic stat = new CStatic(); if (stat.LoadTheme("//root/" + _ThemeName, _ThemeStatics[i], navigator, SkinIndex)) { _htStatics.Add(_ThemeStatics[i], AddStatic(stat)); } else { CLog.LogError("Can't load Static \"" + _ThemeStatics[i] + "\" in screen " + _ThemeName); } } } if (_ThemeTexts != null) { for (int i = 0; i < _ThemeTexts.Length; i++) { CText text = new CText(); if (text.LoadTheme("//root/" + _ThemeName, _ThemeTexts[i], navigator, SkinIndex)) { _htTexts.Add(_ThemeTexts[i], AddText(text)); } else { CLog.LogError("Can't load Text \"" + _ThemeTexts[i] + "\" in screen " + _ThemeName); } } } if (_ThemeButtons != null) { for (int i = 0; i < _ThemeButtons.Length; i++) { CButton button = new CButton(); if (button.LoadTheme("//root/" + _ThemeName, _ThemeButtons[i], navigator, SkinIndex)) { _htButtons.Add(_ThemeButtons[i], AddButton(button)); } else { CLog.LogError("Can't load Button \"" + _ThemeButtons[i] + "\" in screen " + _ThemeName); } } } if (_ThemeSelectSlides != null) { for (int i = 0; i < _ThemeSelectSlides.Length; i++) { CSelectSlide slide = new CSelectSlide(); if (slide.LoadTheme("//root/" + _ThemeName, _ThemeSelectSlides[i], navigator, SkinIndex)) { _htSelectSlides.Add(_ThemeSelectSlides[i], AddSelectSlide(slide)); } else { CLog.LogError("Can't load SelectSlide \"" + _ThemeSelectSlides[i] + "\" in screen " + _ThemeName); } } } if (_ThemeSongMenus != null) { for (int i = 0; i < _ThemeSongMenus.Length; i++) { CSongMenu sm = new CSongMenu(); if (sm.LoadTheme("//root/" + _ThemeName, _ThemeSongMenus[i], navigator, SkinIndex)) { _htSongMenus.Add(_ThemeSongMenus[i], AddSongMenu(sm)); } else { CLog.LogError("Can't load SongMenu \"" + _ThemeSongMenus[i] + "\" in screen " + _ThemeName); } } } if (_ThemeLyrics != null) { for (int i = 0; i < _ThemeLyrics.Length; i++) { CLyric lyric = new CLyric(); if (lyric.LoadTheme("//root/" + _ThemeName, _ThemeLyrics[i], navigator, SkinIndex)) { _htLyrics.Add(_ThemeLyrics[i], AddLyric(lyric)); } else { CLog.LogError("Can't load Lyric \"" + _ThemeLyrics[i] + "\" in screen " + _ThemeName); } } } if (_ThemeSingNotes != null) { for (int i = 0; i < _ThemeSingNotes.Length; i++) { CSingNotes notes = new CSingNotesClassic(); if (notes.LoadTheme("//root/" + _ThemeName, _ThemeSingNotes[i], navigator, SkinIndex)) { _htSingNotes.Add(_ThemeSingNotes[i], AddSingNote(notes)); } else { CLog.LogError("Can't load SingBar \"" + _ThemeSingNotes[i] + "\" in screen " + _ThemeName); } } } } else { } }
public int AddSelectSlide(CSelectSlide slide) { _SelectSlides.Add(slide); AddInteraction(_SelectSlides.Count - 1, EType.TSelectSlide); return _SelectSlides.Count - 1; }
public override bool HandleInput(SKeyEvent keyEvent) { switch (keyEvent.Key) { case Keys.Add: if (CConfig.Config.Game.NumPlayers + 1 <= CSettings.MaxNumPlayer) { _SelectSlides[_SelectSlidePlayerNumber].Selection = CConfig.Config.Game.NumPlayers; _UpdatePlayerNumber(); //Update Tiles-List _NameSelections[_NameSelection].UpdateList(); } break; case Keys.Subtract: if (CConfig.Config.Game.NumPlayers - 1 > 0) { _SelectSlides[_SelectSlidePlayerNumber].Selection = CConfig.Config.Game.NumPlayers - 2; _UpdatePlayerNumber(); //Update Tiles-List _NameSelections[_NameSelection].UpdateList(); } break; case Keys.P: if (!_SelectingKeyboardActive) { _SelectingFastPlayerNr = 1; _SelectingFast = true; _ResetPlayerSelections(); } else { if (_SelectingFastPlayerNr + 1 <= CGame.NumPlayers) { _SelectingFastPlayerNr++; } else { _SelectingFastPlayerNr = 1; } _NameSelections[_NameSelection].FastSelection(true, _SelectingFastPlayerNr); } break; case Keys.N: CGraphics.ShowPopup(EPopupScreens.PopupNewPlayer); break; } //Check if selecting with keyboard is active if (_SelectingKeyboardActive) { //Handle left/right/up/down _NameSelections[_NameSelection].HandleInput(keyEvent); int numberPressed = -1; bool resetSelection = false; switch (keyEvent.Key) { case Keys.Enter: //Check, if a player is selected if (_NameSelections[_NameSelection].SelectedID != Guid.Empty) { _SelectedProfileID = _NameSelections[_NameSelection].SelectedID; if (!CProfiles.IsProfileIDValid(_SelectedProfileID)) { return(true); } _UpdateSelectedProfile(_SelectingFastPlayerNr - 1, _SelectedProfileID); } //Started selecting with 'P' if (_SelectingFast) { if (_SelectingFastPlayerNr == CGame.NumPlayers) { resetSelection = true; _SelectElement(_Buttons[_ButtonStart]); } else { _SelectingFastPlayerNr++; _NameSelections[_NameSelection].FastSelection(true, _SelectingFastPlayerNr); } } else { resetSelection = true; } break; case Keys.D1: case Keys.NumPad1: numberPressed = 1; break; case Keys.D2: case Keys.NumPad2: numberPressed = 2; break; case Keys.D3: case Keys.NumPad3: numberPressed = 3; break; case Keys.D4: case Keys.NumPad4: numberPressed = 4; break; case Keys.D5: case Keys.NumPad5: numberPressed = 5; break; case Keys.D6: case Keys.NumPad6: numberPressed = 6; break; case Keys.Escape: resetSelection = true; _SelectElement(_SelectSlides[_SelectSlidePlayerNumber]); break; case Keys.Delete: //Delete profile-selection _ResetPlayerSelection(_SelectingFastPlayerNr - 1); //Reset all values _SelectingFastPlayerNr = 0; _SelectingKeyboardActive = false; _NameSelections[_NameSelection].FastSelection(false, -1); //Update Tiles-List _NameSelections[_NameSelection].UpdateList(); break; case Keys.F10: if (CGame.GetNumSongs() == 1 && CGame.GetSong(0).IsDuet) { CSelectSlide selectSlideDuetPart = _SelectSlides[_PlayerSelectSlideDuet[_SelectingFastPlayerNr - 1]]; selectSlideDuetPart.Selection = (selectSlideDuetPart.Selection + 1) % 2; //Reset all values _SelectingFastPlayerNr = 0; _SelectingKeyboardActive = false; _SelectingFast = false; _NameSelections[_NameSelection].FastSelection(false, -1); _SelectElement(_Buttons[_ButtonStart]); } break; } if (numberPressed > 0 || resetSelection) { if (numberPressed == _SelectingFastPlayerNr || resetSelection) { //Reset all values _SelectingFastPlayerNr = 0; _SelectingKeyboardActive = false; _SelectElement(_SelectSlides[_SelectSlidePlayerNumber]); _NameSelections[_NameSelection].FastSelection(false, -1); } else if (numberPressed <= CConfig.Config.Game.NumPlayers) { _SelectingFastPlayerNr = numberPressed; _NameSelections[_NameSelection].FastSelection(true, numberPressed); } _SelectingFast = false; if (_PreviousPlayerSelection > -1) { _SelectElement(_Buttons[_PlayerButton[_PreviousPlayerSelection]]); _PreviousPlayerSelection = -1; } } } //Normal Keyboard handling else { base.HandleInput(keyEvent); switch (keyEvent.Key) { case Keys.Escape: case Keys.Back: CGraphics.FadeTo(EScreen.Song); break; case Keys.Enter: if (_Buttons[_ButtonBack].Selected) { CGraphics.FadeTo(EScreen.Song); } else if (_Buttons[_ButtonStart].Selected) { _StartSong(); } else if (_Buttons[_ButtonNewProfile].Selected) { CGraphics.ShowPopup(EPopupScreens.PopupNewPlayer); } for (int p = 0; p < CGame.NumPlayers; p++) { if (_Buttons[_PlayerButton[p]].Selected) { _PreviousPlayerSelection = p; _SelectingFastPlayerNr = p + 1; } } break; case Keys.D1: case Keys.NumPad1: _SelectingFastPlayerNr = 1; break; case Keys.D2: case Keys.NumPad2: _SelectingFastPlayerNr = 2; break; case Keys.D3: case Keys.NumPad3: _SelectingFastPlayerNr = 3; break; case Keys.D4: case Keys.NumPad4: _SelectingFastPlayerNr = 4; break; case Keys.D5: case Keys.NumPad5: _SelectingFastPlayerNr = 5; break; case Keys.D6: case Keys.NumPad6: _SelectingFastPlayerNr = 6; break; default: _UpdatePlayerNumber(); break; } if (_SelectingFastPlayerNr > 0 && _SelectingFastPlayerNr <= CConfig.Config.Game.NumPlayers) { _SelectingKeyboardActive = true; _NameSelections[_NameSelection].FastSelection(true, _SelectingFastPlayerNr); } if (_NameSelections[_NameSelection].Selected && !_SelectingKeyboardActive) { _SelectingKeyboardActive = true; _SelectingFast = true; _SelectingFastPlayerNr = 1; _SelectingKeyboardActive = true; _NameSelections[_NameSelection].FastSelection(true, _SelectingFastPlayerNr); } } return(true); }
public bool SetInteractionToSelectSlide(CSelectSlide slide) { for (int i = 0; i < _Interactions.Count; i++) { if (_Interactions[i].Type == EType.TSelectSlide) { if (_SelectSlides[_Interactions[i].Num].Visible && _SelectSlides[_Interactions[i].Num] == slide) { _UnsetSelected(); _UnsetHighlighted(_Selection); _Selection = i; _SetSelected(); return true; } } } return false; }