mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-15 03:30:53 +01:00
aaaaaaaaaaaaa
This commit is contained in:
@@ -302,6 +302,7 @@ namespace Robust.Shared.Prototypes
|
||||
PushInheritance(type, childID, newResult, changed);
|
||||
}
|
||||
|
||||
newResult.CallAfterDeserializationHook();
|
||||
var populatedRes = _serializationManager.PopulateDataDefinition(prototypes[type][id], (IDeserializedDefinition)newResult);
|
||||
prototypes[type][id] = (IPrototype) populatedRes.RawValue!;
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@ namespace Robust.Shared.Serialization.Manager.Result
|
||||
|
||||
public abstract DeserializationResult Copy();
|
||||
|
||||
public abstract void CallAfterDeserializationHook();
|
||||
|
||||
public static DeserializationResult Value<T>(T value) where T : notnull
|
||||
{
|
||||
var type = typeof(DeserializedValue<>).MakeGenericType(value.GetType());
|
||||
|
||||
@@ -60,5 +60,13 @@ namespace Robust.Shared.Serialization.Manager.Result
|
||||
|
||||
return new DeserializedArray(valueList, resList);
|
||||
}
|
||||
|
||||
public override void CallAfterDeserializationHook()
|
||||
{
|
||||
foreach (var elem in Mappings)
|
||||
{
|
||||
elem.CallAfterDeserializationHook();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -98,5 +99,13 @@ namespace Robust.Shared.Serialization.Manager.Result
|
||||
|
||||
return new DeserializedComponentRegistry(registry, mappingDict);
|
||||
}
|
||||
|
||||
public override void CallAfterDeserializationHook()
|
||||
{
|
||||
foreach (var (_, comp) in Mappings)
|
||||
{
|
||||
comp.CallAfterDeserializationHook();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,5 +44,14 @@ namespace Robust.Shared.Serialization.Manager.Result
|
||||
|
||||
return IoCManager.Resolve<ISerializationManager>().CreateDataDefinition<T>(newMapping, true);
|
||||
}
|
||||
|
||||
public override void CallAfterDeserializationHook()
|
||||
{
|
||||
foreach (var fieldEntry in Mapping)
|
||||
{
|
||||
fieldEntry.Result?.CallAfterDeserializationHook();
|
||||
}
|
||||
if(Value is ISerializationHooks hooks) hooks.AfterDeserialization();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
@@ -68,5 +69,14 @@ namespace Robust.Shared.Serialization.Manager.Result
|
||||
|
||||
return new DeserializedDictionary<TDict, TKey, TValue>(valueDict, mappingDict);
|
||||
}
|
||||
|
||||
public override void CallAfterDeserializationHook()
|
||||
{
|
||||
foreach (var (key, val) in Mappings)
|
||||
{
|
||||
key.CallAfterDeserializationHook();
|
||||
val.CallAfterDeserializationHook();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,5 +60,13 @@ namespace Robust.Shared.Serialization.Manager.Result
|
||||
|
||||
return new DeserializedImmutableList<T>(Value == null ? null : valueList.ToImmutable(), resList);
|
||||
}
|
||||
|
||||
public override void CallAfterDeserializationHook()
|
||||
{
|
||||
foreach (var elem in Mappings)
|
||||
{
|
||||
elem.CallAfterDeserializationHook();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
|
||||
namespace Robust.Shared.Serialization.Manager.Result
|
||||
@@ -60,5 +61,13 @@ namespace Robust.Shared.Serialization.Manager.Result
|
||||
|
||||
return new DeserializedImmutableSet<T>(Value == null ? null : valueSet.ToImmutable(), resList);
|
||||
}
|
||||
|
||||
public override void CallAfterDeserializationHook()
|
||||
{
|
||||
foreach (var val in Mappings)
|
||||
{
|
||||
val.CallAfterDeserializationHook();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Robust.Shared.Serialization.Manager.Result
|
||||
{
|
||||
@@ -59,5 +60,13 @@ namespace Robust.Shared.Serialization.Manager.Result
|
||||
|
||||
return new DeserializedMutableCollection<TCollection, TElement>(Value == null ? null : valueList, resList);
|
||||
}
|
||||
|
||||
public override void CallAfterDeserializationHook()
|
||||
{
|
||||
foreach (var val in Mappings)
|
||||
{
|
||||
val.CallAfterDeserializationHook();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,5 +67,13 @@ namespace Robust.Shared.Serialization.Manager.Result
|
||||
|
||||
return new DeserializedReadOnlyCollection<TCollection, TElement>(Value == null ? default : CreateDelegate(valueList), resList, CreateDelegate);
|
||||
}
|
||||
|
||||
public override void CallAfterDeserializationHook()
|
||||
{
|
||||
foreach (var val in Mappings)
|
||||
{
|
||||
val.CallAfterDeserializationHook();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,5 +70,14 @@ namespace Robust.Shared.Serialization.Manager.Result
|
||||
|
||||
return new DeserializedReadOnlyDictionary<TDict, TKey, TValue>(CreateDelegate(valueDict), mappingDict, CreateDelegate);
|
||||
}
|
||||
|
||||
public override void CallAfterDeserializationHook()
|
||||
{
|
||||
foreach (var (key, val) in Mappings)
|
||||
{
|
||||
key.CallAfterDeserializationHook();
|
||||
val.CallAfterDeserializationHook();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,5 +20,10 @@
|
||||
{
|
||||
return new DeserializedValue<T>(Value);
|
||||
}
|
||||
|
||||
public override void CallAfterDeserializationHook()
|
||||
{
|
||||
if(Value is ISerializationHooks hooks) hooks.AfterDeserialization();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user