dotnet7 compat, DLSS, network manager rewrite and other fixes

This commit is contained in:
2023-01-27 16:24:11 +02:00
parent 36c09efac0
commit 51dcad2cc4
54 changed files with 767 additions and 821 deletions

View File

@@ -17,7 +17,8 @@ namespace Game
public static GameplayGlobals Globals { get; private set; }
public static Config Config { get; private set; }
public static void Init()
//public static void Init()
static AssetManager()
{
Globals = Content.Load<GameplayGlobals>(Path.Combine(ContentPath, "Settings", "GameSettings", "GameplayGlobals.flax"));
Config = ConfigParser.ParseFile(Path.Combine(ContentPath, "config.cfg"));

View File

@@ -1,164 +0,0 @@
using System;
using System.Linq;
using FlaxEngine;
using Debug = System.Diagnostics.Debug;
#if FLAX_EDITOR
using FlaxEditor;
#endif
namespace Game
{
/// <summary>
/// Wrapper for GamePlugin with support of initializing plugins in correct order.
/// The initialization is deferred to later time after the last dependant plugin is initialized.
/// </summary>
public abstract class GGamePlugin : GamePlugin
{
public virtual Type[] PluginDependencies { get => new Type[0]; }
public bool Initialized { get; private set; }
public bool Deinitialized { get; private set; }
public override void Initialize()
{
//FlaxEngine.Debug.Log($"Plugin {this.GetType()}::Initialize");
base.Initialize();
if (!Initialized)
{
// Check if dependencies have been initialized, defer to later if not
bool dependenciesInitialized = true;
var plugins = PluginManager.GamePlugins.OfType<GGamePlugin>().Where(x => x.GetType() != this.GetType());
foreach (var pluginType in PluginDependencies)
{
//FlaxEngine.Debug.Log($"Plugintype {pluginType}");
var plugin = plugins.FirstOrDefault(x => x.GetType() == pluginType);
if (plugin != null)
{
//FlaxEngine.Debug.Log($"Plugin {plugin.GetType()} is Initialized?");
if (!plugin.Initialized)
{
dependenciesInitialized = false;
break;
}
}
else
{
dependenciesInitialized = false;
break;
}
}
if (dependenciesInitialized)
{
Init();
Initialized = true;
// Initialize any previously deferred plugins in case their dependencies were initialized
foreach (var p in plugins)
{
//FlaxEngine.Debug.Log($"try init Plugin {p.GetType()}");
if (!p.Initialized /* && p.PluginDependencies.Contains(this.GetType())*/)
{
//FlaxEngine.Debug.Log($"Plugin run init {p.GetType()}");
p.Initialize();
}
}
}
}
}
public override void Deinitialize()
{
base.Deinitialize();
if (!Deinitialized)
{
Deinit();
Deinitialized = true;
}
}
public virtual void Init()
{
}
public virtual void Deinit()
{
}
}
#if FLAX_EDITOR
/// <summary>
/// Wrapper for EditorPlugin with support of initializing plugins in correct order.
/// The initialization is deferred to later time after the last dependant plugin is initialized.
/// </summary>
public abstract class GEditorPlugin : EditorPlugin
{
public virtual Type[] PluginDependencies { get => new Type[0]; }
public bool Initialized { get; private set; }
public bool Deinitialized { get; private set; }
public override void Initialize()
{
//FlaxEngine.Debug.Log($"Plugin {this.GetType()}::Initialize");
base.Initialize();
if (!Initialized)
{
// Check if dependencies have been initialized, defer to later if not
bool dependenciesInitialized = true;
var plugins = PluginManager.EditorPlugins.OfType<GEditorPlugin>().Where(x => x.GetType() != this.GetType());
foreach (var pluginType in PluginDependencies)
{
//FlaxEngine.Debug.Log($"Plugintype {pluginType}");
var plugin = plugins.FirstOrDefault(x => x.GetType() == pluginType);
if (plugin != null)
{
//FlaxEngine.Debug.Log($"Plugin {plugin.GetType()} is Initialized?");
if (!plugin.Initialized)
{
dependenciesInitialized = false;
break;
}
}
else
{
dependenciesInitialized = false;
break;
}
}
if (dependenciesInitialized)
{
Init();
Initialized = true;
// Initialize any previously deferred plugins in case their dependencies were initialized
foreach (var p in plugins)
{
//FlaxEngine.Debug.Log($"try init Plugin {p.GetType()}");
if (!p.Initialized /* && p.PluginDependencies.Contains(this.GetType())*/)
{
//FlaxEngine.Debug.Log($"Plugin run init {p.GetType()}");
p.Initialize();
}
}
}
}
}
public override void Deinitialize()
{
base.Deinitialize();
if (!Deinitialized)
{
Deinit();
Deinitialized = true;
}
}
public virtual void Init()
{
}
public virtual void Deinit()
{
}
}
#endif
}