/// <summary> /// metodo para acceder al level. /// </summary> /// <param name="level"> objeto level al que se accede. </param> public override void Visit(Level level) { if (level.ScreenList.Count >= 1) { this.LastScreen = level.ScreenList[level.ScreenList.Count - 1]; } try { string name = this.tag.AttributeList["Name"].Value; int positionY = Int32.Parse(this.tag.AttributeList["PositionY"].Value); int positionX = Int32.Parse(this.tag.AttributeList["PositionX"].Value); int length = Int32.Parse(this.tag.AttributeList["Length"].Value); int width = Int32.Parse(this.tag.AttributeList["Width"].Value); string imagePath = this.tag.AttributeList["ImagePath"].Value; IXML dragAndDropSource = new DragAndDropSource(name, positionY, positionX, length, width, this.LastScreen, imagePath); this.LastScreen.Add(dragAndDropSource); } catch (Exception) { string message = "there was an error while fetching data from the XML file"; throw new NotFoundOnXMLException(message); } }
/// <summary> /// constructor de la clase Word. /// </summary> /// <param name="name">nombre.</param> /// <param name="positionY">posicion Y.</param> /// <param name="positionX">posicion X.</param> /// <param name="length">largo.</param> /// <param name="width">ancho.</param> /// <param name="screen">pantalla a la que pertenece.</param> /// <param name="imagePath">imagen que posee.</param> /// <param name="source">fuente.</param> /// <param name="destination">destino.</param> public Word(string name, int positionY, int positionX, int length, int width, Screen screen, string imagePath, DragAndDropSource source, BlankSpace destination) : base(name, positionY, positionX, length, width, screen, imagePath, source, destination) { }
/// <summary> /// constructor de DragAndDropItem. /// </summary> /// <param name="name">nombre.</param> /// <param name="positionY">posicion Y.</param> /// <param name="positionX">posicion X.</param> /// <param name="length">largo.</param> /// <param name="width">ancho.</param> /// <param name="screen">Screen a la que pertenece el elemento.</param> /// <param name="imagePath">imagen que posee el elemento.</param> /// <param name="source">fuente del elemento.</param> /// <param name="destination">destino del elemento.</param> public DragAndDropItem(string name, int positionY, int positionX, int length, int width, Screen screen, string imagePath, DragAndDropSource source, BlankSpace destination) : base(name, positionY, positionX, length, width, screen, imagePath) { this.Destination = destination; this.Source = source; }
/// <summary> /// metodo que dibuja un DragAndDropSource en Unity. /// </summary> /// <param name="dragAndDropSource"> DragAndDropSource a dibujar. </param> public void RenderDragAndDropSource(DragAndDropSource dragAndDropSource) { dragAndDropSource.SourceCellImageId = this.adapter.CreateImage((int)dragAndDropSource.PositionX, (int)dragAndDropSource.PositionY, (int)dragAndDropSource.Width, (int)dragAndDropSource.Length); this.adapter.SetImage(dragAndDropSource.SourceCellImageId, dragAndDropSource.ImagePath); }