private void highlightBook(BookWithLocation bookInfo)
    {
        TextMesh bookInfoText = bookText.GetComponent <TextMesh>();

        bookInfoText.text = "Title: ";
        wrapText(bookInfo.book.title);
        bookInfoText.text = bookInfoText.text + "\nAuthor: ";
        wrapText(bookInfo.book.author);
    }
예제 #2
0
    // Update is called once per frame
    void Update()
    {
        //if (Input.GetKeyDown(KeyCode.UpArrow) && bookNum < pr.getNumberOfBooksInPath() - 1)
        if ((Input.GetKeyDown(KeyCode.Joystick1Button0) || Input.GetKeyDown(KeyCode.Joystick2Button0)) && bookNum < pr.getNumberOfBooksInPath() - 1)
        {
            BookWithLocation bookInfo     = pr.getBookWithLocation(bookNum);
            TextMesh         bookInfoText = bookText.GetComponent <TextMesh>();
            bookInfoText.text = "Title: ";
            wrapText(bookInfo.book.title);
            bookInfoText.text = bookInfoText.text + "\nAuthor: ";
            wrapText(bookInfo.book.author);

            if (!isShelfViewActive)
            {
                shelf.SetActive(true);
                shelf.GetComponent <ChangeShelfBlock>().highlightBlock(bookInfo.book.tag);
                shelf.SetActive(false);
            }
            else
            {
                shelf.GetComponent <ChangeShelfBlock>().highlightBlock(bookInfo.book.tag);
            }
            if (!isBookInfoActive)
            {
                book.SetActive(true);
                changeShelfHighlight(bookInfo.book.tag);
                book.SetActive(false);
            }
            else
            {
                changeShelfHighlight(bookInfo.book.tag);
            }
            bookNum += 1;
        }
        //if (Input.GetKeyDown(KeyCode.DownArrow))
        if ((Input.GetKeyDown(KeyCode.Joystick1Button1) || Input.GetKeyDown(KeyCode.Joystick2Button1)))
        {
            isBookInfoActive  = !isBookInfoActive;
            isShelfViewActive = !isShelfViewActive;
            book.SetActive(isBookInfoActive);
            shelf.SetActive(isShelfViewActive);
        }
    }
    //
    public void highlightBlock(BookWithLocation bookInfo)
    {
        string tag = bookInfo.book.tag;

        string[] loc = tag.Split('-');
        //Debug.Log(row);
        int    row_id = row[loc[3]];
        int    col_id = column[loc[2]];
        string aisle  = loc[1];

        if (string.Equals(aisle, "A") || string.Equals(aisle, "C") || string.Equals(aisle, "E"))
        {
            highlightBlock(row_id, col_id);
            updateColoumTexts(new string[] { "100", "102", "104", "106", "108", "110" });
            updateAisle(aisle);
        }
        else
        {
            highlightBlock(row_id, col_id);
            updateColoumTexts(new string[] { "101", "103", "105", "107", "109", "111" });
            updateAisle(aisle);
        }
    }
 // Use this for highlighting book
 public void highlightBookInfo(BookWithLocation bookInfo)
 {
     highlightRow(bookInfo.book.tag);
     highlightBook(bookInfo);
 }
예제 #5
0
 public void printBookWithLocation(BookWithLocation b)
 {
     Debug.Log("================");
     Debug.Log("Title: " + b.book.title + ", author: " + b.book.author + ", tag: " + b.book.tag);
     Debug.Log("Location: " + b.location[0] + ", " + b.location[1]);
 }