UpdateBookData() public method

Updates the book data in the bookObject gameObject
public UpdateBookData ( BookData, bookData ) : void
bookData BookData,
return void
Example #1
0
    /// <summary>
    /// Fetches the JSON data from a server, called from TargetCreated()
    /// </summary>
    private IEnumerator LoadJSONBookData(string jsonBookUrl)
    {
        // Gets the full book json url
        string fullBookURL = JsonServerUrl + jsonBookUrl;

        // Gets the json book info from the url
        mJsonBookInfo = new WWW(fullBookURL);
        yield return(mJsonBookInfo);

        // Loading done
        mIsLoadingBookData = false;

        if (mJsonBookInfo.error == null)
        {
            // Parses the json Object
            JSONParser parser = new JSONParser();

            // Parses book data from JSON and assigns it to mBookData
            BookData bookData = parser.ParseString(mJsonBookInfo.text);
            mBookData = bookData;

            // Updates the BookData info in the augmented object
            mBookInformationParser.UpdateBookData(bookData);

            mIsLoadingBookThumb = true;
        }
        else
        {
            Debug.LogError("Error downloading json");
        }
    }
    //functionforn video streaming

    private void LoadJSONBookData(string jsonBookUrl)
    {
        Debug.Log("inside json parsing ");
        // Gets the full book json url
        string fullBookURL = JsonServerUrl + jsonBookUrl;

        if (!mIsJSONRequested)
        {
            // Gets the json book info from the url
            mJsonBookInfo    = new WWW(fullBookURL);
            mIsJSONRequested = true;
            Debug.Log(fullBookURL);
        }

        //if(mJsonBookInfo.progress >= 1)
        //{
        if (mJsonBookInfo.error == null)
        {
            Debug.Log("json parsing started");
            // Parses the json Object
            JSONParser parser = new JSONParser();

            BookData bookData = parser.ParseString(mJsonBookInfo.text);
            //var str = parser.ParseString(mJsonBookInfo.text);
            //Debug.Log(str.v);
            mBookData = bookData;
            //Debug.Log(mBookData.BookTitle);

            // Updates state variables
            //mIsLoadingBookData = false;

            // Updates the BookData info in the augmented object
            mBookInformationParser.UpdateBookData(bookData);


            //mIsLoadingBookThumb = true;
        }
        else
        {
            Debug.LogError("Error downloading json");
            //mIsLoadingBookData = false;
        }
        //}
    }