Пример #1
0
        public RecycledListItem CreateItem(Transform parent)
        {
            ObjectReferencePickerItem item = (ObjectReferencePickerItem)Instantiate(referenceItemPrefab, parent, false);

            item.Skin = Skin;

            return(item);
        }
Пример #2
0
 public void Close()
 {
     onReferenceChanged      = null;
     initialValue            = null;
     currentlySelectedObject = null;
     currentlySelectedItem   = null;
     gameObject.SetActive(false);
 }
        public void Close()
        {
            onReferenceChanged         = null;
            onSelectionConfirmed       = null;
            referenceNameGetter        = null;
            referenceDisplayNameGetter = null;
            initialValue            = null;
            currentlySelectedObject = null;
            currentlySelectedItem   = null;

            references.Clear();
            filteredReferences.Clear();

            gameObject.SetActive(false);
        }
Пример #4
0
        public void OnItemClicked(RecycledListItem item)
        {
            if (currentlySelectedItem != null)
            {
                currentlySelectedItem.IsSelected = false;
            }

            currentlySelectedItem            = (ObjectReferencePickerItem)item;
            currentlySelectedObject          = currentlySelectedItem.Reference;
            currentlySelectedItem.IsSelected = true;

            if (onReferenceChanged != null)
            {
                onReferenceChanged(currentlySelectedItem.Reference);
            }
        }
Пример #5
0
        public void SetItemContent(RecycledListItem item)
        {
            ObjectReferencePickerItem it = (ObjectReferencePickerItem)item;

            it.SetContent(filteredReferences[it.Position]);

            if (it.Reference == currentlySelectedObject)
            {
                it.IsSelected         = true;
                currentlySelectedItem = it;
            }
            else
            {
                it.IsSelected = false;
            }

            it.Skin = Skin;
        }
        void IListViewAdapter.SetItemContent(RecycledListItem item)
        {
            ObjectReferencePickerItem it = (ObjectReferencePickerItem)item;

            it.SetContent(filteredReferences[it.Position], referenceDisplayNameGetter(filteredReferences[it.Position]));

            if (it.Reference == currentlySelectedObject)
            {
                it.IsSelected         = true;
                currentlySelectedItem = it;
            }
            else
            {
                it.IsSelected = false;
            }

            it.Skin = Skin;
        }
        void IListViewAdapter.OnItemClicked(RecycledListItem item)
        {
            if (currentlySelectedItem != null)
            {
                currentlySelectedItem.IsSelected = false;
            }

            currentlySelectedItem            = (ObjectReferencePickerItem)item;
            currentlySelectedObject          = currentlySelectedItem.Reference;
            currentlySelectedItem.IsSelected = true;

            try
            {
                if (onReferenceChanged != null)
                {
                    onReferenceChanged(currentlySelectedObject);
                }
            }
            catch (Exception e)
            {
                Debug.LogException(e);
            }
        }