/// <summary> /// Sets component data with specified item. /// </summary> /// <param name="item">Item.</param> public void SetData(ListViewIconsItemDescription item) { if (item == null) { Icon.sprite = null; Text.text = string.Empty; } else { Icon.sprite = item.Icon; Text.text = item.Name; } Icon.SetNativeSize(); //set transparent color if no icon Icon.color = (Icon.sprite == null) ? new Color(0, 0, 0, 0) : Color.white; }
/// <summary> /// Process dropped data. /// </summary> /// <param name="data">Data.</param> /// <param name="eventData">Event data.</param> public void Drop(ListViewIconsItemDescription data, PointerEventData eventData) { if (Source.Nodes == null) { Source.Nodes = new ObservableList <TreeNode <TreeViewItem> >(); } var newItem = new TreeViewItem(data.Name) { LocalizedName = data.LocalizedName, Icon = data.Icon, Value = data.Value }; var newNode = new TreeNode <TreeViewItem>(newItem); Source.Nodes.Add(newNode); }
/// <summary> /// Process dropped data. /// </summary> /// <param name="data">Data.</param> /// <param name="eventData">Event data.</param> public void Drop(TreeNode <TreeViewItem> data, PointerEventData eventData) { var index = ListView.GetNearestIndex(eventData); var item = new ListViewIconsItemDescription() { Name = data.Item.Name, LocalizedName = data.Item.LocalizedName, Icon = data.Item.Icon, Value = data.Item.Value }; AddItem(item, index); // remove node from tree data.Parent = null; HideDropIndicator(); }
/// <summary> /// Sets component data with specified item. /// </summary> /// <param name="item">Item.</param> public void SetData(ListViewIconsItemDescription item) { if (item == null) { Icon.sprite = null; Text.text = string.Empty; } else { Icon.sprite = item.Icon; Text.text = item.LocalizedName ?? item.Name; } if (SetNativeSize) { Icon.SetNativeSize(); } //set transparent color if no icon Icon.color = (Icon.sprite == null) ? Color.clear : Color.white; }
/// <summary> /// Handle canceled drop. /// </summary> /// <param name="data">Data.</param> /// <param name="eventData">Event data.</param> public void DropCanceled(ListViewIconsItemDescription data, PointerEventData eventData) { }
/// <summary> /// Determines whether this instance can receive drop with the specified data and eventData. /// </summary> /// <returns><c>true</c> if this instance can receive drop with the specified data and eventData; otherwise, <c>false</c>.</returns> /// <param name="data">Data.</param> /// <param name="eventData">Event data.</param> public bool CanReceiveDrop(ListViewIconsItemDescription data, PointerEventData eventData) { return(true); }
// Token: 0x06004819 RID: 18457 RVA: 0x001835EC File Offset: 0x001819EC public override bool Equals(object obj) { ListViewIconsItemDescription listViewIconsItemDescription = obj as ListViewIconsItemDescription; return(listViewIconsItemDescription != null && (!(listViewIconsItemDescription.Icon == null) || !(this.Icon != null)) && (!(listViewIconsItemDescription.Icon != null) || !(this.Icon == null)) && this.Name == listViewIconsItemDescription.Name && ((this.Icon == null && listViewIconsItemDescription.Icon == null) || this.Icon.Equals(listViewIconsItemDescription.Icon))); }
/// <summary> /// Process canceled drop. /// </summary> /// <param name="data">Data.</param> /// <param name="eventData">Event data.</param> public void DropCanceled(ListViewIconsItemDescription data, PointerEventData eventData) { // hide line from CanReceiveDrop() }
/// <summary> /// Process dropped data. /// </summary> /// <param name="data">Data.</param> /// <param name="eventData">Event data.</param> public void Drop(ListViewIconsItemDescription data, PointerEventData eventData) { var listView = GetComponent <ListViewIcons>(); listView.DataSource.Add(data); }
/// <summary> /// Process canceled drop. /// </summary> /// <param name="data">Data.</param> /// <param name="eventData">Event data.</param> public void DropCanceled(ListViewIconsItemDescription data, PointerEventData eventData) { HideDropIndicator(); }