private IEnumerator setGlyphImage(Glyph glyph)
    {
        if (!ApplicationFileManager.IsGlyphDownloaded(glyph))
        {
            ServerCall call = new ServerCall(ServerInteract.DownloadGlyphFromFirebase(glyph));
            yield return(StartCoroutine(call.call()));
        }

        Texture2D texture = ApplicationFileManager.LoadTextureFromPNGFile(ApplicationFileManager.GetLocalDownloadPath(glyph));

        glyphImage.texture = texture;
        imageSet           = true;

        imageTransform.sizeDelta = new Vector2(texture.width, texture.height);

        if (placeHolderHeight != 0.0f)
        {
            float imageScale = (placeHolderHeight - IMAGE_PADDING * 2.0f) / texture.height;
            imageTransform.localScale = new Vector3(imageScale, imageScale, imageScale);

            imageResized = true;
        }

        yield return("Done");
    }
示例#2
0
    private IEnumerator doRenderForGlyph(Glyph glyph)
    {
        Debug.Log("Render: Loading " + ApplicationFileManager.GetLocalDownloadPath(glyph));

        if (!ApplicationFileManager.IsGlyphDownloaded(glyph))
        {
            Debug.Log("Render: Downloading");
            ServerCall download = new ServerCall(ServerInteract.DownloadGlyphFromFirebase(glyph));
            yield return(StartCoroutine(download.call()));

            if (download.ReturnException != null)
            {
                statusPanel.showErrorStatus(download.ReturnException.Message);
                throw download.ReturnException;
            }
            //yield return StartCoroutine (ServerInteract.downloadObjectFromAWS (glyph.getPathToContent (), LoadUserData.getLoggedInUser ().getAWSAuthToken ()));
            Debug.Log("Render: Downloading finished");
        }
        else
        {
            Debug.Log("Render: Glyph already downloaded");
        }

        string extension = ApplicationFileManager.GetFileExtension(glyph.GetPathToContent());

        if (extension.Equals(ApplicationFileManager.PNG_EXTENSION))
        {
            Debug.Log("Render: Loading PNG File");
            renderPNGGlyph(glyph);
            Debug.Log("Render: Finished");
        }
        else
        {
            Debug.LogError("Render: Unknown Render Type " + extension);
        }

        yield return("Done");
    }
示例#3
0
    private IEnumerator doRenderForGlyph(Glyph glyph)
    {
        Debug.Log("Render: Loading " + ApplicationFileManager.GetLocalDownloadPath(glyph));

        if (!ApplicationFileManager.IsGlyphDownloaded(glyph))
        {
            Debug.Log("Render: Downloading");
            ServerCall download = new ServerCall(ServerInteract.DownloadGlyphFromFirebase(glyph));
            yield return(StartCoroutine(download.call()));

            //yield return StartCoroutine (ServerInteract.downloadObjectFromAWS (glyph.getPathToContent (), LoadUserData.getLoggedInUser ().getAWSAuthToken ()));
            Debug.Log("Render: Downloading finished");
        }
        else
        {
            Debug.Log("Render: Glyph already downloaded");
        }

        string extension = ApplicationFileManager.GetFileExtension(glyph.GetPathToContent());

        if (extension.Equals(ApplicationFileManager.PNG_EXTENSION))
        {
            Debug.Log("Render: Loading PNG File");
            renderPNGGlyph(glyph);
        }
        else
        {
            Debug.Log("Render: Unknown Render Type " + extension);
        }

        ServerCall markGlyphFound = new ServerCall(ServerInteract.INSTANCE.MarkGlyphAsFound(glyph));

        StartCoroutine(markGlyphFound.call());

        Debug.Log("Render: Finished");
        yield return("Done");
    }
示例#4
0
 void Awake()
 {
     DontDestroyOnLoad(this.gameObject);
     INSTANCE = this;
 }