Skip to content

Commit 229e4ee

Browse files
authored
Merge pull request #484 from HodgsonSDAS/HTK-SharingRefactor
Htk sharing/utilities refactor/formatting/fixes
2 parents 33a127f + 30bf01f commit 229e4ee

File tree

121 files changed

+3818
-3117
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

121 files changed

+3818
-3117
lines changed

Assets/HoloToolkit/Input/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ It highlights the object being gazed at.
245245
This class implements IInputClickHandler to handle the tap gesture.
246246
It increases the scale of the object when tapped.
247247

248-
### [Tests](Tests)
248+
### [Tests](Tests/Scenes)
249249
Tests related to the input features. To use the scene:
250250

251251
1. Navigate to the Tests folder.

Assets/HoloToolkit/Sharing/Prefabs/Sharing.prefab

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@ GameObject:
55
m_ObjectHideFlags: 0
66
m_PrefabParentObject: {fileID: 0}
77
m_PrefabInternal: {fileID: 100100000}
8-
serializedVersion: 4
8+
serializedVersion: 5
99
m_Component:
10-
- 4: {fileID: 475158}
11-
- 114: {fileID: 114000012667812730}
12-
- 114: {fileID: 114000011012997360}
13-
- 114: {fileID: 114000013602799446}
10+
- component: {fileID: 475158}
11+
- component: {fileID: 114000012667812730}
12+
- component: {fileID: 114000013602799446}
1413
m_Layer: 0
1514
m_Name: Sharing
1615
m_TagString: Untagged
@@ -42,17 +41,6 @@ Prefab:
4241
m_ParentPrefab: {fileID: 0}
4342
m_RootGameObject: {fileID: 163528}
4443
m_IsPrefabParent: 1
45-
--- !u!114 &114000011012997360
46-
MonoBehaviour:
47-
m_ObjectHideFlags: 1
48-
m_PrefabParentObject: {fileID: 0}
49-
m_PrefabInternal: {fileID: 100100000}
50-
m_GameObject: {fileID: 163528}
51-
m_Enabled: 1
52-
m_EditorHideFlags: 0
53-
m_Script: {fileID: 11500000, guid: 9b9c87aaa636d31488ddd2b3e3fe29e3, type: 3}
54-
m_Name:
55-
m_EditorClassIdentifier:
5644
--- !u!114 &114000012667812730
5745
MonoBehaviour:
5846
m_ObjectHideFlags: 1
@@ -67,7 +55,10 @@ MonoBehaviour:
6755
ClientRole: 0
6856
ServerAddress: localhost
6957
ServerPort: 20602
70-
IsAudioEndpoint: 0
58+
connectOnAwake: 1
59+
AutoDiscoverServer: 0
60+
PingIntervalSec: 2
61+
IsAudioEndpoint: 1
7162
--- !u!114 &114000013602799446
7263
MonoBehaviour:
7364
m_ObjectHideFlags: 1

Assets/HoloToolkit/Sharing/README.md

Lines changed: 306 additions & 17 deletions
Large diffs are not rendered by default.
File renamed without changes.

Assets/HoloToolkit/Sharing/Editor/SharingMenu.cs renamed to Assets/HoloToolkit/Sharing/Scripts/Editor/SharingMenu.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License. See LICENSE in the project root for license information.
33

4+
using System.IO;
45
using UnityEditor;
56
using UnityEngine;
6-
using System.IO;
7+
using HoloToolkit.Unity;
78

89
namespace HoloToolkit.Sharing
910
{
@@ -21,7 +22,7 @@ public static void LaunchSessionServer()
2122
return;
2223
}
2324

24-
Utilities.ExternalProcess.FindAndLaunch(filePathName, @"-local");
25+
ExternalProcess.FindAndLaunch(filePathName, @"-local");
2526
}
2627

2728
[MenuItem("HoloToolkit/Sharing Service/Launch Session Manager", false, 101)]
@@ -36,7 +37,7 @@ public static void LaunchSessionUI()
3637
return;
3738
}
3839

39-
Utilities.ExternalProcess.FindAndLaunch(filePathName);
40+
ExternalProcess.FindAndLaunch(filePathName);
4041
}
4142

4243
[MenuItem("HoloToolkit/Sharing Service/Launch Profiler", false, 103)]
@@ -51,7 +52,7 @@ public static void LaunchProfilerX()
5152
return;
5253
}
5354

54-
Utilities.ExternalProcess.FindAndLaunch(filePathName);
55+
ExternalProcess.FindAndLaunch(filePathName);
5556
}
5657
}
5758
}

Assets/HoloToolkit/Sharing/Editor/SharingMenu.cs.meta renamed to Assets/HoloToolkit/Sharing/Scripts/Editor/SharingMenu.cs.meta

File renamed without changes.

Assets/HoloToolkit/Sharing/Editor/SharingStageEditor.cs renamed to Assets/HoloToolkit/Sharing/Scripts/Editor/SharingStageEditor.cs

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
namespace HoloToolkit.Sharing
1212
{
13-
[CustomEditor(typeof (SharingStage))]
13+
[CustomEditor(typeof(SharingStage))]
1414
public class SharingStageEditor : Editor
1515
{
1616
private Dictionary<object, bool> foldoutGUIMap = new Dictionary<object, bool>();
@@ -21,7 +21,7 @@ public override void OnInspectorGUI()
2121

2222
if (Application.isPlaying)
2323
{
24-
SharingStage networkManager = target as SharingStage;
24+
SharingStage networkManager = (SharingStage)target;
2525

2626
SyncRoot root = networkManager.Root;
2727

@@ -44,34 +44,34 @@ public override void OnInspectorGUI()
4444

4545
private void DrawDataModelGUI(SyncPrimitive syncPrimitive, string parentPath)
4646
{
47-
string name = syncPrimitive.FieldName;
48-
object value = syncPrimitive.RawValue;
47+
string fieldName = syncPrimitive.FieldName;
48+
object rawValue = syncPrimitive.RawValue;
4949

50-
SyncObject SyncObject = syncPrimitive as SyncObject;
50+
SyncObject syncObject = syncPrimitive as SyncObject;
5151

52-
if (SyncObject != null)
52+
if (syncObject != null)
5353
{
5454
bool foldout = false;
55-
if (foldoutGUIMap.ContainsKey(SyncObject))
55+
if (foldoutGUIMap.ContainsKey(syncObject))
5656
{
57-
foldout = foldoutGUIMap[SyncObject];
57+
foldout = foldoutGUIMap[syncObject];
5858
}
5959

60-
int ownerId = SyncObject.OwnerId;
60+
int ownerId = syncObject.OwnerId;
6161
string owner = ownerId == int.MaxValue ? string.Empty : ownerId.ToString();
62-
string objectType = SyncObject.ObjectType;
62+
string objectType = syncObject.ObjectType;
6363

64-
foldout = EditorGUILayout.Foldout(foldout, string.Format("{0} (Owner:{1} Type:{2})", name, owner, objectType));
65-
foldoutGUIMap[SyncObject] = foldout;
64+
foldout = EditorGUILayout.Foldout(foldout, string.Format("{0} (Owner:{1} Type:{2})", fieldName, owner, objectType));
65+
foldoutGUIMap[syncObject] = foldout;
6666

6767
if (foldout)
6868
{
6969
EditorGUI.indentLevel++;
7070

71-
SyncPrimitive[] children = SyncObject.GetChildren();
71+
SyncPrimitive[] children = syncObject.GetChildren();
7272
for (int i = 0; i < children.Length; i++)
7373
{
74-
DrawDataModelGUI(children[i], parentPath + "/" + name);
74+
DrawDataModelGUI(children[i], parentPath + "/" + fieldName);
7575
}
7676

7777
EditorGUI.indentLevel--;
@@ -80,13 +80,12 @@ private void DrawDataModelGUI(SyncPrimitive syncPrimitive, string parentPath)
8080
else
8181
{
8282
EditorGUILayout.BeginHorizontal();
83-
EditorGUILayout.LabelField(name, GUILayout.MaxWidth(125));
84-
EditorGUILayout.LabelField(value != null ? value.ToString() : "null", GUILayout.MaxWidth(200));
85-
EditorGUILayout.LabelField(syncPrimitive.NetworkElement != null ? "live" : "local",
86-
GUILayout.MaxWidth(50));
83+
EditorGUILayout.LabelField(fieldName, GUILayout.MaxWidth(125));
84+
EditorGUILayout.LabelField(rawValue != null ? rawValue.ToString() : "null", GUILayout.MaxWidth(200));
85+
EditorGUILayout.LabelField(syncPrimitive.NetworkElement != null ? "live" : "local", GUILayout.MaxWidth(50));
8786
if (syncPrimitive.NetworkElement != null)
8887
{
89-
EditorGUILayout.LabelField(parentPath + "/" + name, GUILayout.MaxWidth(500));
88+
EditorGUILayout.LabelField(parentPath + "/" + fieldName, GUILayout.MaxWidth(500));
9089
}
9190

9291
EditorGUILayout.EndHorizontal();

Assets/HoloToolkit/Sharing/Editor/SharingStageEditor.cs.meta renamed to Assets/HoloToolkit/Sharing/Scripts/Editor/SharingStageEditor.cs.meta

File renamed without changes.

Assets/HoloToolkit/Sharing/Scripts/SDK/DiscoveryClientAdapter.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
// Licensed under the MIT License. See LICENSE in the project root for license information.
33

44
using System;
5-
using System.Collections.Generic;
6-
using System.Linq;
7-
using System.Text;
85

96
namespace HoloToolkit.Sharing
107
{

Assets/HoloToolkit/Sharing/Scripts/ServerSessionsTracker.cs

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
namespace HoloToolkit.Sharing
1111
{
1212
/// <summary>
13-
/// The ServerSessionsTracker manages the list of sessions on the server
14-
/// and the users in these sessions.
13+
/// The ServerSessionsTracker manages the list of sessions on the server and the users in these sessions.
14+
/// Instance is created by Sharing Stage when a connection is found.
1515
/// </summary>
1616
public class ServerSessionsTracker : IDisposable
1717
{
18-
private bool disposed = false;
18+
private bool disposed;
1919
private SessionManager sessionManager;
2020
private SessionManagerAdapter sessionManagerAdapter;
2121

@@ -31,7 +31,7 @@ public class ServerSessionsTracker : IDisposable
3131

3232
public event Action ServerConnected;
3333
public event Action ServerDisconnected;
34-
34+
3535
/// <summary>
3636
/// List of sessions on the server.
3737
/// </summary>
@@ -49,17 +49,17 @@ public ServerSessionsTracker(SessionManager sessionMgr)
4949

5050
if (sessionManager != null)
5151
{
52-
this.sessionManagerAdapter = new SessionManagerAdapter();
53-
sessionManager.AddListener(this.sessionManagerAdapter);
54-
this.sessionManagerAdapter.ServerConnectedEvent += OnServerConnected;
55-
this.sessionManagerAdapter.ServerDisconnectedEvent += OnServerDisconnected;
56-
this.sessionManagerAdapter.SessionClosedEvent += OnSessionClosed;
57-
this.sessionManagerAdapter.SessionAddedEvent += OnSessionAdded;
58-
this.sessionManagerAdapter.CreateSucceededEvent += OnSessionCreatedSuccess;
59-
this.sessionManagerAdapter.CreateFailedEvent += OnSessionCreatedFail;
60-
this.sessionManagerAdapter.UserChangedEvent += OnUserChanged;
61-
this.sessionManagerAdapter.UserJoinedSessionEvent += OnUserJoined;
62-
this.sessionManagerAdapter.UserLeftSessionEvent += OnUserLeft;
52+
sessionManagerAdapter = new SessionManagerAdapter();
53+
sessionManager.AddListener(sessionManagerAdapter);
54+
sessionManagerAdapter.ServerConnectedEvent += OnServerConnected;
55+
sessionManagerAdapter.ServerDisconnectedEvent += OnServerDisconnected;
56+
sessionManagerAdapter.SessionClosedEvent += OnSessionClosed;
57+
sessionManagerAdapter.SessionAddedEvent += OnSessionAdded;
58+
sessionManagerAdapter.CreateSucceededEvent += OnSessionCreatedSuccess;
59+
sessionManagerAdapter.CreateFailedEvent += OnSessionCreatedFail;
60+
sessionManagerAdapter.UserChangedEvent += OnUserChanged;
61+
sessionManagerAdapter.UserJoinedSessionEvent += OnUserJoined;
62+
sessionManagerAdapter.UserLeftSessionEvent += OnUserLeft;
6363
}
6464
}
6565

@@ -214,19 +214,19 @@ protected virtual void Dispose(bool disposing)
214214
{
215215
OnServerDisconnected();
216216

217-
if (this.sessionManagerAdapter != null)
217+
if (sessionManagerAdapter != null)
218218
{
219-
this.sessionManagerAdapter.ServerConnectedEvent -= OnServerConnected;
220-
this.sessionManagerAdapter.ServerDisconnectedEvent -= OnServerDisconnected;
221-
this.sessionManagerAdapter.SessionClosedEvent -= OnSessionClosed;
222-
this.sessionManagerAdapter.SessionAddedEvent -= OnSessionAdded;
223-
this.sessionManagerAdapter.CreateSucceededEvent -= OnSessionCreatedSuccess;
224-
this.sessionManagerAdapter.CreateFailedEvent -= OnSessionCreatedFail;
225-
this.sessionManagerAdapter.UserChangedEvent -= OnUserChanged;
226-
this.sessionManagerAdapter.UserJoinedSessionEvent -= OnUserJoined;
227-
this.sessionManagerAdapter.UserLeftSessionEvent -= OnUserLeft;
228-
this.sessionManagerAdapter.Dispose();
229-
this.sessionManagerAdapter = null;
219+
sessionManagerAdapter.ServerConnectedEvent -= OnServerConnected;
220+
sessionManagerAdapter.ServerDisconnectedEvent -= OnServerDisconnected;
221+
sessionManagerAdapter.SessionClosedEvent -= OnSessionClosed;
222+
sessionManagerAdapter.SessionAddedEvent -= OnSessionAdded;
223+
sessionManagerAdapter.CreateSucceededEvent -= OnSessionCreatedSuccess;
224+
sessionManagerAdapter.CreateFailedEvent -= OnSessionCreatedFail;
225+
sessionManagerAdapter.UserChangedEvent -= OnUserChanged;
226+
sessionManagerAdapter.UserJoinedSessionEvent -= OnUserJoined;
227+
sessionManagerAdapter.UserLeftSessionEvent -= OnUserLeft;
228+
sessionManagerAdapter.Dispose();
229+
sessionManagerAdapter = null;
230230
}
231231

232232
if (sessionManager != null)

0 commit comments

Comments
 (0)