Ejemplo n.º 1
0
        /// <summary>
        /// This function handles the cell view's button click event
        /// </summary>
        /// <param name="cellView">The cell view that had the button clicked</param>
        private void CellViewSelected(SEUIContainerItem cellView)
        {
            if (cellView == null)
            {
                // nothing was selected
                selectedImage.gameObject.SetActive(false);
                selectedImageText.text = "None";
            }
            else
            {
                // get the selected data index of the cell view
                var selectedDataIndex = (cellView as InventoryCellView).DataIndex;

                // loop through each item in the data list and turn
                // on or off the selection state. This is done so that
                // any previous selection states are removed and new
                // ones are added.
                for (var i = 0; i < _data.Count; i++)
                {
                    _data[i].Selected = (selectedDataIndex == i);
                }

                selectedImage.gameObject.SetActive(true);
                selectedImage.sprite = Resources.Load <Sprite>(_data[selectedDataIndex].spritePath + "_v");

                selectedImageText.text = _data[selectedDataIndex].itemName;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// This handler will be called any time a cell view is shown or hidden
        /// </summary>
        /// <param name="cellView">The cell view that was shown or hidden</param>
        private void CellViewVisibilityChanged(SEUIContainerItem cellView)
        {
            // cast the cell view to our custom view
            CellView view = cellView as CellView;

            // if the cell is active, we set its data,
            // otherwise we will clear the image back to
            // its default state

            if (cellView.active)
            {
                view.UpdateDataView(_data[cellView.dataIndex]);
            }
            else
            {
                view.ClearImage();
            }
        }
Ejemplo n.º 3
0
    private void CellViewVisibilityChanged(SEUIContainerItem cellview)
    {
        // cast the cell view to our custom view
        PortfolioContainerUI view = cellview as PortfolioContainerUI;

        // if the cell is active, we set its data,
        // otherwise we will clear the image back to
        // its default state

        if (cellview.active)
        {
            view.UpdateDataView(CurrentData.Porfolio[cellview.dataIndex]);
        }
        else
        {
            view.ClearView();
        }
    }