-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2188538
commit 90a128c
Showing
9 changed files
with
172 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project> | ||
<PropertyGroup> | ||
<Urho3DNetVersion>0.3.7.792</Urho3DNetVersion> | ||
<Urho3DNetVersion>0.3.7.800</Urho3DNetVersion> | ||
</PropertyGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using Urho3DNet; | ||
|
||
namespace RbfxTemplate | ||
{ | ||
/// <summary> | ||
/// Settings file content. | ||
/// </summary> | ||
public class GameSettings | ||
{ | ||
private static readonly string SOUND_MASTER = "Master"; | ||
|
||
private static readonly string SOUND_EFFECT = "Effect"; | ||
|
||
//static readonly string SOUND_AMBIENT = "Ambient"; | ||
//static readonly string SOUND_VOICE = "Voice"; | ||
private static readonly string SOUND_MUSIC = "Music"; | ||
|
||
/// <summary> | ||
/// Get or set master volume. | ||
/// </summary> | ||
public float MasterVolume { get; set; } = 1.0f; | ||
|
||
/// <summary> | ||
/// Get or set music volume. | ||
/// </summary> | ||
public float MusicVolume { get; set; } = 1.0f; | ||
|
||
/// <summary> | ||
/// Get or set effects volume. | ||
/// </summary> | ||
public float EffectVolume { get; set; } = 1.0f; | ||
|
||
/// <summary> | ||
/// Apply settings to the application global settings. | ||
/// </summary> | ||
/// <param name="context">Application context.</param> | ||
public void Apply(Context context) | ||
{ | ||
var audio = context.GetSubsystem<Audio>(); | ||
|
||
audio.SetMasterGain(SOUND_MASTER, MasterVolume); | ||
audio.SetMasterGain(SOUND_MUSIC, MusicVolume); | ||
audio.SetMasterGain(SOUND_EFFECT, EffectVolume); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
using Urho3DNet; | ||
|
||
namespace RbfxTemplate | ||
{ | ||
public class SettingsMenuState : RmlUIStateBase | ||
{ | ||
public SettingsMenuState(UrhoPluginApplication app) : base(app, "UI/Options.rml") | ||
{ | ||
Settings = app.Settings; | ||
} | ||
|
||
public GameSettings Settings { get; private set; } | ||
|
||
public override void OnDataModelInitialized(GameRmlUIComponent menuComponent) | ||
{ | ||
menuComponent.BindDataModelEvent("Apply", OnApply); | ||
menuComponent.BindDataModelEvent("Cancel", OnCancel); | ||
menuComponent.BindDataModelProperty("master", val => val.Set(Settings.MasterVolume), | ||
val => Settings.MasterVolume = val.Float); | ||
menuComponent.BindDataModelProperty("music", val => val.Set(Settings.MusicVolume), | ||
val => Settings.MusicVolume = val.Float); | ||
menuComponent.BindDataModelProperty("effects", val => val.Set(Settings.EffectVolume), | ||
val => Settings.EffectVolume = val.Float); | ||
//menuComponent.BindDataModelProperty("shadows", val => val.Set(_shadowsQuality), (val) => _shadowsQuality = val.Convert(VariantType.VarInt).Int); | ||
} | ||
|
||
public override void Activate(StringVariantMap bundle) | ||
{ | ||
Settings = Application.Settings; | ||
|
||
var audio = Context.GetSubsystem<Audio>(); | ||
|
||
base.Activate(bundle); | ||
} | ||
|
||
public override void Deactivate() | ||
{ | ||
base.Deactivate(); | ||
} | ||
|
||
private void OnCancel(VariantList obj) | ||
{ | ||
Application.HandleBackKey(); | ||
|
||
//Application.Settings = GameSettings.Load(Context); | ||
} | ||
|
||
private void OnApply(VariantList obj) | ||
{ | ||
Settings.Apply(Context); | ||
//Settings.Save(Context); | ||
|
||
Application.HandleBackKey(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters