예제 #1
0
    void updateItemImages()
    {
        Debug.Log("update item images");
        ImaScrollViewport isv = this.scrollPort;

        if (isv == null)
        {
            this.scrollPort = transform.Find("DropList").GetComponent <ImaScrollViewport>();
            isv             = this.scrollPort;
        }
        if (isv != null)
        {
            Debug.Log("set items to scroll view");
            if (this.itemImage != null)
            {
                isv.itemImageName = this.itemImage.name;
            }
            else
            {
                Debug.LogWarning("Unable to get item Image to set for item");
            }
            isv.setItems(options);
        }
        else
        {
            Debug.LogError("Unable to access scroll viewport to set images");
        }
    }
예제 #2
0
    void FavButtonClicked(Dictionary <string, object> dict)
    {
        ImaScrollViewport viewport = GetComponentInChildren <ImaScrollViewport>();
        int          index         = (int)dict["index"];
        ImaFavButton button        = (ImaFavButton)dict["source"];
        DOption      option        = (DOption)dropdown.options[index + viewport.startVisibleIndex];

        Debug.Log("fav button clicked index:" + index + " source:" + button + " option:" + option.text);
        toggleFav(option);
        button.gameObject.GetComponent <Image>().sprite = option.image;
        dropdown.RefreshShownValue();
        itemsDirty = true;
        storeFavs();
    }