public void Setup(XML xml) { this.name = xml.GetAttribute("name"); _options = xml.GetAttributeInt("options"); XMLList col = xml.Elements("item"); foreach (XML cxml in col) { TransitionItem item = new TransitionItem(); _items.Add(item); item.time = (float)cxml.GetAttributeInt("time") / (float)FRAME_RATE; item.targetId = cxml.GetAttribute("target", string.Empty); item.type = FieldTypes.ParseTransitionActionType(cxml.GetAttribute("type")); item.tween = cxml.GetAttributeBool("tween"); item.label = cxml.GetAttribute("label"); if (item.tween) { item.duration = (float)cxml.GetAttributeInt("duration") / FRAME_RATE; string ease = cxml.GetAttribute("ease"); if (ease != null) { item.easeType = FieldTypes.ParseEaseType(ease); } item.repeat = cxml.GetAttributeInt("repeat"); item.yoyo = cxml.GetAttributeBool("yoyo"); item.label2 = cxml.GetAttribute("label2"); string v = cxml.GetAttribute("endValue"); if (v != null) { DecodeValue(item.type, cxml.GetAttribute("startValue", string.Empty), item.startValue); DecodeValue(item.type, v, item.endValue); } else { item.tween = false; DecodeValue(item.type, cxml.GetAttribute("startValue", string.Empty), item.value); } } else { DecodeValue(item.type, cxml.GetAttribute("value", string.Empty), item.value); } } }
public void Setup(XML xml) { this.name = xml.GetAttribute("name"); _options = xml.GetAttributeInt("options"); this.autoPlay = xml.GetAttributeBool("autoPlay"); if (this.autoPlay) { this.autoPlayRepeat = xml.GetAttributeInt("autoPlayRepeat", 1); this.autoPlayDelay = xml.GetAttributeFloat("autoPlayDelay"); } XMLList.Enumerator et = xml.GetEnumerator("item"); while (et.MoveNext()) { XML cxml = et.Current; TransitionItem item = new TransitionItem(); _items.Add(item); item.time = (float)cxml.GetAttributeInt("time") / (float)FRAME_RATE; item.targetId = cxml.GetAttribute("target", string.Empty); item.type = FieldTypes.ParseTransitionActionType(cxml.GetAttribute("type")); item.tween = cxml.GetAttributeBool("tween"); item.label = cxml.GetAttribute("label"); if (item.tween) { item.duration = (float)cxml.GetAttributeInt("duration") / FRAME_RATE; if (item.time + item.duration > _maxTime) { _maxTime = item.time + item.duration; } string ease = cxml.GetAttribute("ease"); if (ease != null) { item.easeType = FieldTypes.ParseEaseType(ease); } item.repeat = cxml.GetAttributeInt("repeat"); item.yoyo = cxml.GetAttributeBool("yoyo"); item.label2 = cxml.GetAttribute("label2"); string v = cxml.GetAttribute("endValue"); if (v != null) { DecodeValue(item.type, cxml.GetAttribute("startValue", string.Empty), item.startValue); DecodeValue(item.type, v, item.endValue); } else { item.tween = false; DecodeValue(item.type, cxml.GetAttribute("startValue", string.Empty), item.value); } } else { if (item.time > _maxTime) { _maxTime = item.time; } DecodeValue(item.type, cxml.GetAttribute("value", string.Empty), item.value); } } }