r_lighting and gameplay globals
This commit is contained in:
BIN
Content/GameplayGlobals.flax
Normal file
BIN
Content/GameplayGlobals.flax
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -472,25 +472,34 @@ namespace Game
|
||||
|
||||
//Console.PrintDebug("Executed '" + execute + "' with params: '" + value + "'");
|
||||
|
||||
if (consoleCommands.TryGetValue(executeLower, out ConsoleCommand cmd))
|
||||
try
|
||||
{
|
||||
string[] values = strs.Skip(1).ToArray();
|
||||
if (values.Length > 0)
|
||||
cmd.Invoke(values);
|
||||
else
|
||||
cmd.Invoke();
|
||||
//Console.Print("Command bound to '" + execute + "' is '" + cmd.method.Name + "'");
|
||||
}
|
||||
else if (consoleVariables.TryGetValue(executeLower, out ConsoleVariable cvar))
|
||||
{
|
||||
if (value != null)
|
||||
cvar.SetValue(value);
|
||||
if (consoleCommands.TryGetValue(executeLower, out ConsoleCommand cmd))
|
||||
{
|
||||
string[] values = strs.Skip(1).ToArray();
|
||||
if (values.Length > 0)
|
||||
cmd.Invoke(values);
|
||||
else
|
||||
cmd.Invoke();
|
||||
//Console.Print("Command bound to '" + execute + "' is '" + cmd.method.Name + "'");
|
||||
}
|
||||
else if (consoleVariables.TryGetValue(executeLower, out ConsoleVariable cvar))
|
||||
{
|
||||
if (value != null)
|
||||
cvar.SetValue(value);
|
||||
|
||||
Console.Print("'" + execute + "' is '" + cvar.GetValueString() + "'");
|
||||
Console.Print("'" + execute + "' is '" + cvar.GetValueString() + "'");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.Print("Unknown command '" + execute + "'");
|
||||
}
|
||||
}
|
||||
else
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.Print("Unknown command '" + execute + "'");
|
||||
var message = e.InnerException != null ? e.InnerException.Message : e.Message;
|
||||
Console.Print("Command failed: " + message);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
@@ -63,14 +63,14 @@ namespace Game
|
||||
ServerAddress = "localhost";
|
||||
ConnectServer();
|
||||
}
|
||||
#if FLAX_EDITOR
|
||||
//#if FLAX_EDITOR
|
||||
else
|
||||
{
|
||||
StartServer();
|
||||
ServerAddress = "localhost";
|
||||
ConnectServer();
|
||||
}
|
||||
#endif
|
||||
//#endif
|
||||
|
||||
initialized = true;
|
||||
#if FLAX_EDITOR
|
||||
|
||||
Reference in New Issue
Block a user