Inheritance: UnityEngine.MonoBehaviour
        public override void OnInspectorGUI()
        {
            DrawDefaultInspector();

            if (Application.isPlaying)
            {
                SharingStage networkManager = (SharingStage)target;

                SyncRoot root = networkManager.Root;

                if (root != null)
                {
                    EditorGUILayout.Separator();
                    EditorGUILayout.BeginVertical();
                    {
                        EditorGUILayout.LabelField("Object Hierarchy");
                        DrawDataModelGUI(root, string.Empty);
                    }
                    EditorGUILayout.EndVertical();
                }

                // Force this inspector to repaint every frame so that it reflects changes to the undo stack
                // immediately rather than showing stale data until the user clicks on the inspector window
                Repaint();
            }
        }
Exemplo n.º 2
0
        protected void OnDestroy()
        {
            Instance = null;

            if (this.discoveryClient != null)
            {
                discoveryClient.RemoveListener(discoveryClientAdapter);
                discoveryClient.Dispose();
                discoveryClient = null;

                if (discoveryClientAdapter != null)
                {
                    discoveryClientAdapter.Dispose();
                    discoveryClientAdapter = null;
                }
            }

            if (this.sharingMgr != null)
            {
                // Force a disconnection so that we can stop and start Unity without connections hanging around
                this.sharingMgr.GetPairedConnection().Disconnect();
                this.sharingMgr.GetServerConnection().Disconnect();

                // Release the XTools manager so that it cleans up the C++ copy
                this.sharingMgr.Dispose();
                this.sharingMgr = null;
            }
            // Forces a garbage collection to try to clean up any additional reference to SWIG-wrapped objects
            System.GC.Collect();
        }
Exemplo n.º 3
0
        void InitializeMessageHandlers()
        {
            SharingStage sharingStage = SharingStage.Instance;

            if (sharingStage == null)
            {
                Debug.Log("Cannot Initialize CustomMessages. No SharingStage instance found.");
                return;
            }

            serverConnection = sharingStage.Manager.GetServerConnection();
            if (serverConnection == null)
            {
                Debug.Log("Cannot initialize CustomMessages. Cannot get a server connection.");
                return;
            }

            connectionAdapter = new NetworkConnectionAdapter();
            connectionAdapter.MessageReceivedCallback += OnMessageReceived;

            // Cache the local user ID
            this.localUserID = SharingStage.Instance.Manager.GetLocalUser().GetID();
            /////////////////////////////////////////////////////////////////////////////////////////
            // for (byte index = (byte)TestMessageID.BodyData; index < (byte)TestMessageID.Max; index++)
            for (byte index = (byte)TestMessageID.StartID; index < (byte)TestMessageID.Max; index++)
            {
                if (MessageHandlers.ContainsKey((TestMessageID)index) == false)
                {
                    MessageHandlers.Add((TestMessageID)index, null);
                }

                serverConnection.AddListener(index, connectionAdapter);
            }
        }
Exemplo n.º 4
0
        public void startSharing()
        {
            Instance       = this;
            this.logWriter = new ConsoleLogWriter();
            ClientConfig config = new ClientConfig(this.ClientRole);

            config.SetIsAudioEndpoint(this.IsAudioEndpoint);
            config.SetLogWriter(this.logWriter);
            config.SetServerAddress(this.ServerAddress);
            config.SetServerPort(this.ServerPort);
            this.xtoolsMgr = XToolsManager.Create(config);
        }
Exemplo n.º 5
0
        private void Awake()
        {
            Instance = this;

            this.logWriter = new ConsoleLogWriter();

            ClientConfig config = new ClientConfig(this.ClientRole);

            config.SetIsAudioEndpoint(this.IsAudioEndpoint);
            config.SetLogWriter(this.logWriter);
            config.SetServerAddress(this.ServerAddress);
            config.SetServerPort(this.ServerPort);

            this.sharingMgr = SharingManager.Create(config);
        }
Exemplo n.º 6
0
        private void Awake()
        {
            Instance = this;

            this.logWriter = new ConsoleLogWriter();

            if (AutoDiscoverServer)
            {
                AutoDiscoverInit();
            }
            else
            {
                Connect();
            }
        }
        protected void OnDestroy()
        {
            Instance = null;

            // Force a disconnection so that we can stop and start Unity without connections hanging around
            this.sharingMgr.GetPairedConnection().Disconnect();
            this.sharingMgr.GetServerConnection().Disconnect();

            // Release the XTools manager so that it cleans up the C++ copy
            this.sharingMgr.Dispose();
            this.sharingMgr = null;

            // Forces a garbage collection to try to clean up any additional reference to SWIG-wrapped objects
            System.GC.Collect();
        }
        private void Awake()
        {
            Instance = this;

            this.logWriter = new ConsoleLogWriter();

            ClientConfig config = new ClientConfig(this.ClientRole);
            config.SetIsAudioEndpoint(this.IsAudioEndpoint);
            config.SetLogWriter(this.logWriter);
            config.SetServerAddress(this.ServerAddress);
            config.SetServerPort(this.ServerPort);
            config.SetProfilerEnabled(false);

            this.sharingMgr = SharingManager.Create(config);
        }
Exemplo n.º 9
0
        protected void OnDestroy()
        {
            Instance = null;

            // Force a disconnection so that we can stop and start Unity without connections hanging around
            this.xtoolsMgr.GetPairedConnection().Disconnect();
            this.xtoolsMgr.GetServerConnection().Disconnect();

            // Release the XTools manager so that it cleans up the C++ copy
            this.xtoolsMgr.Dispose();
            this.xtoolsMgr = null;

            // Forces a garbage collection to try to clean up any additional reference to SWIG-wrapped objects
            System.GC.Collect();
        }
        private void Start()
        {
            // We will register for session joined and left to indicate when the sharing service
            // is ready for us to make room related requests.
            sharingStage = SharingStage.Instance;
            sharingStage.SessionsTracker.CurrentUserJoined += CurrentUserJoinedSession;
            sharingStage.SessionsTracker.CurrentUserLeft   += CurrentUserLeftSession;

            // Setup the room manager callbacks.
            roomManager          = sharingStage.Manager.GetRoomManager();
            roomManagerCallbacks = new RoomManagerAdapter();

            roomManagerCallbacks.AnchorsDownloadedEvent += RoomManagerCallbacks_AnchorsDownloaded;
            roomManagerCallbacks.AnchorUploadedEvent    += RoomManagerCallbacks_AnchorUploaded;
            roomManager.AddListener(roomManagerCallbacks);
        }
Exemplo n.º 11
0
        private void Awake()
        {
            try
            {
                Instance = this;

                this.logWriter = new ConsoleLogWriter();

                if (AutoDiscoverServer)
                {
                    AutoDiscoverInit();
                }
                else
                {
                    Connect();
                }
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e);
            }
        }