/// <summary> /// The function is used to read the script xml /// </summary> /// <param name="objects"></param> public void convert(ObjectSpace objects) { IEnumerator<xmlObject> iter = objects.getIter(); String temp; ScriptData script; while (iter.MoveNext()) { script = new ScriptData(); temp = iter.Current.findValueOfProperty("alias"); if (temp != null) { script.Alias = temp; } temp = iter.Current.findValueOfProperty("file"); if (temp != null) { script.File = temp; } //Check if there is a file name and alias if ((script.Alias != "") && (script.File != "")) { Log.getInstance().log("@Folder:Scripts, Class:ScriptKeeper, Log Type: Error, Line No: 121, " + "Scriptkeeper : Empty script file missing alias or file "); } //Load the script addScript(script); } }
/// <summary> /// The functions converts the xml data /// </summary> /// <param name="objects"></param> public void getMapObjects(ObjectSpace objects) { IEnumerator<xmlObject> iter = objects.getIter(); String temp; while (iter.MoveNext()) { MapObject obj = new MapObject(); temp = iter.Current.findValueOfProperty("x"); if (temp != null) { obj.X = (float) Convert.ToDouble(temp); } temp = iter.Current.findValueOfProperty("y"); if (temp != null) { obj.Y = (float)Convert.ToDouble(temp); } temp = iter.Current.findValueOfProperty("visible"); if (temp != null) { obj.Visible=Convert.ToBoolean(temp); } temp = iter.Current.findValueOfProperty("collision"); if (temp != null) { obj.Collision = Convert.ToBoolean(temp); } temp = iter.Current.findValueOfProperty("image"); if (temp != null) { obj.ImageAlias = temp; } temp = iter.Current.findValueOfProperty("alias"); if (temp != null) { obj.Alias = temp; } information.Add(obj); } }
public void convert(ObjectSpace objects) { IEnumerator<xmlObject> iter = objects.getIter(); String temp; while (iter.MoveNext()) { temp = iter.Current.findValueOfProperty("name"); if (temp != null) { assets.Add(temp); } } }
/// <summary> /// The function converts the data about the worlds from an xml file /// </summary> /// <param name="objects"></param> public void convert(ObjectSpace objects) { IEnumerator<xmlObject> iter = objects.getIter(); String temp; while (iter.MoveNext()) { World world = new World(); temp = iter.Current.findValueOfProperty("name"); if (temp != null) { world.Name = temp; } temp = iter.Current.findValueOfProperty("map"); if (temp != null) { world.MapFile = temp; } temp = iter.Current.findValueOfProperty("events"); if (temp != null) { world.EventMapFile = temp; } temp = iter.Current.findValueOfProperty("assets"); if (temp != null) { world.AssetFile = temp; } temp = iter.Current.findValueOfProperty("world_script"); if (temp != null) { world.ScriptFile = temp; } information.Add(world.Name,world); } }
//The function allows the style object to be loaded from a file public void convert(ObjectSpace objects) { IEnumerator<xmlObject> iter = objects.getIter(); String temp; while (iter.MoveNext()) { temp = iter.Current.findValueOfProperty("BUTTON_DOWN"); if (temp != null) { skins.Add("BUTTON_DOWN",temp); } temp = iter.Current.findValueOfProperty("BUTTON_UP"); if (temp != null) { skins.Add("BUTTON_UP", temp); } } }
public void convert(ObjectSpace objects) { IEnumerator<xmlObject> iter = objects.getIter(); String temp; float x, y; while (iter.MoveNext()) { EventObject obj = new EventObject(); x = -1; y = -1; temp = iter.Current.findValueOfProperty("name"); if (temp != null) { obj.Name = temp; } temp = iter.Current.findValueOfProperty("script_file"); if (temp != null) { obj.ScriptFile = temp; } temp = iter.Current.findValueOfProperty("x"); if (temp != null) { x = (float)Convert.ToDouble(temp); } temp = iter.Current.findValueOfProperty("y"); if (temp != null) { y = (float)Convert.ToDouble(temp); } if ((x > -1) && (y > -1)) { obj.Pos = new Vector2(x, y); } temp = iter.Current.findValueOfProperty("width"); if (temp != null) { obj.Width = Convert.ToInt32(temp); } temp = iter.Current.findValueOfProperty("height"); if (temp != null) { obj.Height = Convert.ToInt32(temp); } temp = iter.Current.findValueOfProperty("trigger"); if (temp != null) { obj.Triggered = (Trigger)Convert.ToInt32(temp); } events.Add(obj.Name, obj); } }