-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
12 changed files
with
181 additions
and
24 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
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,9 @@ | ||
using Raylib_CsLo; | ||
|
||
namespace NovemberPirates.Scenes.Menus.Components | ||
{ | ||
internal class UiContainer | ||
{ | ||
internal Rectangle Rectangle = new(); | ||
} | ||
} |
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,12 +1,38 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Arch.Core.Extensions; | ||
using NovemberPirates.Scenes.Menus.Components; | ||
using NovemberPirates.Scenes.Menus.Systems; | ||
using Raylib_CsLo; | ||
|
||
namespace NovemberPirates.Scenes.Menus.MainMenu | ||
{ | ||
internal class SettingsScene | ||
internal class SettingsScene : BaseScene | ||
{ | ||
public SettingsScene() | ||
{ | ||
Systems.Add(new MenuSystem()); | ||
Systems.Add(new MenuMusicSystem()); | ||
|
||
var index = 5; | ||
|
||
World.Create(new UiContainer { Rectangle = new Rectangle() }); | ||
|
||
var instructions = World.Create<UiTitle>(); | ||
instructions.Set(new UiTitle { Text = @"WASD to move Q/E or Arrow keys to shoot", Order = index++ }); | ||
var instructions2 = World.Create<UiTitle>(); | ||
instructions2.Set(new UiTitle { Text = @"f3 to change the wind", Order = index++ }); | ||
var instructions3 = World.Create<UiTitle>(); | ||
instructions3.Set(new UiTitle { Text = @"F2 for the debugger I'm proud of", Order = index++ }); | ||
|
||
World.Create(new UiButton | ||
{ | ||
Text = "Back", | ||
Action = () => | ||
{ | ||
NovemberPiratesEngine.Instance.ActiveScene = new MainMenuScene(); | ||
}, | ||
Order = index++ | ||
}); | ||
} | ||
|
||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using System.Security.Cryptography.X509Certificates; | ||
using System.Text.Json; | ||
|
||
namespace NovemberPirates.Utilities | ||
{ | ||
internal class SettingsManager | ||
{ | ||
private SettingsManager() { } | ||
|
||
internal static SettingsManager Instance = new(); | ||
|
||
internal Dictionary<SettingKeys, float> Settings = new(); | ||
|
||
internal void LoadSettings() | ||
{ | ||
if (File.Exists("settings.json")) | ||
{ | ||
try | ||
{ | ||
var settings = File.ReadAllText("settings.json"); | ||
Settings = JsonSerializer.Deserialize<Dictionary<SettingKeys, float>>(settings); | ||
} | ||
catch (Exception ex) | ||
{ | ||
Console.WriteLine($"Error: {ex.Message}"); | ||
} | ||
} | ||
else | ||
{ | ||
Settings.Add(SettingKeys.MainVolume, 0.5f); | ||
Settings.Add(SettingKeys.MusicVolume, 0.5f); | ||
Settings.Add(SettingKeys.SfxVolume, 0.5f); | ||
|
||
File.WriteAllText("settings.json", JsonSerializer.Serialize(Settings)); | ||
} | ||
} | ||
|
||
internal enum SettingKeys | ||
{ | ||
MainVolume, | ||
MusicVolume, | ||
SfxVolume, | ||
Language | ||
} | ||
} | ||
} |