AR Design
UBC EML collab with UBC SALA - visualizing IoT data in AR
SyncDouble.cs
Go to the documentation of this file.
1
// Copyright (c) Microsoft Corporation. All rights reserved.
2
// Licensed under the MIT License. See LICENSE in the project root for license information.
3
4
namespace
HoloToolkit
.Sharing.SyncModel
5
{
10
public
class
SyncDouble
:
SyncPrimitive
11
{
12
private
DoubleElement
element;
13
private
double
value;
14
15
#if UNITY_EDITOR
16
public
override
object
RawValue
17
{
18
get
{
return
value; }
19
}
20
#endif
21
22
public
double
Value
23
{
24
get
{
return
value; }
25
26
set
27
{
28
// Has the value actually changed?
29
if
(this.value != value)
30
{
31
// Change the value
32
this.value = value;
33
34
if
(element != null)
35
{
36
// Notify network that the value has changed
37
element.
SetValue
(value);
38
}
39
}
40
}
41
}
42
43
public
SyncDouble
(
string
field) : base(field) { }
44
45
public
override
void
InitializeLocal
(
ObjectElement
parentElement)
46
{
47
element = parentElement.
CreateDoubleElement
(XStringFieldName, value);
48
NetworkElement = element;
49
}
50
51
public
void
AddFromLocal
(
ObjectElement
parentElement,
double
localValue)
52
{
53
InitializeLocal(parentElement);
54
Value = localValue;
55
}
56
57
public
override
void
AddFromRemote
(
Element
remoteElement)
58
{
59
NetworkElement = remoteElement;
60
element =
DoubleElement
.
Cast
(remoteElement);
61
value = element.
GetValue
();
62
}
63
64
public
override
void
UpdateFromRemote
(
double
remoteValue)
65
{
66
value = remoteValue;
67
}
68
}
69
}
HoloToolkit.Sharing.ObjectElement
Definition:
ObjectElement.cs:13
HoloToolkit.Sharing.DoubleElement.SetValue
virtual void SetValue(double newValue)
Definition:
DoubleElement.cs:53
HoloToolkit.Sharing.ObjectElement.CreateDoubleElement
virtual DoubleElement CreateDoubleElement(XString name, double value)
Definition:
ObjectElement.cs:72
HoloToolkit.Sharing.SyncModel.SyncDouble.UpdateFromRemote
override void UpdateFromRemote(double remoteValue)
Called when the primitive value has changed from a remote action.
Definition:
SyncDouble.cs:64
HoloToolkit.Sharing.SyncModel.SyncPrimitive
Base primitive used to define an element within the data model. The primitive is defined by a field a...
Definition:
SyncPrimitive.cs:10
HoloToolkit.Sharing.DoubleElement.GetValue
virtual double GetValue()
Definition:
DoubleElement.cs:48
HoloToolkit.Sharing.SyncModel.SyncDouble.InitializeLocal
override void InitializeLocal(ObjectElement parentElement)
Initializes this object for local use. Doesn't wait for network initialization.
Definition:
SyncDouble.cs:45
HoloToolkit.Sharing.SyncModel.SyncDouble.AddFromRemote
override void AddFromRemote(Element remoteElement)
Called when being remotely initialized.
Definition:
SyncDouble.cs:57
HoloToolkit.Sharing.Element
Definition:
Element.cs:13
HoloToolkit.Sharing.SyncModel.SyncDouble
This class implements the double primitive for the syncing system. It does the heavy lifting to make ...
Definition:
SyncDouble.cs:10
HoloToolkit.Sharing.SyncModel.SyncDouble.AddFromLocal
void AddFromLocal(ObjectElement parentElement, double localValue)
Definition:
SyncDouble.cs:51
HoloToolkit.Sharing.DoubleElement.Cast
static DoubleElement Cast(Element element)
Definition:
DoubleElement.cs:42
HoloToolkit.Sharing.SyncModel.SyncDouble.SyncDouble
SyncDouble(string field)
Definition:
SyncDouble.cs:43
HoloToolkit.Sharing.DoubleElement
Definition:
DoubleElement.cs:13
HoloToolkit
Assets
HoloToolkit
Sharing
Scripts
SyncModel
SyncDouble.cs
Generated by
1.8.12