-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSyncRoot.cs
47 lines (42 loc) · 1.3 KB
/
SyncRoot.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
//
using HoloToolkit.Sharing.Spawning;
using HoloToolkit.Sharing.SyncModel;
namespace HoloToolkit.Sharing
{
/// <summary>
/// Root of the synchronization data model used by this application.
/// </summary>
public class SyncRoot : SyncObject
{
/// <summary>
/// Children of the root.
/// </summary>
[SyncData]
public SyncArray<SyncSpawnedObject> InstantiatedPrefabs;
/// <summary>
/// Constructor.
/// </summary>
/// <param name="rootElement">Root Element from Sharing Stage</param>
public SyncRoot(ObjectElement rootElement)
{
Element = rootElement;
FieldName = Element.GetName().GetString();
InitializeSyncSettings();
InitializeDataModel();
}
private void InitializeSyncSettings()
{
SyncSettings.Instance.Initialize();
}
/// <summary>
/// Initializes any data models that need to have a local state.
/// </summary>
private void InitializeDataModel()
{
InstantiatedPrefabs.InitializeLocal(Element);
}
}
}