Example #1
0
    void Start()
    {
        content = new AnnotationContent();

        images = new List <Texture2D>();

        //this changes parsedText and imgPaths
        ParseAnnotation.ParseAnnotationText(text, content);

        if (includeImages)
        {
            foreach (string path in content.imagePaths)
            {
                //grabbing byte data from file so we can convert it into a texture
                try {
                    byte[]    fileData = File.ReadAllBytes(imagePath + path);
                    Texture2D img      = new Texture2D(2, 2);
                    img.LoadImage(fileData);
                    images.Add(img);
                } catch (Exception e)
                {
                    Debug.Log(e);
                    images.Add(null);
                }
            }
        }
    }
Example #2
0
    void Start()
    {
        content = new AnnotationContent();

        scrollPosition = new Vector2(0, 0);

        rectangle = new Rect(BOX_X, BOX_Y, BOX_WIDTH, BOX_HEIGHT);

        //setting up style for text
        fullStyle                  = new GUIStyle();
        fullStyle.wordWrap         = true;
        fullStyle.richText         = true;
        fullStyle.normal.textColor = Color.white;
        fullStyle.padding.bottom   = 15;
        fullStyle.padding.top      = 15;

        images = new List <Texture2D>();

        //this changes parsedText and imgPaths
        ParseAnnotation.ParseAnnotationText(text, content);

        if (includeImages)
        {
            foreach (string path in content.imagePaths)
            {
                //grabbing byte data from file so we can convert it into a texture
                try {
                    byte[]    fileData = File.ReadAllBytes(imagePath + path);
                    Texture2D img      = new Texture2D(2, 2);
                    img.LoadImage(fileData);
                    images.Add(img);
                } catch (Exception e)
                {
                    Debug.Log(e);
                    images.Add(null);
                }
            }
        }
    }