Skip to content

Commit

Permalink
Merge pull request #53 from krafs/develop
Browse files Browse the repository at this point in the history
Lower default sound volume.
  • Loading branch information
krafs authored Aug 1, 2021
2 parents b37cb5a + 02876e1 commit 746a6f3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 16 deletions.
12 changes: 0 additions & 12 deletions Common/Defs/Sounds.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,6 @@
<clipPath>LevelUp/DistortedSiren</clipPath>
</li>
</grains>
<volumeRange>
<min>125</min>
<max>125</max>
</volumeRange>
</li>
</subSounds>
</SoundDef>
Expand All @@ -98,10 +94,6 @@
<clipPath>LevelUp/Dissonance</clipPath>
</li>
</grains>
<volumeRange>
<min>130</min>
<max>130</max>
</volumeRange>
</li>
</subSounds>
</SoundDef>
Expand All @@ -121,10 +113,6 @@
<clipPath>LevelUp/Deception</clipPath>
</li>
</grains>
<volumeRange>
<min>200</min>
<max>200</max>
</volumeRange>
</li>
</subSounds>
</SoundDef>
Expand Down
8 changes: 4 additions & 4 deletions Source/LevelUp/Actions/SoundAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class SoundAction : LevelingAction
.AllDefs.Where(x => x.HasModExtension<SoundDefExtension>()).ToList();

private SoundDef soundDef = null!;
private float volume = 1f;
private float volume = 0.5f;

public SoundDef SoundDef
{
Expand Down Expand Up @@ -71,7 +71,7 @@ public override void Draw(Rect rect)
private static void DrawVolumeSlider(Rect rect, ref float volume)
{
const float min = 0f;
const float max = 2f;
const float max = 1.5f;

Texture2D image;
if (volume > max * 0.8)
Expand All @@ -94,14 +94,14 @@ private static void DrawVolumeSlider(Rect rect, ref float volume)
Rect imageRect = new Rect(rect) { width = rect.height };
Widgets.DrawTextureFitted(imageRect, image, 1f);
Rect sliderRect = new Rect(rect) { xMin = imageRect.xMax, yMin = rect.y };
volume = Widgets.HorizontalSlider(sliderRect, volume, 0f, 2f, middleAlignment: true);
volume = Widgets.HorizontalSlider(sliderRect, volume, min, max, middleAlignment: true);
}

public override void ExposeData()
{
base.ExposeData();
Scribe_Defs.Look(ref soundDef, "soundDef");
Scribe_Values.Look(ref volume, "volume", 1f);
Scribe_Values.Look(ref volume, "volume", 0.5f);
}
}
}

0 comments on commit 746a6f3

Please sign in to comment.