public override bool parseXml(XElement xml)
        {
            if (xml == null || xml.Name != "ActionIntervalAnimate")
            {
                return(false);
            }

            if (!base.parseXml(xml))
            {
                return(false);
            }

            try {
                XElement xmlFrames = xml.Element("Frames");
                IEnumerable <XElement> xmlFrameList = xmlFrames.Elements();
                foreach (XElement xmlFrame in xmlFrameList)
                {
                    string image    = TUtil.parseStringXElement(xmlFrame.Element("Image"), "");
                    long   duration = TUtil.parseLongXElement(xmlFrame.Element("Duration"), -1);
                    if (string.IsNullOrEmpty(image) || duration == -1)
                    {
                        return(false);
                    }

                    frames.Add(new TAnimateFrame {
                        image = image, duration = duration
                    });
                }
                return(true);
            } catch (Exception e) {
                Console.WriteLine(e.Message);
                return(false);
            }
        }
Пример #2
0
        public bool parseXml(XElement xml)
        {
            if (xml == null || xml.Name != "Document")
            {
                return(false);
            }

            identifier                  = TUtil.parseStringXElement(xml.Element("Identifier"), "");
            backgroundMusic             = xml.Element("BackgroundMusic").Value;
            backgroundMusicVolume       = TUtil.parseIntXElement(xml.Element("BackgroundMusicVolume"), 100);
            navigationButtonDelayTime   = TUtil.parseIntXElement(xml.Element("NavigationButtonDelayTime"), 5);
            navigationLeftButtonRender  = TUtil.parseBoolXElement(xml.Element("NavigationLeftButtonRender"), true);
            navigationRightButtonRender = TUtil.parseBoolXElement(xml.Element("NavigationRightButtonRender"), true);
            prevSceneButton             = xml.Element("PrevSceneButton").Value;
            nextSceneButton             = xml.Element("NextSceneButton").Value;
            avatarDefault               = xml.Element("AvatarDefault").Value;
            avatarFrame                 = xml.Element("AvatarFrame").Value;
            avatarMask                  = xml.Element("AvatarMask").Value;

            return
                (libraryManager.parseXml(xml.Element("Libraries")) &&
                 sceneManager.parseXml(xml.Element("Scenes")));
        }