mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 21:01:52 +00:00
Moved SerializationType and Object to separate files
This commit is contained in:
@@ -4,6 +4,7 @@ using System.IO;
|
||||
using System.Collections;
|
||||
using GlitchyEngine.Core;
|
||||
using GlitchyEngine.Math;
|
||||
using GlitchyEngine.Serialization;
|
||||
using GlitchyEngine.World;
|
||||
using System.Diagnostics;
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ using GlitchyEngine.Core;
|
||||
using System.Collections;
|
||||
using Box2D;
|
||||
using GlitchyEngine.Scripting;
|
||||
using GlitchyEngine.Serialization;
|
||||
|
||||
namespace GlitchyEngine.Scripting;
|
||||
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
using GlitchyEngine.Core;
|
||||
using System;
|
||||
|
||||
namespace GlitchyEngine.Serialization;
|
||||
|
||||
public enum SerializationType : int32
|
||||
{
|
||||
case None;
|
||||
|
||||
case Bool;
|
||||
|
||||
case Char;
|
||||
case String;
|
||||
|
||||
case Int8;
|
||||
case Int16;
|
||||
case Int32;
|
||||
case Int64;
|
||||
case UInt8;
|
||||
case UInt16;
|
||||
case UInt32;
|
||||
case UInt64;
|
||||
|
||||
case Float;
|
||||
case Double;
|
||||
case Decimal;
|
||||
|
||||
case Enum;
|
||||
|
||||
case EntityReference;
|
||||
case ComponentReference;
|
||||
|
||||
case ObjectReference;
|
||||
|
||||
public int GetSize()
|
||||
{
|
||||
switch (this)
|
||||
{
|
||||
case .Bool:
|
||||
return 1;
|
||||
case .Char:
|
||||
return 1;
|
||||
case .Int8, .UInt8:
|
||||
return 1;
|
||||
case .Int16, .UInt16:
|
||||
return 2;
|
||||
case .Int32, .UInt32:
|
||||
return 4;
|
||||
case .Int64, .UInt64:
|
||||
return 8;
|
||||
case .Float:
|
||||
return 4;
|
||||
case .Double:
|
||||
return 8;
|
||||
case .Decimal:
|
||||
return 16;
|
||||
case .EntityReference, .ComponentReference, .ObjectReference:
|
||||
return sizeof(UUID);
|
||||
case .String:
|
||||
return sizeof(StringView);
|
||||
case .Enum:
|
||||
return sizeof(StringView);
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
+5
-67
@@ -1,72 +1,10 @@
|
||||
using Mono;
|
||||
using System.Collections;
|
||||
using System;
|
||||
using GlitchyEngine.Core;
|
||||
using GlitchyEngine.Scripting;
|
||||
using Mono;
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
namespace GlitchyEngine.Scripting;
|
||||
|
||||
public enum SerializationType : int32
|
||||
{
|
||||
case None;
|
||||
|
||||
case Bool;
|
||||
|
||||
case Char;
|
||||
case String;
|
||||
|
||||
case Int8;
|
||||
case Int16;
|
||||
case Int32;
|
||||
case Int64;
|
||||
case UInt8;
|
||||
case UInt16;
|
||||
case UInt32;
|
||||
case UInt64;
|
||||
|
||||
case Float;
|
||||
case Double;
|
||||
case Decimal;
|
||||
|
||||
case Enum;
|
||||
|
||||
case EntityReference;
|
||||
case ComponentReference;
|
||||
|
||||
case ObjectReference;
|
||||
|
||||
public int GetSize()
|
||||
{
|
||||
switch (this)
|
||||
{
|
||||
case .Bool:
|
||||
return 1;
|
||||
case .Char:
|
||||
return 1;
|
||||
case .Int8, .UInt8:
|
||||
return 1;
|
||||
case .Int16, .UInt16:
|
||||
return 2;
|
||||
case .Int32, .UInt32:
|
||||
return 4;
|
||||
case .Int64, .UInt64:
|
||||
return 8;
|
||||
case .Float:
|
||||
return 4;
|
||||
case .Double:
|
||||
return 8;
|
||||
case .Decimal:
|
||||
return 16;
|
||||
case .EntityReference, .ComponentReference, .ObjectReference:
|
||||
return sizeof(UUID);
|
||||
case .String:
|
||||
return sizeof(StringView);
|
||||
case .Enum:
|
||||
return sizeof(StringView);
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
namespace GlitchyEngine.Serialization;
|
||||
|
||||
class SerializedObject
|
||||
{
|
||||
Reference in New Issue
Block a user