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)),
|
(g, v) => g.LocalPlayer.ReachDistance = Utils.ParseDecimal(v)),
|
||||||
|
|
||||||
MakeOpt(-1, -50, "Music volume", OnWidgetClick,
|
MakeOpt(-1, -50, "Music volume", OnWidgetClick,
|
||||||
g => g.MusicVolume.ToString(),
|
g => g.MusicVolume.ToString(), SetMusicVolume),
|
||||||
(g, v) => { g.MusicVolume = Int32.Parse(v); g.AudioPlayer.SetMusic(g.MusicVolume); }),
|
|
||||||
|
|
||||||
MakeOpt(-1, 0, "Sounds volume", OnWidgetClick,
|
MakeOpt(-1, 0, "Sounds volume", OnWidgetClick,
|
||||||
g => g.SoundsVolume.ToString(),
|
g => g.SoundsVolume.ToString(), SetSoundsVolume),
|
||||||
(g, v) => { g.SoundsVolume = Int32.Parse(v); g.AudioPlayer.SetSounds(g.SoundsVolume); }),
|
|
||||||
|
|
||||||
MakeBool(-1, 50, "View bobbing", OptionsKey.ViewBobbing,
|
MakeBool(-1, 50, "View bobbing", OptionsKey.ViewBobbing,
|
||||||
OnWidgetClick, g => g.ViewBobbing, (g, v) => g.ViewBobbing = v),
|
OnWidgetClick, g => g.ViewBobbing, (g, v) => g.ViewBobbing = v),
|
||||||
|
@ -83,5 +81,17 @@ namespace ClassicalSharp.Gui.Screens {
|
||||||
"&fThe default click distance is 5 blocks.",
|
"&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