Near V1.0

This commit is contained in:
2026-02-08 12:57:20 -05:00
parent 6032a04ad9
commit e987c8092f
11 changed files with 82 additions and 48 deletions

View File

@@ -8,7 +8,7 @@ using Awperative.Kernel.Communication.Config;
namespace Awperative; namespace Awperative;
public static partial class Debugger public static partial class Debug
{ {

View File

@@ -5,13 +5,63 @@ using System.IO;
namespace Awperative; namespace Awperative;
public static partial class Debugger public static partial class Debug
{ {
/// <summary> /// <summary>
/// Writes the current message to the log file. /// Writes the current message to the log file.
/// </summary> /// </summary>
/// <param name="__message"> Message to debug</param> /// <param name="__message"> Message to debug</param>
public static void DebugState(string __message) => DebugGeneric(__message, "STA"); public static void LogState(string __message) => LogGeneric(__message, "STA", [], []);
/// <summary>
/// Writes the current message to the log file. With any given call sign.
/// </summary>
/// <param name="__message"> Message to debug</param>
/// <param name="__parameters"> Names of values to debug</param>
/// <param name="__values"> Values to debug</param>
public static void LogState(string __message, string[] __parameters, string[] __values) => LogGeneric(__message, "STA", __parameters, __values);
/// <summary>
/// Writes the current message to the log file.
/// </summary>
/// <param name="__message"> Message to debug</param>
public static void LogValue(string __message) => LogGeneric(__message, "VAL", [], []);
/// <summary>
/// Writes the current message to the log file. With any given call sign.
/// </summary>
/// <param name="__message"> Message to debug</param>
/// <param name="__parameters"> Names of values to debug</param>
/// <param name="__values"> Values to debug</param>
public static void LogValue(string __message, string[] __parameters, string[] __values) => LogGeneric(__message, "VAL", __parameters, __values);
/// <summary>
/// Writes the current message to the log file.
/// </summary>
/// <param name="__message"> Message to debug</param>
public static void LogWarning(string __message) => LogGeneric(__message, "WAR", [], []);
/// <summary>
/// Writes the current message to the log file. With any given call sign.
/// </summary>
/// <param name="__message"> Message to debug</param>
/// <param name="__parameters"> Names of values to debug</param>
/// <param name="__values"> Values to debug</param>
public static void LogWarning(string __message, string[] __parameters, string[] __values) => LogGeneric(__message, "WAR", __parameters, __values);
@@ -21,37 +71,17 @@ public static partial class Debugger
/// Writes the current message to the log file. /// Writes the current message to the log file.
/// </summary> /// </summary>
/// <param name="__message"> Message to debug</param> /// <param name="__message"> Message to debug</param>
public static void DebugValue(string __message) => DebugGeneric(__message, "VAL"); public static void LogError(string __message) => LogGeneric(__message, "ERR", [], []);
/// <summary> /// <summary>
/// Writes the current message to the log file. /// Writes the current message to the log file. With any given call sign.
/// </summary> /// </summary>
/// <param name="__message"> Message to debug</param> /// <param name="__message"> Message to debug</param>
public static void DebugLog(string __message) => DebugGeneric(__message, "LOG"); /// <param name="__parameters"> Names of values to debug</param>
/// <param name="__values"> Values to debug</param>
public static void LogError(string __message, string[] __parameters, string[] __values) => LogGeneric(__message, "ERR", __parameters, __values);
/// <summary>
/// Writes the current message to the log file.
/// </summary>
/// <param name="__message"> Message to debug</param>
public static void DebugWarning(string __message) => DebugGeneric(__message, "WAR");
/// <summary>
/// Writes the current message to the log file.
/// </summary>
/// <param name="__message"> Message to debug</param>
public static void DebugError(string __message) => DebugGeneric(__message, "ERR");
@@ -62,7 +92,14 @@ public static partial class Debugger
/// </summary> /// </summary>
/// <param name="__message"> Message to debug</param> /// <param name="__message"> Message to debug</param>
/// <param name="__callSign"> Message identifier</param> /// <param name="__callSign"> Message identifier</param>
public static void DebugGeneric(string __message, string __callSign) { /// <param name="__parameters"> Names of values to debug</param>
File.AppendAllText(LogFilePath, "\n\n" + __callSign + "- \"" + __message + "\"\n STK-" + new StackTrace()); /// <param name="__values"> Values to debug</param>
public static void LogGeneric(string __message, string __callSign, string[] __parameters, string[] __values) {
string output = "\n\n" + __callSign + "- \"" + __message + "\"\n STK-" + new StackTrace();
for (int i = 0; i < __parameters.Length || i < __values.Length; i++)
output += "\n " + __parameters[i] + "- " + __values[i];
File.AppendAllText(LogFilePath, output);
} }
} }

View File

@@ -8,19 +8,16 @@ public sealed partial class Body
{ {
public Generic AddComponent<Generic>(object[] args) where Generic : Component { public Generic AddComponent<Generic>(object[] args) where Generic : Component {
if (SingletonExists<Generic>()) { Debug.LogError("Cannot add component when singleton exists!"); return null; }
if (SingletonExists<Generic>())
throw new Exception("Cannot add component when singleton exists!");
Generic component = (Generic) Activator.CreateInstance(typeof(Generic), args); Generic component = (Generic) Activator.CreateInstance(typeof(Generic), args);
if(component == null) if (component == null) { Debug.LogError("Failed to create component!"); return null; }
throw new Exception("Failed to create component!");
_components.Add(component);
components.Add(component);
component.Initiate(this); component.Initiate(this);
ComponentCreatedEvent?.Invoke(this, new ComponentCreateEvent(component, this, scene)); ComponentCreatedEvent?.Invoke(this, new ComponentCreateEvent(component, this, Scene));
return component; return component;
} }

View File

@@ -5,6 +5,6 @@ namespace Awperative;
public sealed partial class Scene public sealed partial class Scene
{ {
//todo: add scene.destroy in v5 //todo: add scene.destroy in v5
} }

View File

@@ -60,7 +60,7 @@
"privateAssets": "all" "privateAssets": "all"
} }
}, },
"runtimeIdentifierGraphPath": "/usr/lib/dotnet/sdk/8.0.122/PortableRuntimeIdentifierGraph.json" "runtimeIdentifierGraphPath": "/usr/lib/dotnet/sdk/8.0.123/PortableRuntimeIdentifierGraph.json"
} }
} }
} }

View File

@@ -13,7 +13,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Awperative")] [assembly: System.Reflection.AssemblyCompanyAttribute("Awperative")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+6370a70e77e58afd49c5270eea3656796c8a8b60")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+6032a04ad97895ae66261315ee00dc458991fddb")]
[assembly: System.Reflection.AssemblyProductAttribute("Awperative")] [assembly: System.Reflection.AssemblyProductAttribute("Awperative")]
[assembly: System.Reflection.AssemblyTitleAttribute("Awperative")] [assembly: System.Reflection.AssemblyTitleAttribute("Awperative")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

View File

@@ -1 +1 @@
65f076e2a35d39f7816008dc38aa7c8c9fe617c292f8f16923e08f8a886186cf b425b3bf0701917a4ebea9a237727c5966a9c5c39530e5ed5a453056bfdf1602

View File

@@ -331,7 +331,7 @@
"privateAssets": "all" "privateAssets": "all"
} }
}, },
"runtimeIdentifierGraphPath": "/usr/lib/dotnet/sdk/8.0.122/PortableRuntimeIdentifierGraph.json" "runtimeIdentifierGraphPath": "/usr/lib/dotnet/sdk/8.0.123/PortableRuntimeIdentifierGraph.json"
} }
} }
} }

View File

@@ -1,6 +1,6 @@
{ {
"version": 2, "version": 2,
"dgSpecHash": "R13j3OnnaSw=", "dgSpecHash": "oHHZKOBBLTE=",
"success": true, "success": true,
"projectFilePath": "/home/avery/Programming/Awperative/Awperative/Awperative.csproj", "projectFilePath": "/home/avery/Programming/Awperative/Awperative/Awperative.csproj",
"expectedPackageFiles": [ "expectedPackageFiles": [

View File

@@ -1 +1 @@
"restore":{"projectUniqueName":"/home/avery/Programming/Awperative/Awperative/Awperative.csproj","projectName":"Awperative","projectPath":"/home/avery/Programming/Awperative/Awperative/Awperative.csproj","outputPath":"/home/avery/Programming/Awperative/Awperative/obj/","projectStyle":"PackageReference","originalTargetFrameworks":["net8.0"],"sources":{"https://api.nuget.org/v3/index.json":{}},"frameworks":{"net8.0":{"targetAlias":"net8.0","projectReferences":{}}},"warningProperties":{"warnAsError":["NU1605"]}}"frameworks":{"net8.0":{"targetAlias":"net8.0","dependencies":{"MonoGame.Framework.DesktopGL":{"suppressParent":"All","target":"Package","version":"[3.8.*, )"}},"imports":["net461","net462","net47","net471","net472","net48","net481"],"assetTargetFallback":true,"warn":true,"frameworkReferences":{"Microsoft.NETCore.App":{"privateAssets":"all"}},"runtimeIdentifierGraphPath":"/usr/lib/dotnet/sdk/8.0.122/PortableRuntimeIdentifierGraph.json"}} "restore":{"projectUniqueName":"/home/avery/Programming/Awperative/Awperative/Awperative.csproj","projectName":"Awperative","projectPath":"/home/avery/Programming/Awperative/Awperative/Awperative.csproj","outputPath":"/home/avery/Programming/Awperative/Awperative/obj/","projectStyle":"PackageReference","originalTargetFrameworks":["net8.0"],"sources":{"https://api.nuget.org/v3/index.json":{}},"frameworks":{"net8.0":{"targetAlias":"net8.0","projectReferences":{}}},"warningProperties":{"warnAsError":["NU1605"]}}"frameworks":{"net8.0":{"targetAlias":"net8.0","dependencies":{"MonoGame.Framework.DesktopGL":{"suppressParent":"All","target":"Package","version":"[3.8.*, )"}},"imports":["net461","net462","net47","net471","net472","net48","net481"],"assetTargetFallback":true,"warn":true,"frameworkReferences":{"Microsoft.NETCore.App":{"privateAssets":"all"}},"runtimeIdentifierGraphPath":"/usr/lib/dotnet/sdk/8.0.123/PortableRuntimeIdentifierGraph.json"}}

View File

@@ -1 +1 @@
17688491570718218 17701648299693068