private void disconnect() { if (server != null) { server.RemoveAllDataProcessors(); server.Disconnect(); server = null; } foreach (var i in cursorToInternalId) { cancelPointer(i.Value); } foreach (var i in blobToInternalId) { cancelPointer(i.Value); } foreach (var i in objectToInternalId) { cancelPointer(i.Value); } cursorToInternalId.Clear(); blobToInternalId.Clear(); objectToInternalId.Clear(); }
private void Connect() { if (!Application.isPlaying) { return; } if (_tuioServer != null) { Disconnect(); } if (Instance != null) { throw new UnityException("不允许多个单例"); } Instance = this; _tuioServer = new TuioServer(port); _waitForEndOfFrame = new WaitForEndOfFrame(); _coroutine = StartCoroutine(EndFrame()); Debug.Log("TUIO Port" + port); _tuioServer.Connect(); Debug.Log("TUIO Connect"); }
void disconnect() { if (tuioServer != null) { tuioServer.RemoveAllDataProcessors(); tuioServer.Disconnect(); tuioServer = null; } }
//停止监听 private void Disconnect() { if (mServer != null) { mServer.RemoveAllDataProcessors(); mServer.Disconnect(); mServer = null; } mMarkerDictionary.Clear(); }
private void OnDisable()//关闭 { if (server != null) { server.RemoveDataProcessor(cursorProcessor); server.RemoveAllDataProcessors(); server.Disconnect(); server = null; } }
/// <inheritdoc /> protected override void Start() { base.Start(); server = new TuioServer(TuioPort); server.MovementThreshold = MovementThreshold * TouchManager.Instance.DotsPerCentimeter / Mathf.Max(Screen.width, Screen.height); server.CursorAdded += OnCursorAdded; server.CursorUpdated += OnCursorUpdated; server.CursorRemoved += OnCursorRemoved; server.Connect(); }
/// <inheritdoc /> protected override void OnEnable() { base.OnEnable(); server = new TuioServer(TuioPort); server.MovementThreshold = MovementThreshold * manager.DotsPerCentimeter / Mathf.Max(Screen.width, Screen.height); server.CursorAdded += OnCursorAdded; server.CursorUpdated += OnCursorUpdated; server.CursorRemoved += OnCursorRemoved; server.Connect(); }
private void disconnect() { if (server != null) { server.RemoveAllDataProcessors(); server.Disconnect(); server = null; } foreach (var i in cursorToInternalId) { cancelTouch(i.Value.Id); } }
private void connect() { if (!Application.isPlaying) { return; } if (server != null) { disconnect(); } server = new TuioServer(TuioPort); server.Connect(); updateInputs(); }
//监听端口 private void Connect() { if (!Application.isPlaying) { return; } if (mServer != null) { Disconnect(); } mServer = new TuioServer(tuioPort); mServer.Connect(); InitProcessor(); }
private Vector2 screen; //屏幕长宽值 private void OnEnable() //启动 { screen.x = Screen.width; screen.y = Screen.height; cursorProcessor = new CursorProcessor();//委托挂载到线程里 cursorProcessor.CursorAdded += OnCursorAdded; cursorProcessor.CursorUpdated += OnCursorUpdated; cursorProcessor.CursorRemoved += OnCursorRemoved; server = new TuioServer(TuioPort); //启动服务 server.Connect(); //连接 server.AddDataProcessor(cursorProcessor); //处理器添加 }
private void connect() { if (!Application.isPlaying) { return; } if (tuioServer != null) { disconnect(); } tuioServer = new TuioServer(port); Debug.Log("TUIO Port" + port); tuioServer.Connect(); Debug.Log("TUIO Connect"); }
private void Disconnect() { if (_tuioServer != null) { _tuioServer.RemoveAllDataProcessors(); _tuioServer.Disconnect(); _tuioServer = null; _waitForEndOfFrame = null; if (_coroutine != null) { StopCoroutine(_coroutine); } _coroutine = null; Instance = null; } }
private static void ListenForTUIO() { Console.WriteLine(string.Format("TUIO listening on port {0}... (Press escape to quit)", port)); // tuio tuioServer = new TuioServer(port); CursorProcessor cursorProcessor = new CursorProcessor(); cursorProcessor.CursorAdded += OnCursorAdded; cursorProcessor.CursorUpdated += OnCursorUpdated; cursorProcessor.CursorRemoved += OnCursorRemoved; BlobProcessor blobProcessor = new BlobProcessor(); blobProcessor.BlobAdded += OnBlobAdded; blobProcessor.BlobUpdated += OnBlobUpdated; blobProcessor.BlobRemoved += OnBlobRemoved; ObjectProcessor objectProcessor = new ObjectProcessor(); objectProcessor.ObjectAdded += OnObjectAdded; objectProcessor.ObjectUpdated += OnObjectUpdated; objectProcessor.ObjectRemoved += OnObjectRemoved; // listen... tuioServer.Connect(); tuioServer.AddDataProcessor(cursorProcessor); tuioServer.AddDataProcessor(blobProcessor); tuioServer.AddDataProcessor(objectProcessor); do { while (!Console.KeyAvailable) { Thread.Sleep(100); } } while (Console.ReadKey(true).Key != ConsoleKey.Escape); // done tuioServer.Disconnect(); tuioServer = null; Console.WriteLine("Bye!"); }
public TuioSample() { this.server = new TuioServer(); }