This commit is contained in:
2023-03-02 22:07:43 +02:00
parent 1a0709d113
commit 5e48806b8c
21 changed files with 145 additions and 82 deletions

View File

@@ -16,15 +16,17 @@ namespace Game
set => dictionary[key] = value;
}
// This is for debugging only, remove this later
public string[] Commands;
public string[] GetLines()
{
string[] lines = new string[dictionary.Count];
string[] lines = new string[dictionary.Count + Commands.Length];
int lineIndex = 0;
foreach (var kvp in dictionary)
{
lines[lineIndex] = $"{kvp.Key} {kvp.Value}";
lineIndex++;
}
lines[lineIndex++] = $"{kvp.Key} {kvp.Value}";
foreach (var cmd in Commands)
lines[lineIndex++] = cmd;
return lines;
}

View File

@@ -1,4 +1,5 @@
using System.IO;
using System.Collections.Generic;
using System.IO;
namespace Game
{
@@ -20,6 +21,7 @@ namespace Game
/*using*/ FileStream file = File.OpenRead(path);
/*using*/ StreamReader sr = new StreamReader(file);
List<string> commands = new List<string>();
string line;
while ((line = sr.ReadLine()?.Trim()) != null)
{
@@ -28,7 +30,10 @@ namespace Game
int spacePos = line.IndexOf(' ');
if (spacePos == -1)
{
commands.Add(line);
continue;
}
string key = line.Substring(0, spacePos);
string value = line.Substring(spacePos+1);
@@ -38,6 +43,8 @@ namespace Game
config[key] = value;
}
config.Commands = commands.ToArray();
return config;
}
}

View File

@@ -24,20 +24,20 @@ namespace Game
//AssetManager.Init(); // TODO: move these elsewhere
#if !FLAX_EDITOR
Level.SceneLoaded += OnSceneLoaded;
Level.SceneLoading += OnSceneLoading;
#endif
}
public override void Deinitialize()
{
#if !FLAX_EDITOR
Level.SceneLoaded -= OnSceneLoaded;
Level.SceneLoading -= OnSceneLoading;
#endif
}
private void OnSceneLoaded(Scene scene, Guid guid)
private void OnSceneLoading(Scene scene, Guid guid)
{
Level.SceneLoaded -= OnSceneLoaded;
Level.SceneLoading -= OnSceneLoading;
LoadConfig();
}
@@ -78,7 +78,7 @@ namespace Game
//AssetManager.Init();
Level.SceneLoaded += OnSceneLoaded;
Level.SceneLoading += OnSceneLoading;
FlaxEditor.Editor.Instance.PlayModeBegin += OnPlayModeBegin;
FlaxEditor.Editor.Instance.PlayModeEnd += OnPlayModeEnd;
@@ -111,8 +111,8 @@ namespace Game
public override void Deinitialize()
{
Level.SceneLoaded -= OnSceneLoaded;
Level.SceneLoaded -= OnSceneLoaded;
//Level.SceneLoaded -= OnSceneLoaded;
Level.SceneLoading -= OnSceneLoading;
if (FlaxEditor.Editor.Instance != null)
{
FlaxEditor.Editor.Instance.PlayModeBegin -= OnPlayModeBegin;
@@ -120,10 +120,10 @@ namespace Game
}
}
private void OnSceneLoaded(Scene scene, Guid guid)
private void OnSceneLoading(Scene scene, Guid guid)
{
Level.SceneLoaded -= OnSceneLoaded;
Level.SceneLoaded -= OnSceneLoaded;
//Level.SceneLoaded -= OnSceneLoaded;
Level.SceneLoading -= OnSceneLoading;
LoadConfig();
}

View File

@@ -228,6 +228,7 @@ namespace Game
// hide console by default, and close it instantly
Console.Close();
OnConsoleClose();
Float2 rootlocation = rootControl.Control.Location;
rootlocation.Y = -rootControl.Control.Height;
rootControl.Control.Location = rootlocation;

View File

@@ -13,6 +13,7 @@ namespace Game
public enum UpscalingMode
{
None,
FSR2,
DLSS,
FSR1,
}