/// <summary> /// Gets the text for the <see cref="Tooltip"/>. /// </summary> /// <param name="sender">The sender.</param> /// <param name="args">The args.</param> /// <returns>The text for the <see cref="Tooltip"/>.</returns> static StyledText[] TooltipCallback(Control sender, TooltipArgs args) { var src = (ShopItemPB)sender; var itemInfo = src.ItemInfo; return(ItemInfoHelper.GetStyledText(itemInfo)); }
static StyledText[] TooltipCallback(Control sender, TooltipArgs args) { var src = (EquippedItemPB)sender; var slot = src.Slot; IItemTable itemInfo; if (!src.EquippedForm._infoRequester.TryGetInfo(slot, out itemInfo)) { // The data has not been received yet - returning null will make the tooltip retry later return(null); } // Data was received, so format it and return it return(ItemInfoHelper.GetStyledText(itemInfo)); }
/// <summary> /// Handles the <see cref="TooltipHandler"/> callback for an item slot in the trade form. /// </summary> /// <param name="sender">The sender.</param> /// <param name="args">The <see cref="TooltipArgs"/>.</param> /// <returns>The text to display for the tooltip.</returns> StyledText[] SlotTooltipCallback(Control sender, TooltipArgs args) { // Cast the sender to the needed type var asItemSlot = sender as PeerTradeSidePanel.PeerTradeItemsCollectionSlot; if (asItemSlot == null) { return(null); } // Ensure a valid trade state var ptih = PeerTradeInfoHandler; if (ptih == null || !ptih.IsTradeOpen) { return(null); } // Get the item info for the slot IItemTable itemInfo; if (asItemSlot.ItemsCollection.IsSourceSide) { itemInfo = ptih.GetSourceItemInfo(asItemSlot.Slot); } else { itemInfo = ptih.GetTargetItemInfo(asItemSlot.Slot); } if (itemInfo == null) { return(null); } // Get and return the tooltip text return(ItemInfoHelper.GetStyledText(itemInfo)); }