private void StopElement(string name) { Type clazz = (Type)CollectionUtils.Get(change, name.ToLower()); if (clazz != null && clazz.Equals(this.curClass)) { this.currentDefinitionObject.DefinitionObjectDidFinishParsing(); if (this.currentDefinitionObject.parentDefinitionObject != null) { this.currentDefinitionObject.parentDefinitionObject.ChildDefinitionObjectDidFinishParsing(this.currentDefinitionObject); } this.currentDefinitionObject = this.currentDefinitionObject.parentDefinitionObject; if (this.currentDefinitionObject != null) { this.curClass = this.currentDefinitionObject.GetType(); this.isCurrentElementDefined = true; } else { this.curClass = null; this.isCurrentElementDefined = false; } } else if (this.currentDefinitionObject != null) { this.currentDefinitionObject.UndefinedElementDidFinish(name); } }
public virtual void Load(string resName) { this._path = resName; this._classType = null; this._source = null; this.currentDefinitionObject = null; this.isCurrentElementDefined = false; XMLParser.Parse(resName, listener); }
public virtual void Load(InputStream res) { this._path = null; this._classType = null; this._source = null; this.currentDefinitionObject = null; this.isCurrentElementDefined = false; XMLParser.Parse(res, listener); }
private void StartElement(string name) { Type clazz = (Type)CollectionUtils.Get(change, name.ToLower()); if (clazz != null) { DefinitionObject childObject = null; try { childObject = (DefinitionObject)JavaRuntime.NewInstance(clazz); if (_source != null) { childObject.fileName = _source; } } catch (Exception e) { Loon.Utils.Debug.Log.Exception(e); } if (this.isCurrentElementDefined) { childObject.InitWithParentObject(this.currentDefinitionObject); } childObject.DefinitionObjectDidInit(); if (childObject.parentDefinitionObject != null) { childObject.parentDefinitionObject.ChildDefinitionObjectDidInit(childObject); } this.curClass = clazz; this.currentDefinitionObject = childObject; this.isCurrentElementDefined = true; } else { this.isCurrentElementDefined = false; if (this.currentDefinitionObject != null) { this.currentDefinitionObject.UndefinedElementDidStart(name); } } }
public virtual void ChildDefinitionObjectDidFinishParsing(DefinitionObject childObject) { }
private void StartElement(string name) { Type clazz = (Type)CollectionUtils.Get(change,name.ToLower()); if (clazz != null) { DefinitionObject childObject = null; try { childObject = (DefinitionObject)JavaRuntime.NewInstance(clazz); if (_source != null) { childObject.fileName = _source; } } catch (Exception e) { Loon.Utils.Debugging.Log.Exception(e); } if (this.isCurrentElementDefined) { childObject.InitWithParentObject(this.currentDefinitionObject); } childObject.DefinitionObjectDidInit(); if (childObject.parentDefinitionObject != null) { childObject.parentDefinitionObject.ChildDefinitionObjectDidInit(childObject); } this.curClass = clazz; this.currentDefinitionObject = childObject; this.isCurrentElementDefined = true; } else { this.isCurrentElementDefined = false; if (this.currentDefinitionObject != null) { this.currentDefinitionObject.UndefinedElementDidStart(name); } } }
public virtual void ChildDefinitionObject(DefinitionObject childObject, string str) { }
public DefinitionObject InitWithParentObject(DefinitionObject parentObject) { this.parentDefinitionObject = parentObject; return(this); }
public virtual void ChildDefinitionObjectDidInit(DefinitionObject childObject) { }
public override void DefinitionObjectDidReceiveString(string v) { base.DefinitionObjectDidReceiveString(v); List <string> result = GetResult(v); foreach (string list in result) { if (list.Length > 2) { string[] values = StringUtils.Split(list, "="); string name = values[0]; string value = values[1]; if ("imageid".Equals(name, System.StringComparison.InvariantCultureIgnoreCase)) { this.uniqueID = value; } else if ("pos".Equals(name, System.StringComparison.InvariantCultureIgnoreCase)) { this.pos = DefinitionObject.StrToVector2(value); } else if ("orig".Equals(name, System.StringComparison.InvariantCultureIgnoreCase)) { this.orig = DefinitionObject.StrToVector2(value); } else if ("size".Equals(name, System.StringComparison.InvariantCultureIgnoreCase)) { this.size = DefinitionObject.StrToVector2(value); } else if ("anchor".Equals(name, System.StringComparison.InvariantCultureIgnoreCase)) { this.anchor = DefinitionObject.StrToVector2(value); } else if ("place".Equals(name, System.StringComparison.InvariantCultureIgnoreCase)) { this.place = DefinitionObject.StrToVector2(value); } else if ("file".Equals(name, System.StringComparison.InvariantCultureIgnoreCase)) { this.fileName = value; } else if ("name".Equals(name, System.StringComparison.InvariantCultureIgnoreCase)) { this.uniqueID = value; } else if ("id".Equals(name, System.StringComparison.InvariantCultureIgnoreCase)) { this.uniqueID = value; } else if ("mask".Equals(name, System.StringComparison.InvariantCultureIgnoreCase)) { string[] colors = StringUtils.Split(value, ","); if (colors.Length == 3) { this.maskColor = new LColor(Convert.ToInt32(colors[0]), Convert.ToInt32(colors[1]), Convert.ToInt32(colors[2])); } else if (colors.Length == 4) { this.maskColor = new LColor(Convert.ToInt32(colors[0]), Convert.ToInt32(colors[1]), Convert.ToInt32(colors[2]), Convert.ToInt32(colors[4])); } } else if ("blend".Equals(name, System.StringComparison.InvariantCultureIgnoreCase)) { if ("non".Equals(value, System.StringComparison.InvariantCultureIgnoreCase) || "NonPremultiplied".Equals(value, System.StringComparison.InvariantCultureIgnoreCase)) { blend = BlendState.NonPremultiplied; } else if ("add".Equals(value, System.StringComparison.InvariantCultureIgnoreCase) || "Additive".Equals(value, System.StringComparison.InvariantCultureIgnoreCase)) { blend = BlendState.Additive; } else if ("alpha".Equals(value, System.StringComparison.InvariantCultureIgnoreCase) || "AlphaBlend".Equals(value, System.StringComparison.InvariantCultureIgnoreCase)) { blend = BlendState.AlphaBlend; } else if ("op".Equals(value, System.StringComparison.InvariantCultureIgnoreCase) || "Opaque".Equals(value, System.StringComparison.InvariantCultureIgnoreCase)) { blend = BlendState.Opaque; } } } } if (size == null && orig != null) { size = orig; } else if (orig == null && size != null) { orig = size; } if (anchor == null && size != null) { anchor = new Vector2f(size.x / 2, size.y / 2); } if (place == null) { place = new Vector2f(); } result.Clear(); }
public DefinitionObject InitWithParentObject(DefinitionObject parentObject) { this.parentDefinitionObject = parentObject; return this; }