Пример #1
0
        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
            {

            }
        }
Пример #2
0
 public int AddLyric(CLyric lyric)
 {
     _Lyrics.Add(lyric);
     AddInteraction(_Lyrics.Count - 1, EType.TLyric);
     return _Lyrics.Count - 1;
 }