public override bool parseXml(XElement xml, TLayer parentLayer) { if (xml == null || xml.Name != "TextActor") return false; if (!base.parseXml(xml, parentLayer)) return false; try { text = xml.Element("Text").Value; FontFamily family = Program.findFontFamily(xml.Element("FontFamilyName").Value); float fontSize = TUtil.parseFloatXElement(xml.Element("FontSize"), 12); FontStyle fontStyle = (FontStyle)TUtil.parseIntXElement(xml.Element("FontStyle"), 0); if (family != null) font = new Font(family, fontSize, fontStyle, GraphicsUnit.Point); else font = new Font("Arial", fontSize, fontStyle, GraphicsUnit.Point); color = Color.FromArgb(int.Parse(xml.Element("Color").Value)); BoxSize.Width = float.Parse(xml.Element("SizeWidth").Value); BoxSize.Height = float.Parse(xml.Element("SizeHeight").Value); refreshMatrix(); return true; } catch (Exception e) { Console.WriteLine(e.Message); return false; } }
public virtual bool parseXml(XElement xml, TLayer parentLayer) { if (xml == null) { return(false); } try { name = xml.Element("Name").Value; parent = parentLayer; locked = TUtil.parseBoolXElement(xml.Element("Locked"), false); backgroundColor = Color.FromArgb(TUtil.parseIntXElement(xml.Element("BackgroundColor"), 0)); alpha = float.Parse(xml.Element("Alpha").Value); XElement xmlEvents = xml.Element("Events"); IEnumerable <XElement> xmlEventList = xmlEvents.Elements("Event"); foreach (XElement xmlEvent in xmlEventList) { events.Add(xmlEvent.Value); } XElement xmlStates = xml.Element("States"); IEnumerable <XElement> xmlStateList = xmlStates.Elements("State"); foreach (XElement xmlState in xmlStateList) { states.Add(xmlState.Value); } XElement xmlAnimations = xml.Element("Animations"); IEnumerable <XElement> xmlAnimationList = xmlAnimations.Elements("Animation"); foreach (XElement xmlAnimation in xmlAnimationList) { TAnimation animation = new TAnimation(this); if (!animation.parseXml(xmlAnimation)) { return(false); } animations.Add(animation); } XElement xmlChilds = xml.Element("Childs"); IEnumerable <XElement> xmlChildList = xmlChilds.Elements(); foreach (XElement xmlChild in xmlChildList) { TLayer layer = (TLayer)Activator.CreateInstance(Type.GetType(GetType().Namespace + ".T" + xmlChild.Name.ToString()), new Object[] { document }); if (!layer.parseXml(xmlChild, this)) { return(false); } childs.Add(layer); } return(true); } catch (Exception e) { Console.WriteLine(e.Message); return(false); } }
public override bool parseXml(XElement xml) { if (xml == null || xml.Name != "ActionInstantChangeBGM") { return(false); } if (!base.parseXml(xml)) { return(false); } try { sound = xml.Element("Sound").Value; volume = TUtil.parseIntXElement(xml.Element("Volume"), 100); return(true); } catch (Exception e) { Console.WriteLine(e.Message); return(false); } }
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"))); }
public override bool parseXml(XElement xml, TLayer parentLayer) { if (xml == null || xml.Name != "Scene") { return(false); } if (!base.parseXml(xml, null)) { return(false); } try { touchIndication = bool.Parse(xml.Element("TouchIndication").Value); prevButtonVisible = bool.Parse(xml.Element("PrevButtonVisible").Value); nextButtonVisible = bool.Parse(xml.Element("NextButtonVisible").Value); backgroundMusic = xml.Element("BackgroundMusic").Value; backgroundMusicVolume = TUtil.parseIntXElement(xml.Element("BackgroundMusicVolume"), 100); return(true); } catch (Exception e) { Console.WriteLine(e.Message); return(false); } }