protected override async void Start() { base.Start(); _environmentNode = Scene.CreateChild(); EnableGestureTapped = true; _cursor = Scene.CreateComponent <SpatialCursor>(); _spatialMaterial = new Material(); _spatialMaterial.SetTechnique(0, CoreAssets.Techniques.NoTextureUnlitVCol, 1, 1); await StartSpatialMapping(new Vector3(50, 50, 10), 1200, onlyAdd : true); }
public async Task <bool> ConnectAsync() { cursor?.Remove(); cursor = null; var textNode = LeftCamera.Node.CreateChild(); textNode.Position = new Vector3(0, 0, 1); textNode.SetScale(0.1f); var text = textNode.CreateComponent <Text3D>(); text.Text = "Look at the QR code\nopened in Android/iOS/UWP app..."; text.HorizontalAlignment = HorizontalAlignment.Center; text.VerticalAlignment = VerticalAlignment.Center; text.TextAlignment = HorizontalAlignment.Center; text.SetFont(CoreAssets.Fonts.AnonymousPro, 20); text.SetColor(Color.Green); string ipAddressString = "", ip = ""; int port; while (!Utils.TryParseIpAddress(ipAddressString, out ip, out port)) { #if VIDEO_RECORDING //see OnGestureDoubleTapped for comments ipAddressString = await fakeQrCodeResultTaskSource.Task; #else ipAddressString = await QrCodeReader.ReadAsync(); #endif } InvokeOnMain(() => text.Text = "Connecting..."); if (await clientConnection.ConnectAsync(ip, port)) { InvokeOnMain(() => text.Text = "Connected!"); await environmentNode.RunActionsAsync(new DelayTime(2)); await StartSpatialMapping(new Vector3(100, 100, 100)); InvokeOnMain(() => { textNode.Remove(); cursor = Scene.CreateComponent <SpatialCursor>(); }); return(true); } return(false); }
public async Task<bool> ConnectAsync() { cursor?.Remove(); cursor = null; var textNode = LeftCamera.Node.CreateChild(); textNode.Position = new Vector3(0, 0, 1); textNode.SetScale(0.1f); var text = textNode.CreateComponent<Text3D>(); text.Text = "Look at the QR code\nopened in Android/iOS/UWP app..."; text.HorizontalAlignment = HorizontalAlignment.Center; text.VerticalAlignment = VerticalAlignment.Center; text.TextAlignment = HorizontalAlignment.Center; text.SetFont(CoreAssets.Fonts.AnonymousPro, 20); text.SetColor(Color.Green); string ipAddressString = "", ip = ""; int port; while (!Utils.TryParseIpAddress(ipAddressString, out ip, out port)) { #if VIDEO_RECORDING //see OnGestureDoubleTapped for comments ipAddressString = await fakeQrCodeResultTaskSource.Task; #else ipAddressString = await QrCodeReader.ReadAsync(); #endif } InvokeOnMain(() => text.Text = "Connecting..."); if (await clientConnection.ConnectAsync(ip, port)) { InvokeOnMain(() => text.Text = "Connected!"); await environmentNode.RunActionsAsync(new DelayTime(2)); await StartSpatialMapping(new Vector3(100, 100, 100)); InvokeOnMain(() => { textNode.Remove(); cursor = Scene.CreateComponent<SpatialCursor>(); }); return true; } return false; }