diff --git a/GeneralMods/StardustCore/UIUtilities/IClickableMenuExtended.cs b/GeneralMods/StardustCore/UIUtilities/IClickableMenuExtended.cs index f895e82d..450ad5ef 100644 --- a/GeneralMods/StardustCore/UIUtilities/IClickableMenuExtended.cs +++ b/GeneralMods/StardustCore/UIUtilities/IClickableMenuExtended.cs @@ -84,6 +84,66 @@ namespace StardustCore.UIUtilities this.drawDialogueBoxBackground(xPosition, yPosition, width, height, false, true, color); } + public virtual void drawOnlyDialogueBoxBackground(int x, int y, int width, int height, Color color, float depth) + { + + int height1 = Game1.graphics.GraphicsDevice.Viewport.TitleSafeArea.Height; + int width1 = Game1.graphics.GraphicsDevice.Viewport.TitleSafeArea.Width; + int dialogueX = 0; + int num1 = y > Game1.graphics.GraphicsDevice.Viewport.TitleSafeArea.Y ? 0 : Game1.graphics.GraphicsDevice.Viewport.TitleSafeArea.Y; + int num2 = 0; + width = Math.Min(Game1.graphics.GraphicsDevice.Viewport.TitleSafeArea.Width, width); + + Microsoft.Xna.Framework.Rectangle rectangle1 = new Microsoft.Xna.Framework.Rectangle(0, 0, Game1.tileSize, Game1.tileSize); + int addedTileHeightForQuestions = -1; + + if (Game1.questionChoices.Count >= 3) + addedTileHeightForQuestions = Game1.questionChoices.Count - 3; + + rectangle1.Width = Game1.tileSize; + rectangle1.Height = Game1.tileSize; + rectangle1.X = Game1.tileSize; + rectangle1.Y = Game1.tileSize * 2; + depth += 0.001f; + Game1.spriteBatch.Draw(Game1.menuTexture, new Microsoft.Xna.Framework.Rectangle(x+Game1.tileSize/2,y+Game1.tileSize/2,width, height), new Microsoft.Xna.Framework.Rectangle?(rectangle1), color,0f,Vector2.Zero,SpriteEffects.None,depth); + rectangle1.Y = 0; + rectangle1.X = 0; + depth += 0.001f; + + //Draw the corners + Game1.spriteBatch.Draw(Game1.menuTexture, new Rectangle((x), (y),rectangle1.Width,rectangle1.Height), new Microsoft.Xna.Framework.Rectangle?(rectangle1), color, 0f, Vector2.Zero, SpriteEffects.None, depth); + rectangle1.X = Game1.tileSize * 3; + depth += 0.001f; + Game1.spriteBatch.Draw(Game1.menuTexture, new Rectangle((x + width), (y),rectangle1.Width,rectangle1.Height), new Microsoft.Xna.Framework.Rectangle?(rectangle1), color, 0f, Vector2.Zero, SpriteEffects.None, depth); + rectangle1.Y = Game1.tileSize * 3; + depth += 0.001f; + Game1.spriteBatch.Draw(Game1.menuTexture, new Rectangle((x + width), (y + height),rectangle1.Width,rectangle1.Height), new Microsoft.Xna.Framework.Rectangle?(rectangle1), color, 0f, Vector2.Zero, SpriteEffects.None, depth); + rectangle1.X = 0; + depth += 0.001f; + Game1.spriteBatch.Draw(Game1.menuTexture, new Rectangle((x), (y + height),rectangle1.Width,rectangle1.Height), new Microsoft.Xna.Framework.Rectangle?(rectangle1), color, 0f, Vector2.Zero, SpriteEffects.None, depth); + + + rectangle1.X = Game1.tileSize * 2; + rectangle1.Y = 0; + depth += 0.001f; + //top + Game1.spriteBatch.Draw(Game1.menuTexture, new Microsoft.Xna.Framework.Rectangle(x+Game1.tileSize, y, width-Game1.tileSize, Game1.tileSize), new Microsoft.Xna.Framework.Rectangle?(rectangle1), color, 0f, Vector2.Zero, SpriteEffects.None, depth); + rectangle1.Y = 3 * Game1.tileSize; + depth += 0.001f; + //bottom?? + Game1.spriteBatch.Draw(Game1.menuTexture, new Microsoft.Xna.Framework.Rectangle(Game1.tileSize + x, y + height,width-Game1.tileSize, Game1.tileSize), new Microsoft.Xna.Framework.Rectangle?(rectangle1), color, 0f, Vector2.Zero, SpriteEffects.None, depth); + rectangle1.Y = Game1.tileSize * 2; + rectangle1.X = 0; + depth += 0.001f; + //left + Game1.spriteBatch.Draw(Game1.menuTexture, new Microsoft.Xna.Framework.Rectangle(x, y+Game1.tileSize, Game1.tileSize,height-Game1.tileSize), new Microsoft.Xna.Framework.Rectangle?(rectangle1), color, 0f, Vector2.Zero, SpriteEffects.None, depth); + rectangle1.X = 3 * Game1.tileSize; + depth += 0.001f; + //right + Game1.spriteBatch.Draw(Game1.menuTexture, new Microsoft.Xna.Framework.Rectangle(x + width, y+Game1.tileSize ,Game1.tileSize, height-Game1.tileSize), new Microsoft.Xna.Framework.Rectangle?(rectangle1), color, 0f, Vector2.Zero, SpriteEffects.None, depth); + + } + /// /// Draws the dialogue box background. Takes in a color. /// diff --git a/GeneralMods/StardustCore/UIUtilities/MenuComponents/SliderButton.cs b/GeneralMods/StardustCore/UIUtilities/MenuComponents/SliderButton.cs index 86586400..00afdc86 100644 --- a/GeneralMods/StardustCore/UIUtilities/MenuComponents/SliderButton.cs +++ b/GeneralMods/StardustCore/UIUtilities/MenuComponents/SliderButton.cs @@ -446,7 +446,7 @@ namespace StardustCore.UIUtilities.MenuComponents //Draw the slider bar. sliderBar.draw(b, color, offset, layerDepth); //b.Draw(this..getTexture(), new Vector2(this.bounds.X + (int)offset.X, this.bounds.Y + (int)offset.Y), this.sourceRect, color, 0f, Vector2.Zero, this.scale, SpriteEffects.None, layerDepth); - b.Draw(this.animationManager.getTexture(), new Vector2(this.bounds.X + (int)offset.X, this.bounds.Y), this.sourceRect, color, 0f, Vector2.Zero, this.scale, SpriteEffects.None, layerDepth); + b.Draw(this.animationManager.getTexture(), new Vector2(this.bounds.X + (int)offset.X, this.bounds.Y), this.sourceRect, color, 0f, Vector2.Zero, this.scale, SpriteEffects.None, layerDepth+0.01f); if (this.extraTextures != null) { @@ -462,7 +462,7 @@ namespace StardustCore.UIUtilities.MenuComponents if (string.IsNullOrEmpty(this.label)) return; - b.DrawString(Game1.smallFont, this.label+this.sliderInformation.getLabelInformation(this.getLabelXYPos), new Vector2((float)((this.bounds.X + this.bounds.Width+offset.X)*this.scale), (float)this.bounds.Y + ((float)(this.bounds.Height / 2) - Game1.smallFont.MeasureString(this.label).Y / 2f)+offset.X+this.sliderInformation.yPos), textColor); + b.DrawString(Game1.smallFont, this.label+this.sliderInformation.getLabelInformation(this.getLabelXYPos), new Vector2((float)((sliderBar.bounds.X + sliderBar.bounds.Width+offset.X+this.bounds.Width)), (float)sliderBar.bounds.Y + ((float)(sliderBar.bounds.Height / 2) - Game1.smallFont.MeasureString(this.label).Y / 2f)+offset.X), textColor,0f,Vector2.Zero,1f,SpriteEffects.None,layerDepth+0.02f); } diff --git a/GeneralMods/Vocalization/Vocalization/Framework/Menus/VocalizationMenu.cs b/GeneralMods/Vocalization/Vocalization/Framework/Menus/VocalizationMenu.cs index 60a534bf..fb0a54dd 100644 --- a/GeneralMods/Vocalization/Vocalization/Framework/Menus/VocalizationMenu.cs +++ b/GeneralMods/Vocalization/Vocalization/Framework/Menus/VocalizationMenu.cs @@ -33,7 +33,7 @@ namespace Vocalization.Framework.Menus Button bar = new Button(new Rectangle(this.xPositionOnScreen + 100, this.yPositionOnScreen + 220, 200, 40), new Texture2DExtended(Vocalization.ModHelper, Vocalization.Manifest, Path.Combine("Content", "Graphics", "SliderBar.png")),new Rectangle(0,0,100,10),2f); //Texture2DExtended barTexture = new Texture2DExtended(Vocalization.ModHelper, Vocalization.Manifest, Path.Combine("Content", "Graphics", "SliderBar.png")); Rectangle sourceRect = new Rectangle(0, 0, 4, 16); - this.sliderButton = new SliderButton("Slider", "Volume", new Rectangle(this.xPositionOnScreen+100, this.yPositionOnScreen+220, 4, 16), buttonTexture, bar, sourceRect, 2f, new SliderInformation(SliderStyle.Horizontal, 100, 1), new StardustCore.Animations.Animation(sourceRect), Color.White, Color.Black, new StardustCore.UIUtilities.MenuComponents.Delegates.Functionality.ButtonFunctionality(null, null, null), false, null, true); + this.sliderButton = new SliderButton("Slider", "Volume", new Rectangle(this.xPositionOnScreen+100, this.yPositionOnScreen+220, 4, 16), buttonTexture, bar, sourceRect, 2f, new SliderInformation(SliderStyle.Horizontal, (int)(Vocalization.config.voiceVolume*100), 1), new StardustCore.Animations.Animation(sourceRect), Color.White, Color.Black, new StardustCore.UIUtilities.MenuComponents.Delegates.Functionality.ButtonFunctionality(null, null, null), false, null, true); } @@ -57,12 +57,23 @@ namespace Vocalization.Framework.Menus public override void draw(SpriteBatch b) { - //INCLUDE A COLOR FOR THE MENU!!!!! - this.drawDialogueBoxBackground(this.xPositionOnScreen,this.yPositionOnScreen,this.width,this.height); - + this.drawOnlyDialogueBoxBackground(this.xPositionOnScreen, this.yPositionOnScreen, this.width, this.height, new Color(255, 255, 255, 255),0.4f); sliderButton.draw(b,Color.White,Vector2.Zero,0.5f); + } - Vocalization.ModMonitor.Log(this.xPositionOnScreen.ToString()+" "+this.yPositionOnScreen.ToString()); + /// + /// Save the menu information upon menu being closed. + /// + /// + public override bool readyToClose() + { + Vocalization.ModMonitor.Log(sliderButton.sliderInformation.xPos.ToString()); + decimal xPos = sliderButton.sliderInformation.xPos; + Vocalization.config.voiceVolume = (decimal)(xPos/ 100.0M); + Vocalization.ModMonitor.Log(Vocalization.config.voiceVolume.ToString()); + Vocalization.ModHelper.WriteConfig(Vocalization.config); + Vocalization.soundManager.volume =(float) Vocalization.config.voiceVolume; + return true; } diff --git a/GeneralMods/Vocalization/Vocalization/ModConfig.cs b/GeneralMods/Vocalization/Vocalization/ModConfig.cs index 5c8f0527..54ce44d3 100644 --- a/GeneralMods/Vocalization/Vocalization/ModConfig.cs +++ b/GeneralMods/Vocalization/Vocalization/ModConfig.cs @@ -31,7 +31,7 @@ namespace Vocalization /// /// The volume at which the sound for voices is played at. /// - public float voiceVolume; + public decimal voiceVolume; public ModConfig() { @@ -46,7 +46,7 @@ namespace Vocalization translationInfo = new TranslationInfo(); - this.voiceVolume = 1.0f; + this.voiceVolume = (decimal)1.0f; } /// diff --git a/GeneralMods/Vocalization/Vocalization/Vocalization.cs b/GeneralMods/Vocalization/Vocalization/Vocalization.cs index 85cd01d3..c3638f05 100644 --- a/GeneralMods/Vocalization/Vocalization/Vocalization.cs +++ b/GeneralMods/Vocalization/Vocalization/Vocalization.cs @@ -212,7 +212,7 @@ namespace Vocalization config = ModHelper.ReadConfig(); config.verifyValidMode(); //Make sure the current mode is valid. - soundManager.volume = config.voiceVolume; //Set the volume for voices. + soundManager.volume = (float)config.voiceVolume; //Set the volume for voices. } @@ -287,7 +287,7 @@ namespace Vocalization //Change this to take the vocalization menu instead List> modTabs = new List>(); - modTabs.Add(new KeyValuePair(menuTab, new VocalizationMenu(100,100,300,300,true))); + modTabs.Add(new KeyValuePair(menuTab, new VocalizationMenu(100,64,600,300,true))); StardustCore.Menus.ModularGameMenu.AddTabsForMod(ModManifest,modTabs); ModMonitor.Log("VOCALIZATION MENU HACK COMPLETE!", LogLevel.Alert); @@ -325,7 +325,7 @@ namespace Vocalization //Change this to take the vocalization menu instead List> modTabs = new List>(); - modTabs.Add(new KeyValuePair(menuTab, new VocalizationMenu(100, 100, 300, 300,true))); + modTabs.Add(new KeyValuePair(menuTab, new VocalizationMenu(100, 64, 600, 300,true))); StardustCore.Menus.ModularGameMenu.StaticMenuTabsAndPages[ModManifest.UniqueID] = modTabs; }