Exemple #1
0
    public bool UpdateCurrDoc(string newDoc, int newPage = -1)
    {
        bool isDiff = false;

        if (CurrDocStr != newDoc)
        {
            if (DictPrintedDocObjects.ContainsKey(newDoc))
            {
                CurrDocObj = DictPrintedDocObjects[newDoc];
            }
            else
            {
                Debug.LogError("Error: Current document object not found:" + newDoc);
                return(true);
            }

            if (DictDocuments.ContainsKey(newDoc))
            {
                CurrARDoc = DictDocuments[newDoc];
            }
            else
            {
                Debug.LogError("Error: Current ARDocument instance doesn't exist:" + newDoc);
            }

            CurrDocStr = newDoc;
            isDiff     = true;
            TitlePage.PreloadTags(newDoc);
        }
        return(isDiff);
    }
Exemple #2
0
    // Update is called once per frame
    void Update()
    {
        // Load the markers if not done yet and the controller is ready
        if (LoadedMarkers == false && _controller.status == ARUWP.ARUWP_STATUS_RUNNING)
        {
            Debug.Log("Size of markers from controller:" + ARUWPController.markers.Count);
            foreach (var key in ARUWPController.markers.Keys)
            {
                ARUWPMarker marker = ARUWPController.markers[key];
                if (marker.type == ARUWPMarker.MarkerType.single_barcode && marker.target != null)
                {
                    // Get the barcode ID, target GameObject
                    if (DictBarcodeFileNames.ContainsKey(marker.singleBarcodeID))
                    {
                        string     fName = DictBarcodeFileNames[marker.singleBarcodeID];
                        GameObject gObj  = marker.target;
                        //gObj.SetActive(false);
                        // Load the material for reference (they share the common material)
                        if (marker.singleBarcodeID == 0)
                        {
                            MeshRenderer meshRenderer = gObj.GetComponentInChildren <MeshRenderer>();
                            RefPage.SetPrintedMaterial(meshRenderer.sharedMaterial);
                            Debug.Log("Found printed item material");
                            // Debugging
                            //gObj.SetActive(true);
                            //_refPrintedMaterial.color = new Color(_refPrintedMaterial.color.r, _refPrintedMaterial.color.g, _refPrintedMaterial.color.b, 0.1f);
                        }
                        if (marker.singleBarcodeID >= 52)
                        {
                            // Sticker
                            gObj.SetActive(true);
                        }
                        else if (marker.singleBarcodeID >= 41)
                        {
                            // Board
                            gObj.SetActive(true);
                            DictBarcodeToARUWPMarker.Add(marker.singleBarcodeID, key);
                        }
                        else
                        {
                            // Other files
                            gObj.SetActive(false);
                            TitlePage.PreloadTags(fName);
                        }

                        DictPrintedDocObjects.Add(fName, gObj);
                        Debug.Log("Found the GameObject for:" + fName);
                    }
                    else
                    {
                        Debug.Log("Error: barcode not found:" + marker.singleBarcodeID);
                    }
                }
            }
            LoadedMarkers = true;
        }
    }