protected override void RefreshUI(NetInfo netInfo) { if (itemData != null) { color = NetworkSkinPanelController.IsSelected(itemData.ID, itemData.Type) ? selectedColor : isRowOdd ? oddColor : evenColor; } }
private void OnMouseLeaveEvent(UIComponent component, UIMouseEventParameter eventParam) { if (itemData != null) { color = NetworkSkinPanelController.IsSelected(itemData.ID, itemData.Type) ? selectedColor : isRowOdd ? oddColor : evenColor; } }
private void OnMouseEnterEvent(UIComponent component, UIMouseEventParameter eventParam) { if (itemData != null) { if (!NetworkSkinPanelController.IsSelected(itemData.ID, itemData.Type)) { color = new Color32((byte)(oddColor.r + 25), (byte)(oddColor.g + 25), (byte)(oddColor.b + 25), 255); } } }
private void DisplayItem(bool isRowOdd) { color = NetworkSkinPanelController.IsSelected(itemData.ID, itemData.Type) ? selectedColor : isRowOdd ? oddColor : evenColor; if (itemData.ThumbnailAtlas != null && itemData.ThumbnailSprite != null) { thumbnailSprite.isVisible = true; thumbnailSprite2.isVisible = false; thumbnailSprite.atlas = itemData.ThumbnailAtlas; thumbnailSprite.spriteName = itemData.ThumbnailSprite; } else { thumbnailSprite.isVisible = false; thumbnailSprite2.isVisible = true; thumbnailSprite2.texture = itemData.ThumbnailTexture; } nameLabel.text = itemData.DisplayName; lightColorPanel.color = itemData.LightColor; favouriteCheckbox.isChecked = itemData.IsFavourite || IsBlacklisted(); checkedSprite.spriteName = IsBlacklisted() ? Resources.Blacklisted : Resources.Star; uncheckedSprite.spriteName = IsBlacklisted() ? "" : Resources.StarOutline; favouriteCheckbox.isVisible = true; for (int i = 0; i < enumNames.Length; i++) { if (itemData.ID == enumNames[i]) { favouriteCheckbox.isVisible = false; } } if (itemData.ID == "#DEFAULT#" || itemData.ID == "#NONE#") { favouriteCheckbox.isVisible = false; } UpdateCheckboxTooltip(); }
protected override void SetupRowsData() { int selectedIndex = 0; if (fastList.RowsData == null) { fastList.RowsData = new FastList <object>(); } fastList.RowsData.Clear(); ListPanelController <T> controller = GetController(); var itemCount = controller.Items.Count; fastList.RowsData.SetCapacity(itemCount); FavouritesList.Clear(); Blacklist.Clear(); NormalList.Clear(); int index = 0; List <string> favList = Persistence.GetFavourites(UIUtil.PanelToItemType(PanelType)); List <string> blacklist = Persistence.GetBlacklisted(UIUtil.PanelToItemType(PanelType)); foreach (ListPanelController <T> .Item item in controller.Items) { if (item.Id == "#NONE#" || item.Id == "#DEFAULT#") { ListItem listItem = CreateListItem(item); if (NetworkSkinPanelController.IsSelected(listItem.ID, listItem.Type)) { selectedIndex = index; } fastList.RowsData.Add(listItem); index++; continue; } else if (favList.Contains(item.Id)) { FavouritesList.Add(item); } else if (blacklist.Contains(item.Id) && !IsDefault(item.Id)) { Blacklist.Add(item); } else { NormalList.Add(item); } } for (int i = 0; i < FavouritesList.Count; i++) { ListPanelController <T> .Item item = FavouritesList[i] as ListPanelController <T> .Item; ListItem listItem = CreateListItem(item); if (NetworkSkinPanelController.IsSelected(listItem.ID, listItem.Type)) { selectedIndex = index; } fastList.RowsData.Add(listItem); index++; } for (int i = 0; i < NormalList.Count; i++) { ListPanelController <T> .Item item = NormalList[i] as ListPanelController <T> .Item; ListItem listItem = CreateListItem(item); if (NetworkSkinPanelController.IsSelected(listItem.ID, listItem.Type)) { selectedIndex = index; } fastList.RowsData.Add(listItem); index++; } if (!Persistence.HideBlacklisted) { for (int i = 0; i < Blacklist.Count; i++) { ListPanelController <T> .Item item = Blacklist[i] as ListPanelController <T> .Item; ListItem listItem = CreateListItem(item); if (NetworkSkinPanelController.IsSelected(listItem.ID, listItem.Type)) { selectedIndex = index; } fastList.RowsData.Add(listItem); index++; } } fastList.DisplayAt(Persistence.DisplayAtSelected ? selectedIndex : -1); fastList.SelectedIndex = selectedIndex; }