-
Notifications
You must be signed in to change notification settings - Fork 4
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
3 changed files
with
89 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
using FezEngine.Services; | ||
using FezEngine.Tools; | ||
using FEZUG.Features.Console; | ||
using Microsoft.Xna.Framework; | ||
using Microsoft.Xna.Framework.Audio; | ||
using System; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using System.Globalization; | ||
using System.Linq; | ||
using System.Reflection; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace FEZUG.Features | ||
{ | ||
internal class Timescaler : IFezugCommand | ||
{ | ||
public static float Timescale = 1.0f; | ||
|
||
public string Name => "timescale"; | ||
|
||
public string HelpText => "timescale <value> - changes game's simulation scale"; | ||
|
||
[ServiceDependency] | ||
public ISoundManager SoundManager { private get; set; } | ||
|
||
public List<string> Autocomplete(string[] args) | ||
{ | ||
string timescaleStr = Timescale.ToString("0.000", CultureInfo.InvariantCulture); | ||
if (timescaleStr.StartsWith(args[0])) return new List<string> { timescaleStr }; | ||
return null; | ||
} | ||
|
||
public bool Execute(string[] args) | ||
{ | ||
if (args.Length != 1) | ||
{ | ||
FezugConsole.Print($"Incorrect number of parameters: '{args.Length}'", FezugConsole.OutputType.Warning); | ||
return false; | ||
} | ||
|
||
if (!float.TryParse(args[0], NumberStyles.Number, CultureInfo.InvariantCulture, out float timescale)) | ||
{ | ||
FezugConsole.Print($"Incorrect timescale: '{args[0]}'", FezugConsole.OutputType.Warning); | ||
return false; | ||
} | ||
|
||
Timescale = timescale; | ||
|
||
FezugConsole.Print($"Timescale has been set to {Timescale.ToString("0.000", CultureInfo.InvariantCulture)}"); | ||
|
||
return true; | ||
} | ||
} | ||
} |
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