Exemple #1
0
        public static STexture GetSkinVideoTexture(string VideoName)
        {
            int SkinIndex = GetSkinIndex();

            if (SkinIndex != -1)
            {
                for (int i = 0; i < _Skins[SkinIndex].VideoList.Count; i++)
                {
                    SkinElement sk = _Skins[SkinIndex].VideoList[i];
                    if (sk.Name == VideoName)
                    {
                        float Time = 0f;
                        if (sk.VideoIndex == -1)
                        {
                            sk.VideoIndex = CVideo.VdLoad(GetVideoFilePath(sk.Name));
                            CVideo.VdSetLoop(sk.VideoIndex, true);
                        }
                        CVideo.VdGetFrame(sk.VideoIndex, ref sk.Texture, Time, ref Time);
                        _Skins[SkinIndex].VideoList[i] = sk;
                        return(sk.Texture);
                    }
                }
            }
            return(new STexture(-1));
        }
Exemple #2
0
        public static void SkinVideoResume(string VideoName)
        {
            int SkinIndex = GetSkinIndex();

            if (SkinIndex != -1)
            {
                for (int i = 0; i < _Skins[SkinIndex].VideoList.Count; i++)
                {
                    SkinElement sk = _Skins[SkinIndex].VideoList[i];
                    if (sk.Name == VideoName)
                    {
                        if (sk.VideoIndex == -1)
                        {
                            sk.VideoIndex = CVideo.VdLoad(GetVideoFilePath(sk.Name));
                            CVideo.VdSetLoop(sk.VideoIndex, true);
                        }
                        CVideo.VdResume(sk.VideoIndex);
                        _Skins[SkinIndex].VideoList[i] = sk;
                        return;
                    }
                }
            }
        }
Exemple #3
0
        public static void LoadSkins()
        {
            for (int index = 0; index < _Skins.Count; index++)
            {
                bool           loaded    = false;
                XPathDocument  xPathDoc  = null;
                XPathNavigator navigator = null;

                try
                {
                    xPathDoc  = new XPathDocument(Path.Combine(_Skins[index].Path, _Skins[index].FileName));
                    navigator = xPathDoc.CreateNavigator();
                    loaded    = true;
                }
                catch (Exception e)
                {
                    CLog.LogError("Error loading skin " + _Skins[index].FileName + ": " + e.Message);
                    loaded = false;
                    if (navigator != null)
                    {
                        navigator = null;
                    }

                    if (xPathDoc != null)
                    {
                        xPathDoc = null;
                    }
                }

                if (loaded)
                {
                    string value = String.Empty;


                    // load skins/textures
                    List <string> keys = new List <string>(_Skins[index].SkinList.Keys);

                    foreach (string name in keys)
                    {
                        try
                        {
                            CHelper.GetValueFromXML("//root/Skins/" + name, navigator, ref value, String.Empty);
                            SkinElement sk = _Skins[index].SkinList[name];
                            sk.Value      = value;
                            sk.VideoIndex = -1;
                            sk.Texture    = CDraw.AddTexture(Path.Combine(_Skins[index].Path, sk.Value));
                            _Skins[index].SkinList[name] = sk;
                        }
                        catch (Exception e)
                        {
                            MessageBox.Show("Error on loading texture \"" + name + "\": " + e.Message + e.StackTrace);
                            CLog.LogError("Error on loading texture \"" + name + "\": " + e.Message + e.StackTrace);
                        }
                    }


                    // load videos
                    for (int i = 0; i < _Skins[index].VideoList.Count; i++)
                    {
                        try
                        {
                            CHelper.GetValueFromXML("//root/Videos/" + _Skins[index].VideoList[i].Name, navigator, ref value, String.Empty);
                            SkinElement sk = new SkinElement();
                            sk.Name       = _Skins[index].VideoList[i].Name;
                            sk.Value      = value;
                            sk.VideoIndex = CVideo.VdLoad(Path.Combine(_Skins[index].Path, sk.Value));
                            CVideo.VdSetLoop(sk.VideoIndex, true);
                            CVideo.VdPause(sk.VideoIndex);
                            sk.Texture = new STexture(-1);
                            _Skins[index].VideoList[i] = sk;
                        }
                        catch (Exception e)
                        {
                            MessageBox.Show("Error on loading video \"" + _Skins[index].VideoList[i].Name + "\": " + e.Message + e.StackTrace);
                            CLog.LogError("Error on loading video \"" + _Skins[index].VideoList[i].Name + "\": " + e.Message + e.StackTrace);
                        }
                    }

                    // load colors
                    LoadColors(navigator, index);
                }
            }
        }