dotnet7 compat, DLSS, network manager rewrite and other fixes
This commit is contained in:
@@ -1,13 +1,58 @@
|
||||
using System;
|
||||
using FlaxEngine;
|
||||
using Console = Game.Console;
|
||||
using System.Linq;
|
||||
#if FLAX_EDITOR
|
||||
using FlaxEditor;
|
||||
#endif
|
||||
|
||||
namespace Game
|
||||
{
|
||||
public class ConsolePlugin : GGamePlugin
|
||||
public class ConsolePlugin : GamePlugin
|
||||
{
|
||||
public ConsolePlugin()
|
||||
{
|
||||
#if FLAX_EDITOR
|
||||
_description = ConsoleEditorPlugin.DescriptionInternal;
|
||||
#endif
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
//FlaxEngine.Debug.Log("ConsolePlugin initialized");
|
||||
Console.Init();
|
||||
|
||||
//AssetManager.Init(); // TODO: move these elsewhere
|
||||
#if !FLAX_EDITOR
|
||||
Level.SceneLoaded += OnSceneLoaded;
|
||||
#endif
|
||||
}
|
||||
|
||||
public override void Deinitialize()
|
||||
{
|
||||
#if !FLAX_EDITOR
|
||||
Level.SceneLoaded -= OnSceneLoaded;
|
||||
#endif
|
||||
}
|
||||
|
||||
private void OnSceneLoaded(Scene scene, Guid guid)
|
||||
{
|
||||
Level.SceneLoaded -= OnSceneLoaded;
|
||||
LoadConfig();
|
||||
}
|
||||
|
||||
private void LoadConfig()
|
||||
{
|
||||
Console.Print("Loading config file (GamePlugin)");
|
||||
AssetManager.Globals.ResetValues();
|
||||
|
||||
foreach (var line in AssetManager.Config.GetLines())
|
||||
Console.Execute(line, false, true);
|
||||
}
|
||||
}
|
||||
|
||||
#if FLAX_EDITOR
|
||||
public class ConsoleEditorPlugin : EditorPlugin
|
||||
{
|
||||
public static PluginDescription DescriptionInternal = new PluginDescription
|
||||
{
|
||||
@@ -19,49 +64,25 @@ namespace Game
|
||||
Category = "Game"
|
||||
};
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
//FlaxEngine.Debug.Log("ConsolePlugin initialized");
|
||||
Console.Init();
|
||||
|
||||
AssetManager.Init(); // TODO: move these elsewhere
|
||||
|
||||
//Level.SceneLoaded += LoadConfig;
|
||||
}
|
||||
|
||||
public override void Deinit()
|
||||
{
|
||||
//Level.SceneLoaded -= LoadConfig;
|
||||
}
|
||||
|
||||
private void LoadConfig(Scene scene, Guid guid)
|
||||
{
|
||||
Console.Print("Loading config file");
|
||||
AssetManager.Globals.ResetValues();
|
||||
|
||||
foreach (var line in AssetManager.Config.GetLines())
|
||||
Console.Execute(line, false, true);
|
||||
}
|
||||
}
|
||||
|
||||
#if FLAX_EDITOR
|
||||
public class ConsoleEditorPlugin : GEditorPlugin
|
||||
{
|
||||
public override Type GamePluginType => typeof(ConsolePlugin);
|
||||
|
||||
public ConsoleEditorPlugin()
|
||||
{
|
||||
_description = ConsolePlugin.DescriptionInternal;
|
||||
_description = DescriptionInternal;
|
||||
}
|
||||
|
||||
public override void Init()
|
||||
public override void Initialize()
|
||||
{
|
||||
//FlaxEngine.Debug.Log("ConsolePlugin initialized");
|
||||
Console.Init();
|
||||
|
||||
AssetManager.Init();
|
||||
//AssetManager.Init();
|
||||
|
||||
Level.SceneLoaded += LoadConfig;
|
||||
Level.SceneLoaded += OnSceneLoaded;
|
||||
|
||||
FlaxEditor.Editor.Instance.PlayModeBegin += OnPlayModeBegin;
|
||||
FlaxEditor.Editor.Instance.PlayModeEnd += OnPlayModeEnd;
|
||||
//Scripting.Exit += OnScriptingExit;
|
||||
|
||||
/*AssetManager.Init(); // TODO: move these elsewhere
|
||||
AssetManager.Globals.ResetValues();
|
||||
@@ -70,20 +91,51 @@ namespace Game
|
||||
Console.Execute(line, false, true);*/
|
||||
}
|
||||
|
||||
public override void Deinit()
|
||||
/*private void OnScriptingExit()
|
||||
{
|
||||
Level.SceneLoaded -= LoadConfig;
|
||||
FlaxEditor.Editor.Instance.PlayModeBegin -= OnPlayModeBegin;
|
||||
FlaxEditor.Editor.Instance.PlayModeEnd -= OnPlayModeEnd;
|
||||
}*/
|
||||
|
||||
private void OnPlayModeBegin()
|
||||
{
|
||||
//FlaxEditor.Editor.Instance.PlayModeBegin -= Instance_PlayModeBegin;
|
||||
LoadConfig();
|
||||
GameMode.StartServer(true);
|
||||
}
|
||||
|
||||
private void LoadConfig(Scene scene, Guid guid)
|
||||
private void OnPlayModeEnd()
|
||||
{
|
||||
Console.Print("Loading config file");
|
||||
GameMode.StopServer();
|
||||
}
|
||||
|
||||
public override void Deinitialize()
|
||||
{
|
||||
Level.SceneLoaded -= OnSceneLoaded;
|
||||
Level.SceneLoaded -= OnSceneLoaded;
|
||||
if (FlaxEditor.Editor.Instance != null)
|
||||
{
|
||||
FlaxEditor.Editor.Instance.PlayModeBegin -= OnPlayModeBegin;
|
||||
FlaxEditor.Editor.Instance.PlayModeEnd -= OnPlayModeEnd;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnSceneLoaded(Scene scene, Guid guid)
|
||||
{
|
||||
Level.SceneLoaded -= OnSceneLoaded;
|
||||
Level.SceneLoaded -= OnSceneLoaded;
|
||||
LoadConfig();
|
||||
}
|
||||
|
||||
private void LoadConfig()
|
||||
{
|
||||
Console.Print("Loading config file (EditorPlugin)");
|
||||
|
||||
AssetManager.Globals.ResetValues();
|
||||
|
||||
foreach (var line in AssetManager.Config.GetLines())
|
||||
Console.Execute(line, false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
Reference in New Issue
Block a user