125 lines
3.0 KiB
C#
125 lines
3.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using FlaxEngine;
|
|
|
|
namespace Cabrito
|
|
{
|
|
// Holds Consol§e variables and commands to control engine behaviour and other common
|
|
public static class SystemCommands
|
|
{
|
|
[ConsoleCommand("")]
|
|
public static void NullCommand()
|
|
{
|
|
}
|
|
|
|
[ConsoleCommand("quit", "exit")]
|
|
public static void ExitCommand()
|
|
{
|
|
Engine.RequestExit();
|
|
}
|
|
|
|
[ConsoleCommand("echo")]
|
|
public static void EchoCommand()
|
|
{
|
|
Console.Print("nothing");
|
|
}
|
|
|
|
[ConsoleCommand("echo")]
|
|
public static void EchoCommand(string[] text)
|
|
{
|
|
Console.Print(string.Join(" ", text));
|
|
}
|
|
|
|
[ConsoleCommand("debuglog")]
|
|
public static void DebugLogCommand(string[] text)
|
|
{
|
|
Debug.Log(string.Join(" ", text));
|
|
}
|
|
|
|
[ConsoleCommand("debugthrow")]
|
|
public static void DebugThrowCommand(string[] text)
|
|
{
|
|
throw new Exception(string.Join(" ", text));
|
|
}
|
|
|
|
// TODO: this should manually set all postprocessing values to 0 or disabled
|
|
/*[ConsoleVariable("r_postprocessing")]
|
|
public static string PostProcessing
|
|
{
|
|
get
|
|
{
|
|
PostFxVolume postFx = Level.FindActor<PostFxVolume>();
|
|
if (postFx != null)
|
|
return postFx.CameraArtifacts.OverrideFlags.ToString();
|
|
return "";
|
|
}
|
|
set
|
|
{
|
|
bool valueBoolean = false;
|
|
if (int.TryParse(value, out int valueInt))
|
|
valueBoolean = valueInt != 0;
|
|
else
|
|
return;
|
|
|
|
PostFxVolume postFx = Level.FindActor<PostFxVolume>();
|
|
if (postFx != null)
|
|
{
|
|
var cameraArtifacts = postFx.CameraArtifacts;
|
|
cameraArtifacts.OverrideFlags = valueBoolean ? CameraArtifactsSettingsOverride.None : CameraArtifactsSettingsOverride.All;
|
|
postFx.CameraArtifacts = cameraArtifacts;
|
|
}
|
|
}
|
|
}*/
|
|
|
|
[ConsoleVariable("r_vignette")]
|
|
public static string Vignette
|
|
{
|
|
get
|
|
{
|
|
PostFxVolume postFx = Level.FindActor<PostFxVolume>();
|
|
if (postFx != null)
|
|
return postFx.CameraArtifacts.VignetteIntensity.ToString();
|
|
return "";
|
|
}
|
|
set
|
|
{
|
|
if (float.TryParse(value, out float valueFloat))
|
|
{
|
|
PostFxVolume postFx = Level.FindActor<PostFxVolume>();
|
|
if (postFx != null)
|
|
{
|
|
valueFloat = Mathf.Clamp(valueFloat, 0.0f, 2.0f);
|
|
|
|
var cameraArtifacts = postFx.CameraArtifacts;
|
|
cameraArtifacts.VignetteIntensity = valueFloat;
|
|
postFx.CameraArtifacts = cameraArtifacts;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
[ConsoleVariable("cl_maxfps")]
|
|
public static string MaxFps
|
|
{
|
|
get { return Time.UpdateFPS.ToString(); }
|
|
set
|
|
{
|
|
if (float.TryParse(value, out float valueFloat))
|
|
{
|
|
if (valueFloat <= 0.0f)
|
|
valueFloat = 0.0f;
|
|
else
|
|
valueFloat = Mathf.Clamp(valueFloat, 10f, 99999999999.0f);
|
|
|
|
if (Time.UpdateFPS != valueFloat)
|
|
Time.UpdateFPS = valueFloat;
|
|
if (Time.DrawFPS != valueFloat)
|
|
Time.DrawFPS = valueFloat;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |