diff --git a/TouchyTickets/Content/Content.mgcb b/TouchyTickets/Content/Content.mgcb index c0bdea8..0c924d0 100644 --- a/TouchyTickets/Content/Content.mgcb +++ b/TouchyTickets/Content/Content.mgcb @@ -13,6 +13,67 @@ #---------------------------------- Content ---------------------------------# +#begin Fonts/Regular.spritefont +/importer:FontDescriptionImporter +/processor:FontDescriptionProcessor +/processorParam:PremultiplyAlpha=True +/processorParam:TextureFormat=Compressed +/build:Fonts/Regular.spritefont + +#begin Localization/Localization.de.json +/copy:Localization/Localization.de.json + +#begin Localization/Localization.json +/copy:Localization/Localization.json + +#begin Localization/News.de.json +/copy:Localization/News.de.json + +#begin Localization/News.json +/copy:Localization/News.json + +#begin Sounds/Click.wav +/importer:WavImporter +/processor:SoundEffectProcessor +/processorParam:Quality=Best +/build:Sounds/Click.wav + +#begin Sounds/Place.wav +/importer:WavImporter +/processor:SoundEffectProcessor +/processorParam:Quality=Best +/build:Sounds/Place.wav + +#begin Sounds/StarBuy.ogg +/importer:OggImporter +/processor:SoundEffectProcessor +/processorParam:Quality=Best +/build:Sounds/StarBuy.ogg + +#begin Textures/Attractions.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:Textures/Attractions.png + +#begin Textures/Tiles.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:Textures/Tiles.png + #begin Textures/Ui.png /importer:TextureImporter /processor:TextureProcessor @@ -25,30 +86,3 @@ /processorParam:TextureFormat=Color /build:Textures/Ui.png -#begin Fonts/Regular.spritefont -/importer:FontDescriptionImporter -/processor:FontDescriptionProcessor -/build:Fonts/Regular.spritefont - -#begin Textures/Attractions.png -/importer:TextureImporter -/processor:TextureProcessor -/build:Textures/Attractions.png - -#begin Textures/Tiles.png -/importer:TextureImporter -/processor:TextureProcessor -/build:Textures/Tiles.png - -#begin Localization/Localization.json -/copy:Localization/Localization.json - -#begin Localization/News.json -/copy:Localization/News.json - -#begin Localization/Localization.de.json -/copy:Localization/Localization.de.json - -#begin Localization/News.de.json -/copy:Localization/News.de.json - diff --git a/TouchyTickets/Content/Contentless.json b/TouchyTickets/Content/Contentless.json index 2528f48..874e9c5 100644 --- a/TouchyTickets/Content/Contentless.json +++ b/TouchyTickets/Content/Contentless.json @@ -4,6 +4,7 @@ "bin/" ], "overrides": { - ".json": "Copy" + ".json": "Copy", + "Sounds/": [null, "SoundEffectProcessor"] } } \ No newline at end of file diff --git a/TouchyTickets/Content/Localization/Localization.de.json b/TouchyTickets/Content/Localization/Localization.de.json index e0bf307..ed24725 100644 --- a/TouchyTickets/Content/Localization/Localization.de.json +++ b/TouchyTickets/Content/Localization/Localization.de.json @@ -11,6 +11,7 @@ "AppliedUpgrades": "Aktives Upgrade", "Options": "Optionen", "RainingTicketLimit": "Max. Fallende Tickets", + "SoundVolume": "Lautstärke", "----- Tutorial -----": "", "Tutorial1": "Hi! Willkommen zu Touchy Tickets. Um das Spiel zu starten, tippe einfach den Ticket-Laden an, um ein zu verkaufen. Verkaufe erstmal 50!", "Tutorial2": "Super! Jetzt kannst du deine erste Attraktion kaufen. Wechsel durch Wischen zum rechten Menü und kaufe ein Karussell.", diff --git a/TouchyTickets/Content/Localization/Localization.json b/TouchyTickets/Content/Localization/Localization.json index e79f9b4..8e84c77 100644 --- a/TouchyTickets/Content/Localization/Localization.json +++ b/TouchyTickets/Content/Localization/Localization.json @@ -11,6 +11,7 @@ "AppliedUpgrades": "Active Upgrades", "Options": "Options", "RainingTicketLimit": "Max Raining Tickets", + "SoundVolume": "Sound Volume", "----- Tutorial -----": "", "Tutorial1": "Hi! Welcome to Touchy Tickets. To start the game, simply tap the ticket booth to sell a . Start by racking up 50!", "Tutorial2": "Great! Now, you can buy your first attraction. Access the menu on the right by swiping and purchase a carousel.", diff --git a/TouchyTickets/Content/Sounds/Click.wav b/TouchyTickets/Content/Sounds/Click.wav new file mode 100644 index 0000000..33049fa Binary files /dev/null and b/TouchyTickets/Content/Sounds/Click.wav differ diff --git a/TouchyTickets/Content/Sounds/Place.wav b/TouchyTickets/Content/Sounds/Place.wav new file mode 100644 index 0000000..82f91e8 Binary files /dev/null and b/TouchyTickets/Content/Sounds/Place.wav differ diff --git a/TouchyTickets/Content/Sounds/StarBuy.ogg b/TouchyTickets/Content/Sounds/StarBuy.ogg new file mode 100644 index 0000000..4bc400a Binary files /dev/null and b/TouchyTickets/Content/Sounds/StarBuy.ogg differ diff --git a/TouchyTickets/Options.cs b/TouchyTickets/Options.cs index 0222b1b..d65e3cb 100644 --- a/TouchyTickets/Options.cs +++ b/TouchyTickets/Options.cs @@ -1,5 +1,6 @@ using System.IO; using System.Runtime.Serialization; +using Microsoft.Xna.Framework.Audio; using Newtonsoft.Json; namespace TouchyTickets { @@ -10,6 +11,15 @@ namespace TouchyTickets { [DataMember] public int RainingTicketLimit = 300; + [DataMember] + public float SoundVolume { + get => this.soundVolume; + set { + this.soundVolume = value; + SoundEffect.MasterVolume = value; + } + } + private float soundVolume = 1; public static void Save() { var file = GetOptionsFile(true); diff --git a/TouchyTickets/TouchyTickets.csproj b/TouchyTickets/TouchyTickets.csproj index dd0bd8c..637be9d 100644 --- a/TouchyTickets/TouchyTickets.csproj +++ b/TouchyTickets/TouchyTickets.csproj @@ -6,7 +6,7 @@ - + all diff --git a/TouchyTickets/Ui.cs b/TouchyTickets/Ui.cs index 40d6a13..b8e9fac 100644 --- a/TouchyTickets/Ui.cs +++ b/TouchyTickets/Ui.cs @@ -5,6 +5,7 @@ using System.Linq; using System.Numerics; using Coroutine; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Audio; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input.Touch; using MLEM.Extensions; @@ -30,6 +31,13 @@ namespace TouchyTickets { public Ui(UiSystem uiSystem) { this.uiSystem = uiSystem; + this.uiSystem.Style.PanelTexture = this.uiSystem.Style.ScrollBarBackground = new NinePatch(Texture[2, 1], 4); + this.uiSystem.Style.ButtonTexture = this.uiSystem.Style.ScrollBarScrollerTexture = new NinePatch(Texture[3, 1], 4); + this.uiSystem.Style.ActionSound = new SoundEffectInfo(MlemGame.LoadContent("Sounds/Click"), 0.5F); + this.uiSystem.TextFormatter.AddImage("ticket", Texture[2, 0]); + this.uiSystem.TextFormatter.AddImage("star", Texture[3, 0]); + foreach (var modifier in AttractionModifier.Modifiers.Values) + this.uiSystem.TextFormatter.AddImage(modifier.Name, modifier.Texture); // main ticket store ui var rainingTickets = new List(); @@ -119,6 +127,7 @@ namespace TouchyTickets { OnPressed = e2 => this.FadeUi(false, () => this.uiSystem.Remove(e2.Root.Name)) }); infoUi.AddChild(new Button(Anchor.AutoInlineIgnoreOverflow, new Vector2(0.5F, 30), Localization.Get("Remove")) { + ActionSound = new SoundEffectInfo(MlemGame.LoadContent("Sounds/Place")), OnPressed = e2 => { if (map.SelectedPosition == null) return; @@ -161,6 +170,7 @@ namespace TouchyTickets { OnPressed = e2 => this.FadeUi(false, () => this.uiSystem.Remove(e2.Root.Name)) }); yesNoUi.AddChild(new Button(Anchor.AutoInlineIgnoreOverflow, new Vector2(0.5F, 30), Localization.Get("Place")) { + ActionSound = new SoundEffectInfo(MlemGame.LoadContent("Sounds/Place")), OnPressed = e2 => { GameImpl.Instance.Tickets -= price; GameImpl.Instance.Platform.AddResourceEvent(true, "Tickets", price, "Attraction", attraction.Key); @@ -224,6 +234,7 @@ namespace TouchyTickets { OnPressed = e2 => this.FadeUi(false, () => this.uiSystem.Remove(e2.Root.Name)) }); var addButton = infoUi.AddChild(new Button(Anchor.AutoInlineIgnoreOverflow, new Vector2(0.5F, 30), string.Empty) { + ActionSound = new SoundEffectInfo(MlemGame.LoadContent("Sounds/Place")), OnPressed = e2 => { if (map.SelectedPosition == null) return; @@ -300,6 +311,7 @@ namespace TouchyTickets { upgradeHeader.AddChild(new Paragraph(Anchor.AutoCenter, 1, p => GameImpl.Instance.Stars + "", true) {TextScale = 0.3F}); upgradeHeader.AddChild(new Button(Anchor.AutoCenter, new Vector2(0.8F, 30), Localization.Get("EarnStar")) { PositionOffset = new Vector2(0, 4), + ActionSound = new SoundEffectInfo(MlemGame.LoadContent("Sounds/StarBuy")), OnUpdated = (e, time) => ((Button) e).IsDisabled = GameImpl.Instance.Tickets < GameImpl.Instance.GetStarPrice(), OnPressed = e => { var infoBox = new Group(Anchor.TopLeft, Vector2.One, false) { @@ -356,6 +368,15 @@ namespace TouchyTickets { Options.Save(); } }); + optionList.AddChild(new Paragraph(Anchor.AutoLeft, 1, p => Localization.Get("SoundVolume") + ": " + (int) (Options.Instance.SoundVolume * 100))); + optionList.AddChild(new Slider(Anchor.AutoLeft, new Vector2(1, 20), 10, 100) { + PositionOffset = new Vector2(0, 1), + CurrentValue = Options.Instance.SoundVolume * 100, + OnValueChanged = (s, v) => { + Options.Instance.SoundVolume = v / 100; + Options.Save(); + } + }); this.uiSystem.Add("Options", optionsUi); this.swipeRelations = new Element[] {optionsUi, upgradeUi, main, buyUi, modifierUi}; @@ -418,13 +439,7 @@ namespace TouchyTickets { uiSystem.AutoScaleWithScreen = true; uiSystem.AutoScaleReferenceSize = new Point(720, 1280); uiSystem.Style.Font = new GenericSpriteFont(MlemGame.LoadContent("Fonts/Regular")); - uiSystem.Style.PanelTexture = uiSystem.Style.ScrollBarBackground = new NinePatch(Texture[2, 1], 4); - uiSystem.Style.ButtonTexture = uiSystem.Style.ScrollBarScrollerTexture = new NinePatch(Texture[3, 1], 4); uiSystem.Style.TextScale = 0.1F; - uiSystem.TextFormatter.AddImage("ticket", Texture[2, 0]); - uiSystem.TextFormatter.AddImage("star", Texture[3, 0]); - foreach (var modifier in AttractionModifier.Modifiers.Values) - uiSystem.TextFormatter.AddImage(modifier.Name, modifier.Texture); } public static IEnumerator DisplaySplash(Action loadGame) { @@ -533,6 +548,7 @@ namespace TouchyTickets { SetHeightBasedOnChildren = true, PositionOffset = new Vector2(0, 1), ChildPadding = new Vector2(4), + ActionSound = new SoundEffectInfo(MlemGame.LoadContent("Sounds/StarBuy")), OnPressed = e => { GameImpl.Instance.Stars -= upgrade.Price; GameImpl.Instance.Platform.AddResourceEvent(true, "Stars", upgrade.Price, "Upgrade", upgrade.Name);