Load save fix

This commit is contained in:
AbdulmanovAI
2025-10-29 16:24:54 +04:00
parent 96a4535aa1
commit fe3b681c66

View File

@@ -1,8 +1,9 @@
using _2DGAMELIB;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using _2DGAMELIB; using System.Runtime.Serialization;
namespace SlaveMatrix namespace SlaveMatrix
{ {
@@ -77,6 +78,24 @@ namespace SlaveMatrix
[NonSerialized] [NonSerialized]
public Type ThisType; public Type ThisType;
// Храним только имя типа (можно AQN)
[OptionalField] private string _thisTypeName;
[OnSerializing]
private void OnSerializing(StreamingContext _)
{
_thisTypeName = ThisType?.AssemblyQualifiedName
?? GetType().AssemblyQualifiedName;
}
[OnDeserialized]
private void OnDeserialized(StreamingContext _)
{
ThisType = _thisTypeName != null
? Type.GetType(_thisTypeName, throwOnError: false) ?? GetType()
: GetType();
}
public virtual Ele GetEle(double DisUnit, Med Med, ) public virtual Ele GetEle(double DisUnit, Med Med, )
{ {
return null; return null;