public OBJECT() { this.mType = -1; this.mID = -1; this.mPosition = new VECTOR2D(0, 0); this.mBound = new RECTANGLE(0, 0, 0, 0); this.mImage = null; }
public OBJECT() { this.mType = -1; this.mID = -1; this.mPosition = new VECTOR2D(0, 0); this.mBound = new RECTANGLE(0, 0, 0, 0); this.mImage = null; }
public void writeElement(OBJECT _object) { mWriter.WriteStartElement("Object"); VECTOR2D temp = new VECTOR2D(); temp = Support.ConvertCoordination(_object); mWriter.WriteAttributeString("Type", Convert.ToString(_object.Type)); mWriter.WriteAttributeString("Id", Convert.ToString(_object.ID)); mWriter.WriteAttributeString("X", Convert.ToString(temp.cX)); mWriter.WriteAttributeString("Y", Convert.ToString(temp.cY)); if (_object.Type == 1) { mWriter.WriteAttributeString("Width", Convert.ToString(_object.Bound.width)); mWriter.WriteAttributeString("Height", Convert.ToString(_object.Bound.height)); } mWriter.Flush(); mWriter.WriteEndElement(); }
public void writeElement(OBJECT _object) { mWriter.WriteStartElement("Object"); VECTOR2D temp = new VECTOR2D(); temp = Support.ConvertCoordination(_object); if (_object.ID == 26 && temp.cY == 32 && temp.cX == 32) { MessageBox.Show("DAY"); } mWriter.WriteAttributeString("Type", Convert.ToString(_object.Type)); mWriter.WriteAttributeString("Id", Convert.ToString(_object.ID)); mWriter.WriteAttributeString("X", Convert.ToString(temp.cX)); mWriter.WriteAttributeString("Y", Convert.ToString(temp.cY)); if (_object.Type == 1) { mWriter.WriteAttributeString("Width", Convert.ToString(_object.Bound.width)); mWriter.WriteAttributeString("Height", Convert.ToString(_object.Bound.height)); } mWriter.Flush(); mWriter.WriteEndElement(); }
public OBJECT(int _type, int _id, int _index, VECTOR2D _position, RECTANGLE _bound) { this.mType = _type; this.mID = _id; this.mIndex = _index; this.mPosition = _position; this.mBound = _bound; if ((ObjectType)_type == ObjectType.TILE_MAP) { this.mImage = new Image(); // Set atribute for image object if (Support.map != null) { BitmapSource bmpSource; JpegBitmapEncoder bmpCreate = new JpegBitmapEncoder(); byte[] arrPixel = new byte[((Support.WIDTH_OF_TILE * Support.map.BitMap.Format.BitsPerPixel) / 8) * Support.HEIGHT_OF_TILE]; Support.map.TileMap[this.mID].ExportBitMap(0, 0, arrPixel, (Support.WIDTH_OF_TILE * Support.map.BitMap.Format.BitsPerPixel / 8)); bmpSource = BitmapSource.Create(Support.WIDTH_OF_TILE, Support.HEIGHT_OF_TILE, 96, 96, Support.map.BitMap.Format, null, arrPixel, ((Support.WIDTH_OF_TILE * Support.map.BitMap.Format.BitsPerPixel) / 8)); this.mImage.Source = bmpSource; this.mImage.Width = bmpSource.Width; this.mImage.Height = bmpSource.Height; this.mImage.Tag = this.mType; } } if (Support.IsDynamic((ObjectID)this.mID) && (ObjectType)(this.mType) == (ObjectType.NORMAL_OBJECT)) { this.mRangeOfMovement = new RECTANGLE(this.mBound.cX, this.mBound.cY, this.mBound.width + 600, this.mBound.height + 600); } else { this.mRangeOfMovement = new RECTANGLE(this.mBound.cX - this.mBound.width / 2, this.mBound.cY + this.mBound.height / 2, this.mBound.width, this.mBound.height); } }
public OBJECT(int _type, int _id, int _index, VECTOR2D _position, RECTANGLE _bound) { this.mType = _type; this.mID = _id; this.mIndex = _index; this.mPosition = _position; this.mBound = _bound; if ((ObjectType)_type == ObjectType.TILE_MAP) { this.mImage = new Image(); // Set atribute for image object if (Support.map != null) { BitmapSource bmpSource; JpegBitmapEncoder bmpCreate = new JpegBitmapEncoder(); byte[] arrPixel = new byte[((Support.WIDTH_OF_TILE * Support.map.BitMap.Format.BitsPerPixel) / 8) * Support.HEIGHT_OF_TILE]; Support.map.TileMap[this.mID].ExportBitMap(0, 0, arrPixel, (Support.WIDTH_OF_TILE * Support.map.BitMap.Format.BitsPerPixel / 8)); bmpSource = BitmapSource.Create(Support.WIDTH_OF_TILE, Support.HEIGHT_OF_TILE, 96, 96, Support.map.BitMap.Format, null, arrPixel, ((Support.WIDTH_OF_TILE * Support.map.BitMap.Format.BitsPerPixel) / 8)); this.mImage.Source = bmpSource; this.mImage.Width = bmpSource.Width; this.mImage.Height = bmpSource.Height; this.mImage.Tag = this.mType; } } if (Support.IsDynamic((ObjectID)this.mID) && (ObjectType)(this.mType) == (ObjectType.NORMAL_OBJECT)) { this.mRangeOfMovement = new RECTANGLE(this.mBound.cX, this.mBound.cY, this.mBound.width + 600, this.mBound.height + 600); } else { this.mRangeOfMovement = new RECTANGLE(this.mBound.cX - this.mBound.width / 2, this.mBound.cY + this.mBound.height / 2, this.mBound.width, this.mBound.height); } }
public void loadCanvas(String pathFileName, Canvas workSpace) { XmlDocument xmlDocument = new XmlDocument(); xmlDocument.Load(pathFileName); XmlNode rootNode; rootNode = xmlDocument.DocumentElement; Support.WIDHT_MAP = int.Parse(rootNode.Attributes["Width"].Value); Support.HEIGHT_MAP = int.Parse(rootNode.Attributes["Height"].Value); Support.MAPNAME = rootNode.Attributes["Name"].Value; XmlNodeList nodeList; nodeList = xmlDocument.GetElementsByTagName("Object"); foreach (XmlNode item in nodeList) { if (this.isExisted(Convert.ToInt32(item.Attributes["Index"].Value)) == false) { VECTOR2D tempPosition = new VECTOR2D(float.Parse(item.Attributes["X"].Value), float.Parse(item.Attributes["Y"].Value)); int width = Convert.ToInt32(item.Attributes["Width"].Value); int height = Convert.ToInt32(item.Attributes["Height"].Value); tempPosition = Support.ConvertCoordinationOfCanvas(tempPosition, width, height); if (Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.VIRTUAL_OBJECT) { if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.TILE_BASE) { Rectangle shape = new Rectangle(); shape.Tag = (int)ObjectID.TILE_BASE; shape.Width = width; shape.Height = height; shape.Stroke = new SolidColorBrush(Colors.Red); shape.StrokeThickness = 3; Canvas.SetLeft(shape, tempPosition.cX); Canvas.SetTop(shape, tempPosition.cY); Canvas.SetZIndex(shape, 2); workSpace.Children.Add(shape); this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.VIRTUAL_OBJECT_WATER) { Rectangle shape = new Rectangle(); shape.Tag = (int)ObjectID.VIRTUAL_OBJECT_WATER; shape.Width = width; shape.Height = height; shape.Stroke = new SolidColorBrush(Colors.Blue); shape.StrokeThickness = 3; Canvas.SetLeft(shape, tempPosition.cX); Canvas.SetTop(shape, tempPosition.cY); Canvas.SetZIndex(shape, 2); workSpace.Children.Add(shape); this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.RAMBO && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { Image image = ListBoxCreater.getImageForListBox(new BitmapImage(new Uri(@"\Resource\object\Rambo.png", UriKind.Relative)), ObjectID.RAMBO, 52, 70); Canvas.SetLeft(image, tempPosition.cX); Canvas.SetTop(image, tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.SNIPER_STANDING && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { Image image = ListBoxCreater.getImageForListBox(new BitmapImage(new Uri(@"\Resource\object\Sniper.png", UriKind.Relative)), ObjectID.SNIPER_STANDING, 48, 64); Canvas.SetLeft(image, tempPosition.cX); Canvas.SetTop(image, tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.ENEMY_RUN && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { Image image = ListBoxCreater.getImageForListBox(new BitmapImage(new Uri(@"\Resource\object\Enemy_run.png", UriKind.Relative)), ObjectID.ENEMY_RUN, 36, 66); Canvas.SetLeft(image, tempPosition.cX); Canvas.SetTop(image, tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.WEAPON_CAPSULE && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { Image image = ListBoxCreater.getImageForListBox(new BitmapImage(new Uri(@"\Resource\object\Gif_bullet_moving.png", UriKind.Relative)), ObjectID.WEAPON_CAPSULE, 48, 30); Canvas.SetLeft(image, tempPosition.cX); Canvas.SetTop(image, tempPosition.cY); Canvas.SetZIndex(image, 3); workSpace.Children.Add(image); this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.WEAPON_SENSOR && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { Image image = ListBoxCreater.getImageForListBox(new BitmapImage(new Uri(@"\Resource\object\Gif_bullet_static.png", UriKind.Relative)), ObjectID.WEAPON_SENSOR, 64, 64); Canvas.SetLeft(image, tempPosition.cX); Canvas.SetTop(image, tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.SNIPER_HIDING && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { Image image = ListBoxCreater.getImageForListBox(new BitmapImage(new Uri(@"\Resource\object\Sniper_hiding_up.png", UriKind.Relative)), ObjectID.SNIPER_HIDING, 48, 34); Canvas.SetLeft(image, tempPosition.cX); Canvas.SetTop(image, tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.GUN_ROTATING && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { Image image = ListBoxCreater.getImageForListBox(new BitmapImage(new Uri(@"\Resource\object\Gun_rotation.png", UriKind.Relative)), ObjectID.GUN_ROTATING, 64, 64); Canvas.SetLeft(image, tempPosition.cX); Canvas.SetTop(image, tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.BIG_GUN_ROTATING && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { Image image = ListBoxCreater.getImageForListBox(new BitmapImage(new Uri(@"\Resource\object\Big_gun_rotation.png", UriKind.Relative)), ObjectID.BIG_GUN_ROTATING, 64, 64); Canvas.SetLeft(image, tempPosition.cX); Canvas.SetTop(image, tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.BRIDGE && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { Image image = ListBoxCreater.getImageForListBox(new BitmapImage(new Uri(@"\Resource\object\Bridge.png", UriKind.Relative)), ObjectID.BRIDGE, 256, 62); Canvas.SetLeft(image, tempPosition.cX); Canvas.SetTop(image, tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.BIG_BOSS_1 && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { Image image = ListBoxCreater.getImageForListBox(new BitmapImage(new Uri(@"\Resource\object\boss_1.png", UriKind.Relative)), ObjectID.BIG_BOSS_1, 226, 368); Canvas.SetLeft(image, tempPosition.cX); Canvas.SetTop(image, tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.BOOM && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { Image image = ListBoxCreater.getImageForListBox(new BitmapImage(new Uri(@"\Resource\object\Boom.png", UriKind.Relative)), ObjectID.BOOM, 8, 28); Canvas.SetLeft(image, tempPosition.cX); Canvas.SetTop(image, tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.STONE && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { Image image = ListBoxCreater.getImageForListBox(new BitmapImage(new Uri(@"\Resource\object\Rock_falling.png", UriKind.Relative)), ObjectID.STONE, 27, 27); Canvas.SetLeft(image, tempPosition.cX); Canvas.SetTop(image, tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.MAGIC_ROCK && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { Image image = ListBoxCreater.getImageForListBox(new BitmapImage(new Uri(@"\Resource\object\Rock_flying.png", UriKind.Relative)), ObjectID.MAGIC_ROCK, 32, 31); Canvas.SetLeft(image, tempPosition.cX); Canvas.SetTop(image, tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.SNIPPER_WATER_HIDING && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { Image image = ListBoxCreater.getImageForListBox(new BitmapImage(new Uri(@"\Resource\object\Snipper_water_hiding.png", UriKind.Relative)), ObjectID.SNIPPER_WATER_HIDING, 34, 62); Canvas.SetLeft(image, tempPosition.cX); Canvas.SetTop(image, tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.TANK && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { Image image = ListBoxCreater.getImageForListBox(new BitmapImage(new Uri(@"\Resource\object\Tank.png", UriKind.Relative)), ObjectID.TANK, 200, 128); Canvas.SetLeft(image, tempPosition.cX); Canvas.SetTop(image, tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.BIG_CAPSULE_BOSS && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { Image image = ListBoxCreater.getImageForListBox(new BitmapImage(new Uri(@"\Resource\object\Big_capsule_boss.png", UriKind.Relative)), ObjectID.BIG_CAPSULE_BOSS, 120, 128); Canvas.SetLeft(image, tempPosition.cX); Canvas.SetTop(image, tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.FIRE_BRIDGE && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { Image image = ListBoxCreater.getImageForListBox(new BitmapImage(new Uri(@"\Resource\object\Bridge_2.png", UriKind.Relative)), ObjectID.FIRE_BRIDGE, 256, 32); Canvas.SetLeft(image, tempPosition.cX); Canvas.SetTop(image, tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.ENEMY_RUN_SHOOTING && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { Image image = ListBoxCreater.getImageForListBox(new BitmapImage(new Uri(@"\Resource\object\Enemy_run_shooting.png", UriKind.Relative)), ObjectID.ENEMY_RUN_SHOOTING, 49, 64); Canvas.SetLeft(image, tempPosition.cX); Canvas.SetTop(image, tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.OBJECT_BARRIER && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { for (int i = 0; i < Support.ListItem.Count; ++i) { if ((int)Support.ListItem[i].Tag == (int)ObjectID.OBJECT_BARRIER) { Image image = new Image(); image.Source = Support.ListItem[i].Source; image.Tag = Support.ListItem[i].Tag; image.Width = Support.ListItem[i].Width; image.Height = Support.ListItem[i].Height; Canvas.SetLeft(image, (double)tempPosition.cX); Canvas.SetTop(image, (double)tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); } } this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.OBJECT_FLAME_GUN && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { for (int i = 0; i < Support.ListItem.Count; ++i) { if ((int)Support.ListItem[i].Tag == (int)ObjectID.OBJECT_FLAME_GUN) { Image image = new Image(); image.Source = Support.ListItem[i].Source; image.Tag = Support.ListItem[i].Tag; image.Width = Support.ListItem[i].Width; image.Height = Support.ListItem[i].Height; Canvas.SetLeft(image, (double)tempPosition.cX); Canvas.SetTop(image, (double)tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); } } this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.OBJECT_LASER_GUN && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { for (int i = 0; i < Support.ListItem.Count; ++i) { if ((int)Support.ListItem[i].Tag == (int)ObjectID.OBJECT_LASER_GUN) { Image image = new Image(); image.Source = Support.ListItem[i].Source; image.Tag = Support.ListItem[i].Tag; image.Width = Support.ListItem[i].Width; image.Height = Support.ListItem[i].Height; Canvas.SetLeft(image, (double)tempPosition.cX); Canvas.SetTop(image, (double)tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); } } this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.OBJECT_MACHINE_GUN && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { for (int i = 0; i < Support.ListItem.Count; ++i) { if ((int)Support.ListItem[i].Tag == (int)ObjectID.OBJECT_MACHINE_GUN) { Image image = new Image(); image.Source = Support.ListItem[i].Source; image.Tag = Support.ListItem[i].Tag; image.Width = Support.ListItem[i].Width; image.Height = Support.ListItem[i].Height; Canvas.SetLeft(image, (double)tempPosition.cX); Canvas.SetTop(image, (double)tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); } } this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.OBJECT_RAPID_GUN && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { for (int i = 0; i < Support.ListItem.Count; ++i) { if ((int)Support.ListItem[i].Tag == (int)ObjectID.OBJECT_RAPID_GUN) { Image image = new Image(); image.Source = Support.ListItem[i].Source; image.Tag = Support.ListItem[i].Tag; image.Width = Support.ListItem[i].Width; image.Height = Support.ListItem[i].Height; Canvas.SetLeft(image, (double)tempPosition.cX); Canvas.SetTop(image, (double)tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); } } this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.OBJECT_SPREAD_GUN && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { for (int i = 0; i < Support.ListItem.Count; ++i) { if ((int)Support.ListItem[i].Tag == (int)ObjectID.OBJECT_SPREAD_GUN) { Image image = new Image(); image.Source = Support.ListItem[i].Source; image.Tag = Support.ListItem[i].Tag; image.Width = Support.ListItem[i].Width; image.Height = Support.ListItem[i].Height; Canvas.SetLeft(image, (double)tempPosition.cX); Canvas.SetTop(image, (double)tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); } } this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } } } }
public void loadCanvas(String pathFileName, Canvas workSpace) { XmlDocument xmlDocument = new XmlDocument(); xmlDocument.Load(pathFileName); XmlNode rootNode; rootNode = xmlDocument.DocumentElement; Support.WIDHT_MAP = int.Parse(rootNode.Attributes["Width"].Value); Support.HEIGHT_MAP = int.Parse(rootNode.Attributes["Height"].Value); Support.MAPNAME = rootNode.Attributes["Name"].Value; XmlNodeList nodeList; nodeList = xmlDocument.GetElementsByTagName("Object"); foreach (XmlNode item in nodeList) { if (this.isExisted(Convert.ToInt32(item.Attributes["Index"].Value)) == false) { VECTOR2D tempPosition = new VECTOR2D(float.Parse(item.Attributes["X"].Value), float.Parse(item.Attributes["Y"].Value)); int width = Convert.ToInt32(item.Attributes["Width"].Value); int height = Convert.ToInt32(item.Attributes["Height"].Value); tempPosition = Support.ConvertCoordinationOfCanvas(tempPosition, width, height); if (Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.VIRTUAL_OBJECT) { if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.TILE_BASE) { Rectangle shape = new Rectangle(); shape.Tag = (int)ObjectID.TILE_BASE; shape.Width = width; shape.Height = height; shape.Stroke = new SolidColorBrush(Colors.Red); shape.StrokeThickness = 3; Canvas.SetLeft(shape, tempPosition.cX); Canvas.SetTop(shape, tempPosition.cY); Canvas.SetZIndex(shape, 2); workSpace.Children.Add(shape); this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.VIRTUAL_OBJECT_WATER) { Rectangle shape = new Rectangle(); shape.Tag = (int)ObjectID.VIRTUAL_OBJECT_WATER; shape.Width = width; shape.Height = height; shape.Stroke = new SolidColorBrush(Colors.Blue); shape.StrokeThickness = 3; Canvas.SetLeft(shape, tempPosition.cX); Canvas.SetTop(shape, tempPosition.cY); Canvas.SetZIndex(shape, 2); workSpace.Children.Add(shape); this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.RAMBO && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { Image image = ListBoxCreater.getImageForListBox(new BitmapImage(new Uri(@"\Resource\object\Rambo.png", UriKind.Relative)), ObjectID.RAMBO, 52, 70); Canvas.SetLeft(image, tempPosition.cX); Canvas.SetTop(image, tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.SNIPER_STANDING && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { Image image = ListBoxCreater.getImageForListBox(new BitmapImage(new Uri(@"\Resource\object\Sniper.png", UriKind.Relative)), ObjectID.SNIPER_STANDING, 48, 64); Canvas.SetLeft(image, tempPosition.cX); Canvas.SetTop(image, tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.ENEMY_RUN && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { Image image = ListBoxCreater.getImageForListBox(new BitmapImage(new Uri(@"\Resource\object\Enemy_run.png", UriKind.Relative)), ObjectID.ENEMY_RUN, 36, 66); Canvas.SetLeft(image, tempPosition.cX); Canvas.SetTop(image, tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.WEAPON_CAPSULE && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { Image image = ListBoxCreater.getImageForListBox(new BitmapImage(new Uri(@"\Resource\object\Gif_bullet_moving.png", UriKind.Relative)), ObjectID.WEAPON_CAPSULE, 48, 30); Canvas.SetLeft(image, tempPosition.cX); Canvas.SetTop(image, tempPosition.cY); Canvas.SetZIndex(image, 3); workSpace.Children.Add(image); this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.WEAPON_SENSOR && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { Image image = ListBoxCreater.getImageForListBox(new BitmapImage(new Uri(@"\Resource\object\Gif_bullet_static.png", UriKind.Relative)), ObjectID.WEAPON_SENSOR, 64, 64); Canvas.SetLeft(image, tempPosition.cX); Canvas.SetTop(image, tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.SNIPER_HIDING && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { Image image = ListBoxCreater.getImageForListBox(new BitmapImage(new Uri(@"\Resource\object\Sniper_hiding_up.png", UriKind.Relative)), ObjectID.SNIPER_HIDING, 48, 34); Canvas.SetLeft(image, tempPosition.cX); Canvas.SetTop(image, tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.GUN_ROTATING && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { Image image = ListBoxCreater.getImageForListBox(new BitmapImage(new Uri(@"\Resource\object\Gun_rotation.png", UriKind.Relative)), ObjectID.GUN_ROTATING, 64, 64); Canvas.SetLeft(image, tempPosition.cX); Canvas.SetTop(image, tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.BIG_GUN_ROTATING && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { Image image = ListBoxCreater.getImageForListBox(new BitmapImage(new Uri(@"\Resource\object\Big_gun_rotation.png", UriKind.Relative)), ObjectID.BIG_GUN_ROTATING, 64, 64); Canvas.SetLeft(image, tempPosition.cX); Canvas.SetTop(image, tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.BRIDGE && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { Image image = ListBoxCreater.getImageForListBox(new BitmapImage(new Uri(@"\Resource\object\Bridge.png", UriKind.Relative)), ObjectID.BRIDGE, 256, 62); Canvas.SetLeft(image, tempPosition.cX); Canvas.SetTop(image, tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.BIG_BOSS_1 && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { Image image = ListBoxCreater.getImageForListBox(new BitmapImage(new Uri(@"\Resource\object\boss_1.png", UriKind.Relative)), ObjectID.BIG_BOSS_1, 226, 368); Canvas.SetLeft(image, tempPosition.cX); Canvas.SetTop(image, tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.BOOM && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { Image image = ListBoxCreater.getImageForListBox(new BitmapImage(new Uri(@"\Resource\object\Boom.png", UriKind.Relative)), ObjectID.BOOM, 8, 28); Canvas.SetLeft(image, tempPosition.cX); Canvas.SetTop(image, tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.STONE && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { Image image = ListBoxCreater.getImageForListBox(new BitmapImage(new Uri(@"\Resource\object\Rock_falling.png", UriKind.Relative)), ObjectID.STONE, 27, 27); Canvas.SetLeft(image, tempPosition.cX); Canvas.SetTop(image, tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.MAGIC_ROCK && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { Image image = ListBoxCreater.getImageForListBox(new BitmapImage(new Uri(@"\Resource\object\Rock_flying.png", UriKind.Relative)), ObjectID.MAGIC_ROCK, 32, 31); Canvas.SetLeft(image, tempPosition.cX); Canvas.SetTop(image, tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.SNIPPER_WATER_HIDING && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { Image image = ListBoxCreater.getImageForListBox(new BitmapImage(new Uri(@"\Resource\object\Snipper_water_hiding.png", UriKind.Relative)), ObjectID.SNIPPER_WATER_HIDING, 34, 62); Canvas.SetLeft(image, tempPosition.cX); Canvas.SetTop(image, tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.TANK && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { Image image = ListBoxCreater.getImageForListBox(new BitmapImage(new Uri(@"\Resource\object\Tank.png", UriKind.Relative)), ObjectID.TANK, 200, 128); Canvas.SetLeft(image, tempPosition.cX); Canvas.SetTop(image, tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.BIG_CAPSULE_BOSS && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { Image image = ListBoxCreater.getImageForListBox(new BitmapImage(new Uri(@"\Resource\object\Big_capsule_boss.png", UriKind.Relative)), ObjectID.BIG_CAPSULE_BOSS, 120, 128); Canvas.SetLeft(image, tempPosition.cX); Canvas.SetTop(image, tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.FIRE_BRIDGE && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { Image image = ListBoxCreater.getImageForListBox(new BitmapImage(new Uri(@"\Resource\object\Bridge_2.png", UriKind.Relative)), ObjectID.FIRE_BRIDGE, 256, 32); Canvas.SetLeft(image, tempPosition.cX); Canvas.SetTop(image, tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.ENEMY_RUN_SHOOTING && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { Image image = ListBoxCreater.getImageForListBox(new BitmapImage(new Uri(@"\Resource\object\Enemy_run_shooting.png", UriKind.Relative)), ObjectID.ENEMY_RUN_SHOOTING, 49, 64); Canvas.SetLeft(image, tempPosition.cX); Canvas.SetTop(image, tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.OBJECT_BARRIER && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { for (int i = 0; i < Support.ListItem.Count; ++i) { if ((int)Support.ListItem[i].Tag == (int)ObjectID.OBJECT_BARRIER) { Image image = new Image(); image.Source = Support.ListItem[i].Source; image.Tag = Support.ListItem[i].Tag; image.Width = Support.ListItem[i].Width; image.Height = Support.ListItem[i].Height; Canvas.SetLeft(image, (double)tempPosition.cX); Canvas.SetTop(image, (double)tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); } } this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.OBJECT_FLAME_GUN && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { for (int i = 0; i < Support.ListItem.Count; ++i) { if ((int)Support.ListItem[i].Tag == (int)ObjectID.OBJECT_FLAME_GUN) { Image image = new Image(); image.Source = Support.ListItem[i].Source; image.Tag = Support.ListItem[i].Tag; image.Width = Support.ListItem[i].Width; image.Height = Support.ListItem[i].Height; Canvas.SetLeft(image, (double)tempPosition.cX); Canvas.SetTop(image, (double)tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); } } this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.OBJECT_LASER_GUN && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { for (int i = 0; i < Support.ListItem.Count; ++i) { if ((int)Support.ListItem[i].Tag == (int)ObjectID.OBJECT_LASER_GUN) { Image image = new Image(); image.Source = Support.ListItem[i].Source; image.Tag = Support.ListItem[i].Tag; image.Width = Support.ListItem[i].Width; image.Height = Support.ListItem[i].Height; Canvas.SetLeft(image, (double)tempPosition.cX); Canvas.SetTop(image, (double)tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); } } this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if(Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.OBJECT_MACHINE_GUN && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { for (int i = 0; i < Support.ListItem.Count; ++i) { if ((int)Support.ListItem[i].Tag == (int)ObjectID.OBJECT_MACHINE_GUN) { Image image = new Image(); image.Source = Support.ListItem[i].Source; image.Tag = Support.ListItem[i].Tag; image.Width = Support.ListItem[i].Width; image.Height = Support.ListItem[i].Height; Canvas.SetLeft(image, (double)tempPosition.cX); Canvas.SetTop(image, (double)tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); } } this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if(Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.OBJECT_RAPID_GUN && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { for (int i = 0; i < Support.ListItem.Count; ++i) { if ((int)Support.ListItem[i].Tag == (int)ObjectID.OBJECT_RAPID_GUN) { Image image = new Image(); image.Source = Support.ListItem[i].Source; image.Tag = Support.ListItem[i].Tag; image.Width = Support.ListItem[i].Width; image.Height = Support.ListItem[i].Height; Canvas.SetLeft(image, (double)tempPosition.cX); Canvas.SetTop(image, (double)tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); } } this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.OBJECT_SPREAD_GUN && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { for (int i = 0; i < Support.ListItem.Count; ++i) { if ((int)Support.ListItem[i].Tag == (int)ObjectID.OBJECT_SPREAD_GUN) { Image image = new Image(); image.Source = Support.ListItem[i].Source; image.Tag = Support.ListItem[i].Tag; image.Width = Support.ListItem[i].Width; image.Height = Support.ListItem[i].Height; Canvas.SetLeft(image, (double)tempPosition.cX); Canvas.SetTop(image, (double)tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); } } this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } } } }
public void loadCanvas(String pathFileName, Canvas workSpace) { XmlDocument xmlDocument = new XmlDocument(); xmlDocument.Load(pathFileName); XmlNode rootNode; rootNode = xmlDocument.DocumentElement; Support.WIDTH_MAP = int.Parse(rootNode.Attributes["Width"].Value); Support.HEIGHT_MAP = int.Parse(rootNode.Attributes["Height"].Value); Support.COL = Convert.ToInt32(Math.Ceiling((float)Support.WIDTH_MAP / Support.SIZE_CELLS_WIDTH)); Support.ROW = Convert.ToInt32(Math.Ceiling((float)Support.HEIGHT_MAP / Support.SIZE_CELLS_HEIGHT)); Support.MAPNAME = rootNode.Attributes["Name"].Value; XmlNodeList nodeList; nodeList = xmlDocument.GetElementsByTagName("Object"); foreach (XmlNode item in nodeList) { if (this.isExisted(Convert.ToInt32(item.Attributes["Index"].Value)) == false) { VECTOR2D tempPosition = new VECTOR2D(float.Parse(item.Attributes["X"].Value), float.Parse(item.Attributes["Y"].Value)); int width = Convert.ToInt32(item.Attributes["Width"].Value); int height = Convert.ToInt32(item.Attributes["Height"].Value); tempPosition = Support.ConvertCoordinationOfCanvas(tempPosition, width, height); if (Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.VIRTUAL_OBJECT) { if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.TILE_BASE) { Rectangle shape = new Rectangle(); shape.Tag = (int)ObjectID.TILE_BASE; shape.Width = width; shape.Height = height; shape.Stroke = new SolidColorBrush(Colors.Red); shape.StrokeThickness = 3; Canvas.SetLeft(shape, tempPosition.cX); Canvas.SetTop(shape, tempPosition.cY); Canvas.SetZIndex(shape, 2); workSpace.Children.Add(shape); this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.VIRTUAL_OBJECT_WALL) { Rectangle shape = new Rectangle(); shape.Tag = (int)ObjectID.VIRTUAL_OBJECT_WALL; shape.Width = width; shape.Height = height; shape.Stroke = new SolidColorBrush(Colors.Blue); shape.StrokeThickness = 3; Canvas.SetLeft(shape, tempPosition.cX); Canvas.SetTop(shape, tempPosition.cY); Canvas.SetZIndex(shape, 2); workSpace.Children.Add(shape); this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.VIRTUAL_OBJECT_CLIMB) { Rectangle shape = new Rectangle(); shape.Tag = (int)ObjectID.VIRTUAL_OBJECT_CLIMB; shape.Width = width; shape.Height = height; shape.Stroke = new SolidColorBrush(Colors.Green); shape.StrokeThickness = 3; Canvas.SetLeft(shape, tempPosition.cX); Canvas.SetTop(shape, tempPosition.cY); Canvas.SetZIndex(shape, 2); workSpace.Children.Add(shape); this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.NINJA && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { Image image = ListBoxCreater.getImageForListBox(new BitmapImage(new Uri(@"\Resource\object\Ninja.png", UriKind.Relative)), ObjectID.NINJA, 17, 32); Canvas.SetLeft(image, tempPosition.cX); Canvas.SetTop(image, tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.ENEMY_BROWN_BAT && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { Image image = ListBoxCreater.getImageForListBox(new BitmapImage(new Uri(@"\Resource\object\Enemy_brown_bat.png", UriKind.Relative)), ObjectID.ENEMY_BROWN_BAT, 16, 13); Canvas.SetLeft(image, tempPosition.cX); Canvas.SetTop(image, tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.ENEMY_RUN && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { Image image = ListBoxCreater.getImageForListBox(new BitmapImage(new Uri(@"\Resource\object\Enemy_run.png", UriKind.Relative)), ObjectID.ENEMY_RUN, 16, 32); Canvas.SetLeft(image, tempPosition.cX); Canvas.SetTop(image, tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.ENEMY_EAGLE && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { Image image = ListBoxCreater.getImageForListBox(new BitmapImage(new Uri(@"\Resource\object\Enemy_eagle.png", UriKind.Relative)), ObjectID.ENEMY_EAGLE, 17, 25); Canvas.SetLeft(image, tempPosition.cX); Canvas.SetTop(image, tempPosition.cY); Canvas.SetZIndex(image, 3); workSpace.Children.Add(image); this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.ENEMY_MACHINE_GUN && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { Image image = ListBoxCreater.getImageForListBox(new BitmapImage(new Uri(@"\Resource\object\Enemy_machine_gun.png", UriKind.Relative)), ObjectID.ENEMY_MACHINE_GUN, 16, 32); Canvas.SetLeft(image, tempPosition.cX); Canvas.SetTop(image, tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.ENEMY_PANTHER && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { Image image = ListBoxCreater.getImageForListBox(new BitmapImage(new Uri(@"\Resource\object\Enemy_panther.png", UriKind.Relative)), ObjectID.ENEMY_PANTHER, 24, 15); Canvas.SetLeft(image, tempPosition.cX); Canvas.SetTop(image, tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.ENEMY_ROCKET && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { Image image = ListBoxCreater.getImageForListBox(new BitmapImage(new Uri(@"\Resource\object\Enemy_rocket.png", UriKind.Relative)), ObjectID.ENEMY_ROCKET, 24, 25); Canvas.SetLeft(image, tempPosition.cX); Canvas.SetTop(image, tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.ENEMY_SWORD && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { Image image = ListBoxCreater.getImageForListBox(new BitmapImage(new Uri(@"\Resource\object\Enemy_Sword.png", UriKind.Relative)), ObjectID.ENEMY_SWORD, 24, 32); Canvas.SetLeft(image, tempPosition.cX); Canvas.SetTop(image, tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.ENEMY_THROW_SWORD && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { Image image = ListBoxCreater.getImageForListBox(new BitmapImage(new Uri(@"\Resource\object\Enemy_throw_sword.png", UriKind.Relative)), ObjectID.ENEMY_THROW_SWORD, 24, 32); Canvas.SetLeft(image, tempPosition.cX); Canvas.SetTop(image, tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.GIF_BIRD && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { Image image = ListBoxCreater.getImageForListBox(new BitmapImage(new Uri(@"\Resource\object\gif_bird.png", UriKind.Relative)), ObjectID.GIF_BIRD, 16, 15); Canvas.SetLeft(image, tempPosition.cX); Canvas.SetTop(image, tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.GIF_BUTERFLY && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { Image image = ListBoxCreater.getImageForListBox(new BitmapImage(new Uri(@"\Resource\object\gif_buterfly.png", UriKind.Relative)), ObjectID.GIF_BUTERFLY, 15, 14); Canvas.SetLeft(image, tempPosition.cX); Canvas.SetTop(image, tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.BOSS_3 && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { Image image = ListBoxCreater.getImageForListBox(new BitmapImage(new Uri(@"\Resource\object\Boss3.png", UriKind.Relative)), ObjectID.BOSS_3, 34, 48); Canvas.SetLeft(image, tempPosition.cX); Canvas.SetTop(image, tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.OBJECT_5_POWER && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { for (int i = 0; i < Support.ListItem.Count; ++i) { if ((int)Support.ListItem[i].Tag == (int)ObjectID.OBJECT_5_POWER) { Image image = new Image(); image.Source = Support.ListItem[i].Source; image.Tag = Support.ListItem[i].Tag; image.Width = Support.ListItem[i].Width; image.Height = Support.ListItem[i].Height; Canvas.SetLeft(image, (double)tempPosition.cX); Canvas.SetTop(image, (double)tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); } } this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.OBJECT_10_POWER && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { for (int i = 0; i < Support.ListItem.Count; ++i) { if ((int)Support.ListItem[i].Tag == (int)ObjectID.OBJECT_10_POWER) { Image image = new Image(); image.Source = Support.ListItem[i].Source; image.Tag = Support.ListItem[i].Tag; image.Width = Support.ListItem[i].Width; image.Height = Support.ListItem[i].Height; Canvas.SetLeft(image, (double)tempPosition.cX); Canvas.SetTop(image, (double)tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); } } this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.OBJECT_500_POINT && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { for (int i = 0; i < Support.ListItem.Count; ++i) { if ((int)Support.ListItem[i].Tag == (int)ObjectID.OBJECT_500_POINT) { Image image = new Image(); image.Source = Support.ListItem[i].Source; image.Tag = Support.ListItem[i].Tag; image.Width = Support.ListItem[i].Width; image.Height = Support.ListItem[i].Height; Canvas.SetLeft(image, (double)tempPosition.cX); Canvas.SetTop(image, (double)tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); } } this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.OBJECT_1000_POINT && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { for (int i = 0; i < Support.ListItem.Count; ++i) { if ((int)Support.ListItem[i].Tag == (int)ObjectID.OBJECT_1000_POINT) { Image image = new Image(); image.Source = Support.ListItem[i].Source; image.Tag = Support.ListItem[i].Tag; image.Width = Support.ListItem[i].Width; image.Height = Support.ListItem[i].Height; Canvas.SetLeft(image, (double)tempPosition.cX); Canvas.SetTop(image, (double)tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); } } this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.OBJECT_FLAMES && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { for (int i = 0; i < Support.ListItem.Count; ++i) { if ((int)Support.ListItem[i].Tag == (int)ObjectID.OBJECT_FLAMES) { Image image = new Image(); image.Source = Support.ListItem[i].Source; image.Tag = Support.ListItem[i].Tag; image.Width = Support.ListItem[i].Width; image.Height = Support.ListItem[i].Height; Canvas.SetLeft(image, (double)tempPosition.cX); Canvas.SetTop(image, (double)tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); } } this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.OBJECT_HEALTH && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { for (int i = 0; i < Support.ListItem.Count; ++i) { if ((int)Support.ListItem[i].Tag == (int)ObjectID.OBJECT_HEALTH) { Image image = new Image(); image.Source = Support.ListItem[i].Source; image.Tag = Support.ListItem[i].Tag; image.Width = Support.ListItem[i].Width; image.Height = Support.ListItem[i].Height; Canvas.SetLeft(image, (double)tempPosition.cX); Canvas.SetTop(image, (double)tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); } } this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.OBJECT_THROW_STAR && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { for (int i = 0; i < Support.ListItem.Count; ++i) { if ((int)Support.ListItem[i].Tag == (int)ObjectID.OBJECT_THROW_STAR) { Image image = new Image(); image.Source = Support.ListItem[i].Source; image.Tag = Support.ListItem[i].Tag; image.Width = Support.ListItem[i].Width; image.Height = Support.ListItem[i].Height; Canvas.SetLeft(image, (double)tempPosition.cX); Canvas.SetTop(image, (double)tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); } } this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.OBJECT_TIME_FREEZE && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { for (int i = 0; i < Support.ListItem.Count; ++i) { if ((int)Support.ListItem[i].Tag == (int)ObjectID.OBJECT_TIME_FREEZE) { Image image = new Image(); image.Source = Support.ListItem[i].Source; image.Tag = Support.ListItem[i].Tag; image.Width = Support.ListItem[i].Width; image.Height = Support.ListItem[i].Height; Canvas.SetLeft(image, (double)tempPosition.cX); Canvas.SetTop(image, (double)tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); } } this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } else if (Convert.ToInt32(item.Attributes["Id"].Value) == (int)ObjectID.OBJECT_WINDMIL_STAR && Convert.ToInt32(item.Attributes["Type"].Value) == (int)ObjectType.NORMAL_OBJECT) { for (int i = 0; i < Support.ListItem.Count; ++i) { if ((int)Support.ListItem[i].Tag == (int)ObjectID.OBJECT_WINDMIL_STAR) { Image image = new Image(); image.Source = Support.ListItem[i].Source; image.Tag = Support.ListItem[i].Tag; image.Width = Support.ListItem[i].Width; image.Height = Support.ListItem[i].Height; Canvas.SetLeft(image, (double)tempPosition.cX); Canvas.SetTop(image, (double)tempPosition.cY); Canvas.SetZIndex(image, 2); workSpace.Children.Add(image); } } this.mReadList.Add(Convert.ToInt32(item.Attributes["Index"].Value)); } } } }