Load() public method

public Load ( string filepath ) : void
filepath string
return void
示例#1
0
    // Open the ebook, so its metadata can be accessed.
    private IEnumerator getBookProperties(BookPropertySet bp)
    {
        bool retrieved = false;

        if (BookPropertySet.haveRecord(bp.filename))
        {
            try
            {
                bp.Load(bp.filename);
                retrieved = true;
            }
            catch (Exception)
            {
                Debug.Log("Bad file " + bp.filename);
            }
        }

        if (!retrieved)
        {
            loading = true;
            Thread t = new Thread(new ParameterizedThreadStart(doLoading));
            t.Start(bp);
            while (loading)
            {
                yield return(new WaitForSeconds(0.1f));
            }

            // save record.
            bp.Save();
        }
    }
示例#2
0
    public void addBook(string bookIdentifier, GameObject bookMarkerPrefab)
    {
        books.Add(bookIdentifier);

        if (bookMarkerPrefab != null)
        {
            BookPropertySet bp = new BookPropertySet();
            bp.Load(bookIdentifier);

            GameObject bookObject = UnityEngine.Object.Instantiate(bookMarkerPrefab, new Vector3(2, 2, 2), Quaternion.identity);
            bookObject.GetComponent <BookProperties> ().props = bp;
            bookObject.transform.localRotation = Quaternion.AngleAxis(90.0f, Vector3.right);
            //   bookObject.transform.localScale = new Vector3 (0.98f * bookThickness, 0.6f * trolleyDepth, trolleyDepth);
            bookObject.transform.Find("CheapBook").GetComponent <MeshRenderer> ().material.color = new Color(bp.colour[0], bp.colour[1], bp.colour[2]);

            // seems to fix a unity bug that prevents some colliders from being spotted.
            bookObject.GetComponent <BoxCollider> ().enabled = false;
            bookObject.GetComponent <BoxCollider> ().enabled = true;
        }

        Debug.Log("Added " + bookIdentifier);
    }