예제 #1
0
파일: CStatic.cs 프로젝트: zhaozw/Vocaluxe
        public bool LoadTheme(string XmlPath, string ElementName, XPathNavigator navigator, int SkinIndex)
        {
            string item = XmlPath + "/" + ElementName;

            _ThemeLoaded = true;

            _ThemeLoaded &= CHelper.GetValueFromXML(item + "/Skin", navigator, ref _Theme.TextureName, String.Empty);

            _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/X", navigator, ref Rect.X);
            _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/Y", navigator, ref Rect.Y);
            _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/Z", navigator, ref Rect.Z);
            _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/W", navigator, ref Rect.W);
            _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/H", navigator, ref Rect.H);

            if (CHelper.GetValueFromXML(item + "/Color", navigator, ref _Theme.ColorName, String.Empty))
            {
                _ThemeLoaded &= CTheme.GetColor(_Theme.ColorName, SkinIndex, ref Color);
            }
            else
            {
                _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/R", navigator, ref Color.R);
                _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/G", navigator, ref Color.G);
                _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/B", navigator, ref Color.B);
                _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/A", navigator, ref Color.A);
            }

            if (CHelper.ItemExistsInXML(item + "/Reflection", navigator))
            {
                Reflection    = true;
                _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/Reflection/Space", navigator, ref ReflectionSpace);
                _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/Reflection/Height", navigator, ref ReflectionHeight);
            }
            else
            {
                Reflection = false;
            }

            if (_ThemeLoaded)
            {
                _Theme.Name = ElementName;
                LoadTextures();
            }
            return(_ThemeLoaded);
        }
예제 #2
0
파일: CText.cs 프로젝트: zhaozw/Vocaluxe
        public bool LoadTheme(string XmlPath, string ElementName, XPathNavigator navigator, int SkinIndex, bool ButtonText)
        {
            string item = XmlPath + "/" + ElementName;

            _ThemeLoaded = true;

            _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/X", navigator, ref _X);
            _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/Y", navigator, ref _Y);

            if (!ButtonText)
            {
                _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/Z", navigator, ref _Z);
            }

            _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/H", navigator, ref _Height);
            CHelper.TryGetFloatValueFromXML(item + "/MaxW", navigator, ref _MaxWidth);

            if (CHelper.GetValueFromXML(item + "/Color", navigator, ref _Theme.ColorName, String.Empty))
            {
                _ThemeLoaded &= CTheme.GetColor(_Theme.ColorName, SkinIndex, ref Color);
            }
            else
            {
                _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/R", navigator, ref Color.R);
                _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/G", navigator, ref Color.G);
                _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/B", navigator, ref Color.B);
                _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/A", navigator, ref Color.A);
            }

            if (CHelper.GetValueFromXML(item + "/SColor", navigator, ref _Theme.SColorName, String.Empty))
            {
                _ThemeLoaded &= CTheme.GetColor(_Theme.SColorName, SkinIndex, ref SColor);
            }
            else
            {
                if (CHelper.TryGetFloatValueFromXML(item + "/SR", navigator, ref SColor.R))
                {
                    _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/SG", navigator, ref SColor.G);
                    _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/SB", navigator, ref SColor.B);
                    _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/SA", navigator, ref SColor.A);
                }
            }

            _ThemeLoaded &= CHelper.TryGetEnumValueFromXML <EAlignment>(item + "/Align", navigator, ref _Align);
            _ThemeLoaded &= CHelper.TryGetEnumValueFromXML <EStyle>(item + "/Style", navigator, ref _Style);
            _ThemeLoaded &= CHelper.GetValueFromXML(item + "/Font", navigator, ref _Fon, "Normal");

            _ThemeLoaded &= CHelper.GetValueFromXML(item + "/Text", navigator, ref _Theme.Text, String.Empty);

            if (CHelper.ItemExistsInXML(item + "/Reflection", navigator) && !ButtonText)
            {
                Reflection    = true;
                _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/Reflection/Space", navigator, ref ReflectionSpace);
                _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/Reflection/Height", navigator, ref ReflectionHeight);
            }
            else
            {
                Reflection = false;
            }

            // Set values
            X        = _X;
            Y        = _Y;
            Z        = _Z;
            Height   = _Height;
            MaxWidth = _MaxWidth;
            Text     = _Theme.Text;
            Fon      = _Fon;
            Align    = _Align;
            Style    = _Style;

            if (_ThemeLoaded)
            {
                _Theme.Name = ElementName;
                LoadTextures();

                if (MaxWidth > 0)
                {
                    Bounds = new SRectF(-CSettings.iRenderW, -CSettings.iRenderH, MaxWidth, 3f * CSettings.iRenderH, 0f);
                }
                else
                {
                    Bounds = new SRectF(-CSettings.iRenderW, -CSettings.iRenderH, 3f * CSettings.iRenderW, 3f * CSettings.iRenderH, 0f);
                }

                _ButtonText = ButtonText;
            }
            return(_ThemeLoaded);
        }
예제 #3
0
        public bool LoadTheme(string XmlPath, string ElementName, XPathNavigator navigator, int SkinIndex)
        {
            string item = XmlPath + "/" + ElementName;

            _ThemeLoaded = true;

            _ThemeLoaded &= CHelper.GetValueFromXML(item + "/Skin", navigator, ref _Theme.TextureName, String.Empty);

            _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/X", navigator, ref Rect.X);
            _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/Y", navigator, ref Rect.Y);
            _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/Z", navigator, ref Rect.Z);
            _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/W", navigator, ref Rect.W);
            _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/H", navigator, ref Rect.H);

            _ThemeLoaded &= CHelper.TryGetIntValueFromXML(item + "/NumBars", navigator, ref _Theme.NumBars);

            _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/Space", navigator, ref Space);

            _ThemeLoaded &= CHelper.TryGetEnumValueFromXML <EEqualizerStyle>(item + "/Style", navigator, ref _Theme.Style);

            _ThemeLoaded &= CHelper.TryGetEnumValueFromXML <EOffOn>(item + "/DrawNegative", navigator, ref _Theme.DrawNegative);

            if (CHelper.GetValueFromXML(item + "/Color", navigator, ref _Theme.ColorName, String.Empty))
            {
                _ThemeLoaded &= CTheme.GetColor(_Theme.ColorName, SkinIndex, ref Color);
            }
            else
            {
                _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/R", navigator, ref Color.R);
                _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/G", navigator, ref Color.G);
                _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/B", navigator, ref Color.B);
                _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/A", navigator, ref Color.A);
            }

            if (CHelper.GetValueFromXML(item + "/MaxColor", navigator, ref _Theme.MaxColorName, String.Empty))
            {
                _ThemeLoaded &= CTheme.GetColor(_Theme.ColorName, SkinIndex, ref Color);
            }
            else
            {
                _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/MaxR", navigator, ref MaxColor.R);
                _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/MaxG", navigator, ref MaxColor.G);
                _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/MaxB", navigator, ref MaxColor.B);
                _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/MaxA", navigator, ref MaxColor.A);
            }

            //Reflection
            if (CHelper.ItemExistsInXML(item + "/Reflection", navigator))
            {
                Reflection    = true;
                _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/Reflection/Space", navigator, ref ReflectionSpace);
                _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/Reflection/Height", navigator, ref ReflectionHeight);
            }
            else
            {
                Reflection = false;
            }

            if (_ThemeLoaded)
            {
                _Theme.Name = ElementName;
                _Bars       = new float[_Theme.NumBars];
                for (int i = 0; i < _Bars.Length; i++)
                {
                    _Bars[i] = 0f;
                }
                LoadTextures();
            }
            return(_ThemeLoaded);
        }