void Start() { spatialGraph = qrCodePlane.GetComponent <SpatialGraphCoordinateSystem>(); plane = qrCodePlane.transform.Find("Cube").gameObject; data = qrCodePlane.transform.Find("Text").GetComponent <TextMeshPro>(); qRScanner = GetComponent <QRScanner>(); qRScanner.OnScanned .Subscribe(qr => { qrCodePlane.SetActive(true); spatialGraph.Id = qr.SpatialGraphNodeId; plane.transform.localPosition = new Vector3(qr.PhysicalSideLength / 2, qr.PhysicalSideLength / 2, 0); plane.transform.localScale = new Vector3(qr.PhysicalSideLength, qr.PhysicalSideLength, 0.001f); data.text = qr.Data; data.gameObject.transform.localPosition = new Vector3(qr.PhysicalSideLength / 2, qr.PhysicalSideLength / 2, -0.001f); }) .AddTo(this); qRScanner.IsReady .Where(x => x) .First() .Subscribe(_ => qRScanner.StartScan()) .AddTo(this); qrCodePlane.SetActive(false); }
void Start() { qrScn = GetComponent <QRScanner>(); cacheMaker = GetComponent <CacheMaker>(); cacheChecker = GetComponent <CacheChecker>(); imageDownload = GetComponent <ImageDownload>(); StartLoad(); }
void Start() { textMeshPro.text = ""; qRScanner = GetComponent <QRScanner>(); qRScanner.OnScanned .Subscribe(qr => { Debug.Log(qr.Data); textMeshPro.text = qr.Data; }) .AddTo(this); qRScanner.IsReady .Where(x => x) .First() .Subscribe(_ => qRScanner.StartScan()) .AddTo(this); }
// Update is called once per frame void Update() { if (gameObject.GetComponent <MeshRenderer>().enabled&& !foundQR) { updateTimer += Time.deltaTime; if (updateTimer > 0.03) { updateTimer = 0; //StartCoroutine(StartScanRoutine()); QRScanner.CameraRenderTextureSnapshot(gameCam, renderTex); string QRText = QRScanner.ScanTexture(QRScanner.CameraRenderTextureSnapshot(gameCam, renderTex)); if (QRText != null) { DownloadImageAndAddToRenderTarget(renderTarget, QRText); foundQR = true; Debug.Log("Scanned QR: " + QRText); } //Debug.Log("Framerate: " + 1 / Time.deltaTime); } } }
public QRScannerJSInterface(WebView webView) { this.webView = webView; qrScanner = new QRScanner(); }