aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS_TheReturn
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-05-13 10:22:51 -0400
committerMichael <[email protected]>2017-05-13 10:22:51 -0400
commitc0f0e99f9d2a092209e710107c1f061fc8a2eaca (patch)
tree98169cbdfdc13966719671178ba982dbad5808e3 /ShiftOS_TheReturn
parent94e1603b8574b45b809d3c66b6b90e7734a99d1e (diff)
downloadshiftos_thereturn-c0f0e99f9d2a092209e710107c1f061fc8a2eaca.tar.gz
shiftos_thereturn-c0f0e99f9d2a092209e710107c1f061fc8a2eaca.tar.bz2
shiftos_thereturn-c0f0e99f9d2a092209e710107c1f061fc8a2eaca.zip
Dithering, audio volume, and fix shutdown bug
Diffstat (limited to 'ShiftOS_TheReturn')
-rw-r--r--ShiftOS_TheReturn/AppearanceManager.cs1
-rw-r--r--ShiftOS_TheReturn/AudioManager.cs8
-rw-r--r--ShiftOS_TheReturn/Commands.cs34
3 files changed, 42 insertions, 1 deletions
diff --git a/ShiftOS_TheReturn/AppearanceManager.cs b/ShiftOS_TheReturn/AppearanceManager.cs
index 42642f8..d8004bc 100644
--- a/ShiftOS_TheReturn/AppearanceManager.cs
+++ b/ShiftOS_TheReturn/AppearanceManager.cs
@@ -223,6 +223,7 @@ namespace ShiftOS.Engine
/// </summary>
internal static void Exit()
{
+ OnExit?.Invoke();
//disconnect from MUD
ServerManager.Disconnect();
Environment.Exit(0);
diff --git a/ShiftOS_TheReturn/AudioManager.cs b/ShiftOS_TheReturn/AudioManager.cs
index c50bd24..fff3369 100644
--- a/ShiftOS_TheReturn/AudioManager.cs
+++ b/ShiftOS_TheReturn/AudioManager.cs
@@ -88,7 +88,13 @@ namespace ShiftOS.Engine
_reader = new AudioFileReader(file);
_out = new WaveOut();
_out.Init(_reader);
- _out.Volume = _provider.Volume;
+ try
+ {
+ _out.Volume = (float)SaveSystem.CurrentSave.SfxVolume / 100;
+ }
+ catch
+ {
+ }
_out.Play();
_out.PlaybackStopped += (o, a) => { PlayCompleted?.Invoke(); };
}
diff --git a/ShiftOS_TheReturn/Commands.cs b/ShiftOS_TheReturn/Commands.cs
index 5b7674a..6e59311 100644
--- a/ShiftOS_TheReturn/Commands.cs
+++ b/ShiftOS_TheReturn/Commands.cs
@@ -378,6 +378,40 @@ namespace ShiftOS.Engine
[Namespace("sos")]
public static class ShiftOSCommands
{
+ [Command("setsfxvolume", description = "Set the volume of various sound effects to a value between 1 and 100.")]
+ [RequiresArgument("value")]
+ public static bool SetSfxVolume(Dictionary<string, object> args)
+ {
+ int value = int.Parse(args["value"].ToString());
+ if (value >= 0 && value <= 100)
+ {
+ SaveSystem.CurrentSave.SfxVolume = value;
+ SaveSystem.SaveGame();
+ }
+ else
+ {
+ Console.WriteLine("Volume must be between 0 and 100!");
+ }
+ return true;
+ }
+
+ [Command("setmusicvolume", description ="Set the music volume to a value between 1 and 100.")]
+ [RequiresArgument("value")]
+ public static bool SetMusicVolume(Dictionary<string, object> args)
+ {
+ int value = int.Parse(args["value"].ToString());
+ if(value >= 0 && value <= 100)
+ {
+ SaveSystem.CurrentSave.MusicVolume = value;
+ SaveSystem.SaveGame();
+ }
+ else
+ {
+ Console.WriteLine("Volume must be between 0 and 100!");
+ }
+ return true;
+ }
+
[RemoteLock]
[Command("shutdown")]
public static bool Shutdown()