Skip to content

Commit

Permalink
Merge branch 'Sharing_SDK_Update' into MSFT_Holotoolkit-master
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephen Hodgson authored and Stephen Hodgson committed Oct 12, 2016
2 parents 95c4a68 + b34590c commit 7b1612f
Show file tree
Hide file tree
Showing 2 changed files with 97 additions and 15 deletions.
96 changes: 85 additions & 11 deletions Assets/HoloToolkit/Sharing/Scripts/SDK/ObjectElementAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,61 +11,135 @@ namespace HoloToolkit.Sharing
public class ObjectElementAdapter : ObjectElementListener
{
public event System.Action<long, int> IntChangedEvent;
public event System.Action<long, double> DoubleChangedEvent;
public event System.Action<long, float> FloatChangedEvent;
public event System.Action<long, long> LongChangedEvent;
public event System.Action<long, XString> StringChangedEvent;
public event System.Action<long, bool> BoolChangedEvent;
public event System.Action<Element> ElementAddedEvent;
public event System.Action<Element> ElementDeletedEvent;

/// <summary>
/// Initializes a new instance of <see cref="ObjectElementAdapter"/>.
/// </summary>
public ObjectElementAdapter() { }

/// <summary>
/// Throws the <see cref="IntChangedEvent"/>.
/// </summary>
/// <param name="elementID">The Elements id.</param>
/// <param name="newValue">The new int value.</param>
public override void OnIntElementChanged(long elementID, int newValue)
{
Profile.BeginRange("OnIntElementChanged");
if (this.IntChangedEvent != null)
if (IntChangedEvent != null)
{
this.IntChangedEvent(elementID, newValue);
IntChangedEvent(elementID, newValue);
}
Profile.EndRange();
}

/// <summary>
/// Throws the <see cref="DoubleChangedEvent"/>.
/// </summary>
/// <param name="elementID">The Elements id.</param>
/// <param name="newValue">The new double value.</param>
public override void OnDoubleElementChanged(long elementID, double newValue)
{
Profile.BeginRange("OnDoubleElementChanged");
if (DoubleChangedEvent != null)
{
DoubleChangedEvent(elementID, newValue);
}
Profile.EndRange();
}

/// <summary>
/// Throws the <see cref="FloatChangedEvent"/>.
/// </summary>
/// <param name="elementID">The Elements id.</param>
/// <param name="newValue">The new float value.</param>
public override void OnFloatElementChanged(long elementID, float newValue)
{
Profile.BeginRange("OnFloatElementChanged");
if (this.FloatChangedEvent != null)
if (FloatChangedEvent != null)
{
FloatChangedEvent(elementID, newValue);
}
Profile.EndRange();
}

/// <summary>
/// Throws the <see cref="LongChangedEvent"/>.
/// </summary>
/// <param name="elementID">The Elements id.</param>
/// <param name="newValue">The new long value.</param>
public override void OnLongElementChanged(long elementID, long newValue)
{
Profile.BeginRange("OnLongElementChanged");
if (LongChangedEvent != null)
{
this.FloatChangedEvent(elementID, newValue);
LongChangedEvent(elementID, newValue);
}
Profile.EndRange();
}

/// <summary>
/// Throws the <see cref="StringChangedEvent"/>.
/// </summary>
/// <param name="elementID">The Elements id.</param>
/// <param name="newValue">The new string value.</param>
public override void OnStringElementChanged(long elementID, XString newValue)
{
Profile.BeginRange("OnStringElementChanged");
if (this.StringChangedEvent != null)
if (StringChangedEvent != null)
{
StringChangedEvent(elementID, newValue);
}
Profile.EndRange();
}

/// <summary>
/// Throws the <see cref="BoolChangedEvent"/>.
/// </summary>
/// <param name="elementID">The Elements id.</param>
/// <param name="newValue">The new bool value</param>
public override void OnBoolElementChanged(long elementID, bool newValue)
{
Profile.BeginRange("OnBoolElementChanged");
if (BoolChangedEvent != null)
{
this.StringChangedEvent(elementID, newValue);
BoolChangedEvent(elementID, newValue);
}
Profile.EndRange();
}

/// <summary>
/// Throws the <see cref="ElementAddedEvent"/>.
/// </summary>
/// <param name="element">The new Element.</param>
public override void OnElementAdded(Element element)
{
Profile.BeginRange("OnElementAdded");
if (this.ElementAddedEvent != null)
if (ElementAddedEvent != null)
{
this.ElementAddedEvent(element);
ElementAddedEvent(element);
}
Profile.EndRange();
}

/// <summary>
/// Throws the <see cref="ElementDeletedEvent"/>.
/// </summary>
/// <param name="element">The deleted Element.</param>
public override void OnElementDeleted(Element element)
{
Profile.BeginRange("OnElementDeleted");
if (this.ElementDeletedEvent != null)
if (ElementDeletedEvent != null)
{
this.ElementDeletedEvent(element);
ElementDeletedEvent(element);
}
Profile.EndRange();
}
}
}
}
16 changes: 12 additions & 4 deletions Assets/HoloToolkit/Sharing/Tests/Sharing.unity
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ Light:
m_Shadows:
m_Type: 2
m_Resolution: -1
m_CustomResolution: -1
m_Strength: 1
m_Bias: 0.05
m_NormalBias: 0.4
Expand All @@ -190,10 +191,10 @@ Transform:
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
m_LocalPosition: {x: 0, y: 3, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &685058484
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -221,10 +222,10 @@ Transform:
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.2, y: 0.2, z: 0.2}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_Children: []
m_Father: {fileID: 942915100}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!23 &685058486
MeshRenderer:
m_ObjectHideFlags: 0
Expand All @@ -234,6 +235,7 @@ MeshRenderer:
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_Materials:
Expand All @@ -246,6 +248,7 @@ MeshRenderer:
m_PreserveUVs: 1
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_SelectedWireframeHidden: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
Expand Down Expand Up @@ -297,11 +300,11 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 2}
m_LocalScale: {x: 1, y: 1, z: 1}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_Children:
- {fileID: 685058485}
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &942915101
MonoBehaviour:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -366,7 +369,12 @@ Prefab:
- target: {fileID: 114000012667812730, guid: 8aaf37823b26ee449bb3b3d7775965c3,
type: 2}
propertyPath: ServerAddress
value: 10.124.204.60
value: localhost
objectReference: {fileID: 0}
- target: {fileID: 114000012667812730, guid: 8aaf37823b26ee449bb3b3d7775965c3,
type: 2}
propertyPath: IsAudioEndpoint
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 8aaf37823b26ee449bb3b3d7775965c3, type: 2}
Expand Down

0 comments on commit 7b1612f

Please sign in to comment.