Kinda save settings
This commit is contained in:
Binary file not shown.
Binary file not shown.
+7
-1
@@ -3,18 +3,24 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
|||||||
# Visual Studio Version 16
|
# Visual Studio Version 16
|
||||||
VisualStudioVersion = 16.0.30907.101
|
VisualStudioVersion = 16.0.30907.101
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EvilSatellites", "EvilSatellites\EvilSatellites.csproj", "{48DE0A06-5D79-4EB1-B16A-4807A15AEBD0}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EvilSatellites", "EvilSatellites\EvilSatellites.csproj", "{48DE0A06-5D79-4EB1-B16A-4807A15AEBD0}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Debug|x86 = Debug|x86
|
||||||
Release|Any CPU = Release|Any CPU
|
Release|Any CPU = Release|Any CPU
|
||||||
|
Release|x86 = Release|x86
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{48DE0A06-5D79-4EB1-B16A-4807A15AEBD0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{48DE0A06-5D79-4EB1-B16A-4807A15AEBD0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{48DE0A06-5D79-4EB1-B16A-4807A15AEBD0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{48DE0A06-5D79-4EB1-B16A-4807A15AEBD0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{48DE0A06-5D79-4EB1-B16A-4807A15AEBD0}.Debug|x86.ActiveCfg = Debug|x86
|
||||||
|
{48DE0A06-5D79-4EB1-B16A-4807A15AEBD0}.Debug|x86.Build.0 = Debug|x86
|
||||||
{48DE0A06-5D79-4EB1-B16A-4807A15AEBD0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{48DE0A06-5D79-4EB1-B16A-4807A15AEBD0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{48DE0A06-5D79-4EB1-B16A-4807A15AEBD0}.Release|Any CPU.Build.0 = Release|Any CPU
|
{48DE0A06-5D79-4EB1-B16A-4807A15AEBD0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{48DE0A06-5D79-4EB1-B16A-4807A15AEBD0}.Release|x86.ActiveCfg = Release|x86
|
||||||
|
{48DE0A06-5D79-4EB1-B16A-4807A15AEBD0}.Release|x86.Build.0 = Release|x86
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net5.0</TargetFramework>
|
||||||
<PublishReadyToRun>false</PublishReadyToRun>
|
<PublishReadyToRun>false</PublishReadyToRun>
|
||||||
<TieredCompilation>false</TieredCompilation>
|
<TieredCompilation>false</TieredCompilation>
|
||||||
|
<Platforms>AnyCPU;x86</Platforms>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||||
@@ -12,6 +13,9 @@
|
|||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||||
<OutputPath></OutputPath>
|
<OutputPath></OutputPath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x86'">
|
||||||
|
<OutputPath />
|
||||||
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Remove="Icon.ico" />
|
<None Remove="Icon.ico" />
|
||||||
<None Remove="Icon.bmp" />
|
<None Remove="Icon.bmp" />
|
||||||
|
|||||||
@@ -3,13 +3,61 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
namespace EvilSatellites
|
namespace EvilSatellites
|
||||||
{
|
{
|
||||||
public static class GameSettings
|
public static class GameSettings
|
||||||
{
|
{
|
||||||
|
public static string SettingsDirectory = Environment.SpecialFolder.Personal + "/EvilSatellites";
|
||||||
|
public static string SettingsFile = SettingsDirectory + "/settings.dat";
|
||||||
public static bool PreferSAPI = true;
|
public static bool PreferSAPI = true;
|
||||||
public static bool UseForceFeedback = true;
|
public static bool UseForceFeedback = true;
|
||||||
public static bool EnableAI = true;
|
public static bool EnableAI = true;
|
||||||
|
|
||||||
|
public static void SaveSettings()
|
||||||
|
{
|
||||||
|
if (!Directory.Exists(SettingsDirectory))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(SettingsDirectory);
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var file = new BinaryWriter(File.Open(SettingsFile, FileMode.Create));
|
||||||
|
file.Write(PreferSAPI);
|
||||||
|
file.Write(UseForceFeedback);
|
||||||
|
file.Write(EnableAI);
|
||||||
|
file.Close();
|
||||||
|
} catch (Exception e)
|
||||||
|
{
|
||||||
|
DavyKager.Tolk.Output("Error saving settings: " + e.Message);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ReadSettings()
|
||||||
|
{
|
||||||
|
if (!Directory.Exists(SettingsDirectory))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!File.Exists(SettingsFile))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var file = new BinaryReader(File.OpenRead(SettingsFile));
|
||||||
|
PreferSAPI = file.ReadBoolean();
|
||||||
|
UseForceFeedback = file.ReadBoolean();
|
||||||
|
EnableAI = file.ReadBoolean();
|
||||||
|
file.Close();
|
||||||
|
} catch (Exception e)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,6 +80,7 @@ namespace EvilSatellites.Objects
|
|||||||
sfxTaps.Destroy();
|
sfxTaps.Destroy();
|
||||||
sfxElevator.Destroy();
|
sfxElevator.Destroy();
|
||||||
sfxDamage.Destroy();
|
sfxDamage.Destroy();
|
||||||
|
CurrentWeapon.Destroy();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
override public void Update(GameTime gameTime)
|
override public void Update(GameTime gameTime)
|
||||||
@@ -109,19 +110,19 @@ namespace EvilSatellites.Objects
|
|||||||
Move(Movement);
|
Move(Movement);
|
||||||
if (Turning == -1)
|
if (Turning == -1)
|
||||||
{
|
{
|
||||||
RotateY(0.035f);
|
RotateY(0.025f);
|
||||||
}
|
}
|
||||||
if (Turning == 1)
|
if (Turning == 1)
|
||||||
{
|
{
|
||||||
RotateY(-0.035f);
|
RotateY(-0.025f);
|
||||||
}
|
}
|
||||||
if (Elevating == -1)
|
if (Elevating == -1)
|
||||||
{
|
{
|
||||||
RotateX(-0.035f);
|
RotateX(-0.025f);
|
||||||
}
|
}
|
||||||
if (Elevating == 1)
|
if (Elevating == 1)
|
||||||
{
|
{
|
||||||
RotateX(0.035f);
|
RotateX(0.025f);
|
||||||
}
|
}
|
||||||
sfxEngine.Pitch = 0.5 + (Movement.Length() / MaxSpeed.Length()) * 4;
|
sfxEngine.Pitch = 0.5 + (Movement.Length() / MaxSpeed.Length()) * 4;
|
||||||
sfxWhine.Pitch = 0.5 + (Movement.Length() / MaxSpeed.Length()) * 1;
|
sfxWhine.Pitch = 0.5 + (Movement.Length() / MaxSpeed.Length()) * 1;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ namespace EvilSatellites
|
|||||||
[STAThread]
|
[STAThread]
|
||||||
static void Main()
|
static void Main()
|
||||||
{
|
{
|
||||||
|
GameSettings.ReadSettings();
|
||||||
DavyKager.Tolk.Load();
|
DavyKager.Tolk.Load();
|
||||||
if (GameSettings.PreferSAPI)
|
if (GameSettings.PreferSAPI)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace EvilSatellites.Screens
|
|||||||
public virtual void Activate()
|
public virtual void Activate()
|
||||||
{
|
{
|
||||||
CursorPosition = 0;
|
CursorPosition = 0;
|
||||||
Tolk.Output(MenuOptions.Title, true);
|
Tolk.Output(MenuOptions.Title, false);
|
||||||
Tolk.Output(MenuOptions.Description, false);
|
Tolk.Output(MenuOptions.Description, false);
|
||||||
Tolk.Output(MenuOptions.Entries[CursorPosition].Name);
|
Tolk.Output(MenuOptions.Entries[CursorPosition].Name);
|
||||||
Manager.Sound.PlayOneshot(@"sfx/ui/menuOpen.wav");
|
Manager.Sound.PlayOneshot(@"sfx/ui/menuOpen.wav");
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ namespace EvilSatellites.Screens
|
|||||||
}
|
}
|
||||||
if (CursorPosition == 4)
|
if (CursorPosition == 4)
|
||||||
{
|
{
|
||||||
|
GameSettings.SaveSettings();
|
||||||
Manager.RemoveScreen(this);
|
Manager.RemoveScreen(this);
|
||||||
Manager.AddScreen(new MainMenuScreen());
|
Manager.AddScreen(new MainMenuScreen());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,5 +30,6 @@ namespace EvilSatellites.Weapons
|
|||||||
public virtual void Stop() { }
|
public virtual void Stop() { }
|
||||||
public virtual void Update(GameTime time) { }
|
public virtual void Update(GameTime time) { }
|
||||||
public abstract void Reload(int amount);
|
public abstract void Reload(int amount);
|
||||||
|
public abstract void Destroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,5 +18,6 @@ namespace EvilSatellites.Weapons
|
|||||||
int MaxAmmo { get; set; }
|
int MaxAmmo { get; set; }
|
||||||
int RemainingAmmo { get; set; }
|
int RemainingAmmo { get; set; }
|
||||||
WeaponState State { get; set; }
|
WeaponState State { get; set; }
|
||||||
|
void Destroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -130,5 +130,15 @@ namespace EvilSatellites.Weapons
|
|||||||
sfxReload.Play();
|
sfxReload.Play();
|
||||||
Screen.Manager.Vibrations.AddVibration(1, 1, 500);
|
Screen.Manager.Vibrations.AddVibration(1, 1, 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Destroy()
|
||||||
|
{
|
||||||
|
sfxEmpty.Destroy();
|
||||||
|
sfxReload.Destroy();
|
||||||
|
sfxShoot.Destroy();
|
||||||
|
sfxSpindown.Destroy();
|
||||||
|
sfxSpinning.Destroy();
|
||||||
|
sfxSpinup.Destroy();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user