23 const SCR_VoiceoverSystemSnapshot snapshot = voiceover.
CreateSnapshot();
24 if (!snapshot.m_sCurrentSoundEvent && snapshot.m_aQueue.IsEmpty())
27 context.WriteValue(
"version", 1);
28 context.WriteValueDefault(
"currentConfig", snapshot.m_sData,
ResourceName.Empty);
29 context.WriteValueDefault(
"currentSoundEvent", snapshot.m_sCurrentSoundEvent,
string.Empty);
30 context.WriteValueDefault(
"currentActorName", snapshot.m_sCurrentActorName,
string.Empty);
31 context.WriteValueDefault(
"currentSubtitle", snapshot.m_sCurrentSubtitle,
string.Empty);
32 context.WriteValueDefault(
"currentSequence", snapshot.m_sCurrentSequence,
string.Empty);
34 string currentActorId = GetSystem().GetId(snapshot.m_CurrentActor);
35 if (currentActorId.IsEmpty() && snapshot.m_CurrentActor)
36 currentActorId = snapshot.m_CurrentActor.GetName();
38 context.WriteDefault(currentActorId,
string.Empty);
40 if (!snapshot.m_mActorNames.IsEmpty() || !context.CanSeekMembers())
41 context.WriteValue(
"actorNames", snapshot.m_mActorNames);
43 array<string> actorIds();
44 foreach (
IEntity actor : snapshot.m_aActors)
46 string id = GetSystem().GetId(actor);
53 if (!actorIds.IsEmpty() || !context.CanSeekMembers())
54 context.Write(actorIds);
56 context.WriteValue(
"queue", snapshot.m_aQueue);
69 context.Read(version);
71 SCR_VoiceoverSystemSnapshot snapshot();
73 context.ReadValueDefault(
"currentConfig", snapshot.m_sData,
ResourceName.Empty);
74 context.ReadValueDefault(
"currentSoundEvent", snapshot.m_sCurrentSoundEvent,
string.Empty);
75 context.ReadValueDefault(
"currentActorName", snapshot.m_sCurrentActorName,
string.Empty);
76 context.ReadValueDefault(
"currentSubtitle", snapshot.m_sCurrentSubtitle,
string.Empty);
77 context.ReadValueDefault(
"currentSequence", snapshot.m_sCurrentSequence,
string.Empty);
79 string currentActorId;
80 context.ReadDefault(currentActorId,
string.Empty);
82 context.ReadValue(
"actorNames", snapshot.m_mActorNames);
84 array<string> actorIds;
85 if (context.Read(actorIds))
86 snapshot.m_aActors.Resize(actorIds.Count());
88 context.ReadValue(
"queue", snapshot.m_aQueue);
90 if (
UUID.IsUUID(currentActorId))
93 ctx.m_Snapshot = snapshot;
95 GetSystem().WhenAvailable(currentActorId,
task, 30.0);
97 else if (!currentActorId.IsEmpty())
99 snapshot.m_CurrentActor =
GetGame().GetWorld().FindEntityByName(currentActorId);
104 foreach (
int idx,
string actorId : actorIds)
106 if (
UUID.IsUUID(actorId))
109 ctx.m_Snapshot = snapshot;
110 ctx.m_iActorIdx =
idx;
112 GetSystem().WhenAvailable(currentActorId,
task, 30.0);
116 snapshot.m_aActors[
idx] =
GetGame().GetWorld().FindEntityByName(currentActorId);
121 TryApplySnapshot(snapshot);
126 protected static void OnActorAvailable(Managed instance, PersistenceDeferredDeserializeTask
task,
bool expired, Managed context)