r_lighting and gameplay globals
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using FidelityFX;
|
||||
using FlaxEngine;
|
||||
|
||||
@@ -189,6 +190,48 @@ namespace Game
|
||||
}
|
||||
}
|
||||
|
||||
[ConsoleVariable("r_lighting")]
|
||||
public static string SceneLighting
|
||||
{
|
||||
get
|
||||
{
|
||||
string workDir = Directory.GetCurrentDirectory();
|
||||
string matBasePath = Path.Combine(workDir, "Content");
|
||||
string assetPath = Path.Combine(matBasePath, "GameplayGlobals.flax");
|
||||
//40caea634c3e619b7c35588f1cbdb967
|
||||
|
||||
GameplayGlobals globals;
|
||||
globals = Content.GetAsset(assetPath) as GameplayGlobals;
|
||||
if (globals == null)
|
||||
globals = Content.Load<GameplayGlobals>(assetPath);
|
||||
|
||||
//globals = Content.GetAsset(assetPath) as GameplayGlobals;
|
||||
//GameplayGlobals globals = Content..GetAsset(new Guid("40caea634c3e619b7c35588f1cbdb967")) as GameplayGlobals;
|
||||
|
||||
return ((bool)globals.GetValue("Scene Lighting") ? "1" : "0");
|
||||
}
|
||||
set
|
||||
{
|
||||
string workDir = Directory.GetCurrentDirectory();
|
||||
string matBasePath = Path.Combine(workDir, "Content");
|
||||
string assetPath = Path.Combine(matBasePath, "GameplayGlobals.flax");
|
||||
//GameplayGlobals globals = Content.GetAsset(assetPath) as GameplayGlobals;
|
||||
//GameplayGlobals globals = Content.GetAsset(new Guid("40caea634c3e619b7c35588f1cbdb967")) as GameplayGlobals;
|
||||
GameplayGlobals globals;
|
||||
globals = Content.GetAsset(assetPath) as GameplayGlobals;
|
||||
if (globals == null)
|
||||
globals = Content.Load<GameplayGlobals>(assetPath);
|
||||
|
||||
bool boolValue = false;
|
||||
if (int.TryParse(value, out int intValue))
|
||||
boolValue = intValue != 0;
|
||||
else if (float.TryParse(value, out float valueFloat))
|
||||
boolValue = valueFloat != 0f;
|
||||
|
||||
globals.SetValue("Scene Lighting", boolValue);
|
||||
}
|
||||
}
|
||||
|
||||
[ConsoleSubsystemInitializer]
|
||||
public static void Initialize()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user