/// <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; string soundPath = this.tag.AttributeList["SoundPath"].Value; IXML button = new ButtonSound(name, positionY, positionX, length, width, this.LastScreen, imagePath, soundPath); this.LastScreen.Add(button); } catch (Exception) { string message = "there was an error while fetching data from the XML file"; throw new NotFoundOnXMLException(message); } }
/// <summary> /// hace el sonido de una letra. /// </summary> /// <param name="buttonSound"> boton con el sonido. </param> public void Sound(ButtonSound buttonSound) { OneAdapter.Adapter.Debug($"Button clicked!"); OneAdapter.Adapter.PlayAudio(buttonSound.SoundPath); }
/// <summary> /// metodo que dibuja un ButtonSound en Unity. /// </summary> /// <param name="buttonSound"> ButtonSound a dibujar. </param> public void RenderButtonSound(ButtonSound buttonSound) { buttonSound.ButtonId = this.adapter.CreateButton((int)buttonSound.PositionX, (int)buttonSound.PositionY, (int)buttonSound.Width, (int)buttonSound.Length, "#FFFFFFFF", buttonSound.Action); this.adapter.SetImage(buttonSound.ButtonId, buttonSound.ImagePath); this.adapter.SetText(buttonSound.ButtonId, string.Empty); }