Пример #1
0
    public void ShowContent(ARFile file)
    {
        // arRoot can, upon finding a marker, open its own window
        // in order to close all unnecessary things that should not
        // be on the screen during AR exploration.

        // it will close itself. It will also be closed when any other content is shown.
        arRoot.ShowContent(file);
    }
Пример #2
0
    public void ShowContent(ARFile file)
    {
        arSession.enabled = true;

        foreach (var scene in arScenes)
        {
            scene.Reset();

            if (scene.uniqueName == file.uniqueName)
            {
                scene.gameObject.SetActive(true);
            }
            else
            {
                scene.gameObject.SetActive(false);
            }
        }
    }
    IEnumerator AddDataFrom(string csv, Folder root)
    {
        yield return(LoadData(csv));

        List <List <string> > strings = loadDataResult;

        // Data structure
        // 0       1         2       3        4              5     6    7               8           9       10          11          12
        // type    parent    name    color    content        DE    EN   thumbnailurl    location    date    copyright   Text DE     Text EN
        foreach (List <string> data in strings)
        {
            FileOrFolder newF = null;
            switch (data[0])
            {
            case "folder":
                var newFolder = new Folder();
                newF = newFolder;
                break;

            case "image":
                var newImage = new ImageFile
                {
                    url          = data.ElementAtOrDefault(4, ""),
                    thumbnailURL = data.ElementAtOrDefault(7, ""),
                    location     = data.ElementAtOrDefault(8, ""),
                    date         = data.ElementAtOrDefault(9, ""),
                    copyright    = data.ElementAtOrDefault(10, "")
                };
                newF = newImage;
                break;

            case "video":
                var newVideo = new VideoFile
                {
                    url          = data.ElementAtOrDefault(4, ""),
                    thumbnailURL = data.ElementAtOrDefault(7, ""),
                    location     = data.ElementAtOrDefault(8, ""),
                    date         = data.ElementAtOrDefault(9, ""),
                    copyright    = data.ElementAtOrDefault(10, "")
                };
                newF = newVideo;
                break;

            case "ar":
                var newAR = new ARFile
                {
                    uniqueName = data.ElementAtOrDefault(4, "")
                };
                newF = newAR;
                break;

            case "text":
                var newText = new TextFile
                {
                    textDE = data.ElementAtOrDefault(11, ""),
                    textEN = data.ElementAtOrDefault(12, "")
                };
                newF = newText;
                break;

            case "game":
                newF = new GameFile();
                break;

            default:
                break;
            }
            // TODO make parser more generic

            if (newF != null)
            {
                // these datapoints apply to all cases:
                var parent = root.GetAllFilesAndFolders(true).Find(f => f.nodeName == data.ElementAtOrDefault(1, "")) as Folder;
                parent?.AddChild(newF);

                Color defaultColor;
                if (parent != null)
                {
                    defaultColor = parent.color;
                }
                else
                {
                    defaultColor = Color.gray;
                }

                newF.nodeName = data.ElementAtOrDefault(2, "");
                newF.color    = ColorFromString(data.ElementAtOrDefault(3, ""), defaultColor);
                newF.title_de = data.ElementAtOrDefault(5, "");
                newF.title_en = data.ElementAtOrDefault(6, "");
            }
        }
    }