mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-01-23 09:34:35 -05:00
Fix sounds/music volume not saving, partially addresses #448.
This commit is contained in:
parent
eadac08d0a
commit
58db2f667a
1 changed files with 14 additions and 4 deletions
|
@ -27,12 +27,10 @@ namespace ClassicalSharp.Gui.Screens {
|
|||
(g, v) => g.LocalPlayer.ReachDistance = Utils.ParseDecimal(v)),
|
||||
|
||||
MakeOpt(-1, -50, "Music volume", OnWidgetClick,
|
||||
g => g.MusicVolume.ToString(),
|
||||
(g, v) => { g.MusicVolume = Int32.Parse(v); g.AudioPlayer.SetMusic(g.MusicVolume); }),
|
||||
g => g.MusicVolume.ToString(), SetMusicVolume),
|
||||
|
||||
MakeOpt(-1, 0, "Sounds volume", OnWidgetClick,
|
||||
g => g.SoundsVolume.ToString(),
|
||||
(g, v) => { g.SoundsVolume = Int32.Parse(v); g.AudioPlayer.SetSounds(g.SoundsVolume); }),
|
||||
g => g.SoundsVolume.ToString(), SetSoundsVolume),
|
||||
|
||||
MakeBool(-1, 50, "View bobbing", OptionsKey.ViewBobbing,
|
||||
OnWidgetClick, g => g.ViewBobbing, (g, v) => g.ViewBobbing = v),
|
||||
|
@ -83,5 +81,17 @@ namespace ClassicalSharp.Gui.Screens {
|
|||
"&fThe default click distance is 5 blocks.",
|
||||
};
|
||||
}
|
||||
|
||||
void SetMusicVolume(Game g, string v) {
|
||||
g.MusicVolume = Int32.Parse(v);
|
||||
Options.Set(OptionsKey.MusicVolume, v);
|
||||
g.AudioPlayer.SetMusic(g.MusicVolume);
|
||||
}
|
||||
|
||||
void SetSoundsVolume(Game g, string v) {
|
||||
g.SoundsVolume = Int32.Parse(v);
|
||||
Options.Set(OptionsKey.SoundsVolume, v);
|
||||
g.AudioPlayer.SetSounds(g.SoundsVolume);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue